I think ADFS supports this so you shouldn't have to write any code. Just do some configuration tweaking.
AD FS implements the standards based WS-Federation protocol
and Security Assertion Markup Language (SAML).
http://msdn.microsoft.com/en-us/library/bb897402.aspx
However, you might need to tweak some code based on how the domains and usernames are handled. For example, if the app just uses the username as a key and there's another guy in a different domain/directory with the same username then you'll have problems. If they use domain/username, then it would be less of a problem, but you might still have collisions based on how the user authentication and lookups are handled.
There are some commerical products provided by Ping Identity and RSA (EMC) that do some of the SAML work for you, too.
Note that I'm a dev and not a AD/networking guy (so I could be wrong about AD stuff), but I'll be working with this in the near future to integrate some of my intranet sites to our various sibling companies/divisions who are on different networks/directories.