Is it possible find users from trusted domain by using UserPrincipal.FindByIdentity

2.3k Views Asked by At

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");
1

There are 1 best solutions below

2
On

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.