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; } }
just call constructor of windowsidentity upn:
windowsidentity winid = new windowsidentity(upn);
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!
windowsidentity winid = s4uclient.upnlogon(upn);
used excel services , performancepoint services.
its cached once used. has other checks against well.
Comments
Post a Comment