gandarez
gandarez

Reputation: 2662

Cast UserPrincipal to WindowsIdentity

I've created a WCF service to authorize my apps through AzMan services. I've been trying to cast an UserPrincipal to WindowsIdentity by many ways. My scenario is:

A Web MVC calling a WCF service which needs to pass a windows identity variable to an AzMan class.

var u1 = new WindowsIdentity("MyDomain\\userName")

throws

The name provided is not a properly formed account name.

var u2 = new WindowsIndetity("[email protected]")

throws

The user name or password is incorrect.

I'm able to get an UserPrincipal from "[email protected]" calling

var pc = new PrincipalContext(ContextType.Domain);
UserPrincipal user = UserPrincipal.FindByIdentity(pc, IdentityType.UserPrincipalName, upn);

In a nutshell I'm stucked because the company where I work uses AzMan everywhere.

Upvotes: 4

Views: 1530

Answers (0)

Related Questions