c# - What is the best way to retrieve a WindowsIdentity from a ClaimsIdentity -


so far found out 2 solutions windowsidentity object claimsidentity. first extract user principal name (upn).

claimsidentity ci = (claimsidentity) thread.currentprincipal.identity;     string upn = null; foreach (claim c in ci.claims) {     if (c.claimtype == claimtypes.upn)     {         upn = c.value;         break;     } } 
  1. just call constructor of windowsidentity upn:

    windowsidentity winid = new windowsidentity(upn);

  2. use claims windows token service (c2wts):

    windowsidentity winid = s4uclient.upnlogon(upn);

solution 1 seems me simpler , easier solution, don't understand purpose of c2wts?

any suggestions?

tnx!

  1. windowsidentity winid = s4uclient.upnlogon(upn);

used excel services , performancepoint services.

its cached once used. has other checks against well.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -