ASPC.Marvel.CrimeAPI.TokenHelper.GetS2SClientContextWithWindowsIdentity C# (CSharp) Метод

GetS2SClientContextWithWindowsIdentity() публичный статический Метод

Retrieves an S2S client context with an access token signed by the application's private certificate on behalf of the specified WindowsIdentity and intended for application at the targetApplicationUri using the targetRealm. If no Realm is specified in web.config, an auth challenge will be issued to the targetApplicationUri to discover it.
public static GetS2SClientContextWithWindowsIdentity ( Uri targetApplicationUri, System.Security.Principal.WindowsIdentity identity ) : ClientContext
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
Результат 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);
        }