We have two domains with one-way trust.
Domain EXT that has External one-way trust configured to domain INT. So I would like to connect to EXT domain by using EXT domain user credentials and search for users that are in INT domain.
The question - Is it possible by using default API like?:
var found = UserPrincipal.FindByIdentity(context,
IdentityType.SamAccountName, 'a.someone');
Where 'a.someone' is SamAccountName for user from INT domain.
Where 'context' initialized like the following:
var contextOptions = ContextOptions.Negotiate |
ContextOptions.Signing | ContextOptions.Sealing;
var context = new PrincipalContext(ContextType.Domain, "EXT.loc",
null, contextOptions, "EXT\\Administrator", "password");
Here is a thread about AD search. PrincipalContext is not bad, easy-to-use in few situation, but not complete enough.
Concerning authentication, it depends of the execution environment. Someone asked for this point here.
I hope that helped.