ChainStoreWeb.TokenHelper.GetS2SAccessTokenWithWindowsIdentity C# (CSharp) Method

GetS2SAccessTokenWithWindowsIdentity() public static method

Retrieves an S2S access token signed by the application's private certificate on behalf of the specified WindowsIdentity and intended for the SharePoint at the targetApplicationUri. If no Realm is specified in web.config, an auth challenge will be issued to the targetApplicationUri to discover it.
public static GetS2SAccessTokenWithWindowsIdentity ( Uri targetApplicationUri, System.Security.Principal.WindowsIdentity identity ) : string
targetApplicationUri System.Uri 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 string
        public static string GetS2SAccessTokenWithWindowsIdentity(
            Uri targetApplicationUri,
            WindowsIdentity identity)
        {
            string realm = string.IsNullOrEmpty(Realm) ? GetRealmFromTargetUrl(targetApplicationUri) : Realm;

            JsonWebTokenClaim[] claims = identity != null ? GetClaimsWithWindowsIdentity(identity) : null;

            return GetS2SAccessTokenWithClaims(targetApplicationUri.Authority, realm, claims);
        }