public static GetS2SClientContextWithWindowsIdentity ( |
||
targetApplicationUri | Url of the target SharePoint site | |
identity | System.Security.Principal.WindowsIdentity | Windows identity of the user on whose behalf to create the access token |
return | ClientContext |
public static ClientContext GetS2SClientContextWithWindowsIdentity(
Uri targetApplicationUri,
WindowsIdentity identity)
{
string realm = string.IsNullOrEmpty(Realm) ? GetRealmFromTargetUrl(targetApplicationUri) : Realm;
JsonWebTokenClaim[] claims = identity != null ? GetClaimsWithWindowsIdentity(identity) : null;
string accessToken = GetS2SAccessTokenWithClaims(targetApplicationUri.Authority, realm, claims);
return GetClientContextWithAccessToken(targetApplicationUri.ToString(), accessToken);
}