protected AcquireTokenHandlerBase(Authenticator authenticator, TokenCache tokenCache, string resource, ClientKey clientKey, TokenSubjectType subjectType, bool callSync)
        {
            this.Authenticator = authenticator;
            this.CallState = CreateCallState(this.Authenticator.CorrelationId, callSync);
            Logger.Information(this.CallState, 
                string.Format("=== Token Acquisition started:\n\tAuthority: {0}\n\tResource: {1}\n\tClientId: {2}\n\tCacheType: {3}\n\tAuthentication Target: {4}\n\t",
                authenticator.Authority, resource, clientKey.ClientId,
                (tokenCache != null) ? tokenCache.GetType().FullName + string.Format(" ({0} items)", tokenCache.Count) : "null",
                subjectType));

            this.tokenCache = tokenCache;

            if (string.IsNullOrWhiteSpace(resource))
            {
                var ex = new ArgumentNullException("resource");
                Logger.Error(this.CallState, ex);
                throw ex;
            }

            this.Resource = (resource != NullResource) ? resource : null;
            this.ClientKey = clientKey;
            this.TokenSubjectType = subjectType;

            this.LoadFromCache = (tokenCache != null);
            this.StoreToCache = (tokenCache != null);
            this.SupportADFS = false;
        }
        private void AddClientKey(ClientKey clientKey)
        {
            if (clientKey.ClientId != null)
            {
                this[OAuthParameter.ClientId] = clientKey.ClientId;
            }

            if (clientKey.Credential != null)
            {
                if (clientKey.Credential.ClientSecret != null)
                {
                    this[OAuthParameter.ClientSecret] = clientKey.Credential.ClientSecret;
                }
                else
                {
                    this.AddSecureParameter(OAuthParameter.ClientSecret, clientKey.Credential.SecureClientSecret);
                }
            }
            else if (clientKey.Assertion != null)
            {
                this[OAuthParameter.ClientAssertionType] = clientKey.Assertion.AssertionType;
                this[OAuthParameter.ClientAssertion]     = clientKey.Assertion.Assertion;
            }
            else if (clientKey.Certificate != null)
            {
                JsonWebToken    jwtToken        = new JsonWebToken(clientKey.Certificate, clientKey.Authenticator.SelfSignedJwtAudience);
                ClientAssertion clientAssertion = jwtToken.Sign(clientKey.Certificate);
                this[OAuthParameter.ClientAssertionType] = clientAssertion.AssertionType;
                this[OAuthParameter.ClientAssertion]     = clientAssertion.Assertion;
            }
        }
 private void AddClientKey(ClientKey clientKey)
 {
     if (clientKey.ClientId != null)
     {
         this[OAuthParameter.ClientId] = clientKey.ClientId;
     }
 }
 private void AddClientKey(ClientKey clientKey)
 {
     if (clientKey.ClientId != null)
     {
         this[OAuthParameter.ClientId] = clientKey.ClientId;
     }
 }
        private void AddClientKey(ClientKey clientKey)
        {
            if (clientKey.ClientId != null)
            {
                this[OAuthParameter.ClientId] = clientKey.ClientId;
            }

            if (clientKey.Credential != null)
            {
                if (clientKey.Credential.ClientSecret != null)
                {
                    this[OAuthParameter.ClientSecret] = clientKey.Credential.ClientSecret;
                }
                else
                {
                    this.AddSecureParameter(OAuthParameter.ClientSecret, clientKey.Credential.SecureClientSecret);
                }
            }
            else if (clientKey.Assertion != null)
            {
                this[OAuthParameter.ClientAssertionType] = clientKey.Assertion.AssertionType;
                this[OAuthParameter.ClientAssertion] = clientKey.Assertion.Assertion;
            }
            else if (clientKey.Certificate != null)
            {
                JsonWebToken jwtToken = new JsonWebToken(clientKey.Certificate, clientKey.Authenticator.SelfSignedJwtAudience);
                ClientAssertion clientAssertion = jwtToken.Sign(clientKey.Certificate);
                this[OAuthParameter.ClientAssertionType] = clientAssertion.AssertionType;
                this[OAuthParameter.ClientAssertion] = clientAssertion.Assertion;
            }
        }
        protected AcquireTokenHandlerBase(Authenticator authenticator, TokenCache tokenCache, string[] scope,
            ClientKey clientKey, TokenSubjectType subjectType)
        {
            this.Authenticator = authenticator;
            this.CallState = CreateCallState(this.Authenticator.CorrelationId);
            PlatformPlugin.Logger.Information(this.CallState,
                string.Format(
                    "=== accessToken Acquisition started:\n\tAuthority: {0}\n\tResource: {1}\n\tClientId: {2}\n\tCacheType: {3}\n\tAuthentication Target: {4}\n\t",
                    authenticator.Authority, scope, clientKey.ClientId,
                    (tokenCache != null)
                        ? tokenCache.GetType().FullName + string.Format(" ({0} items)", tokenCache.Count)
                        : "null",
                    subjectType));

            this.tokenCache = tokenCache;
            this.ClientKey = clientKey;
            this.TokenSubjectType = subjectType;

            this.LoadFromCache = (tokenCache != null);
            this.StoreToCache = (tokenCache != null);
            this.SupportADFS = false;
            if (ADALScopeHelper.IsNullOrEmpty(scope))
            {
                throw new ArgumentNullException("scope");
            }

            this.Scope = scope;
            ValidateScopeInput(scope);
        }
示例#7
0
 public AcquireDeviceCodeHandler(Authenticator authenticator, string resource, string clientId, string extraQueryParameters)
 {
     this.authenticator        = authenticator;
     this.callState            = AcquireTokenHandlerBase.CreateCallState(this.authenticator.CorrelationId);
     this.clientKey            = new ClientKey(clientId);
     this.resource             = resource;
     this.extraQueryParameters = extraQueryParameters;
 }
        public RequestParameters(string resource, ClientKey clientKey)
        {
            if (!string.IsNullOrWhiteSpace(resource))
            {
                this[OAuthParameter.Resource] = resource;
            }

            this.AddClientKey(clientKey);
        }
示例#9
0
        public DictionaryRequestParameters(string resource, ClientKey clientKey)
        {
            if (!string.IsNullOrWhiteSpace(resource))
            {
                this[OAuthParameter.Resource] = resource;
            }

            clientKey.AddToParameters(this);
        }
        public AcquireTokenOnBehalfHandler(Authenticator authenticator, TokenCache tokenCache, string resource, ClientKey clientKey, UserAssertion userAssertion)
            : base(authenticator, tokenCache, resource, clientKey, TokenSubjectType.UserPlusClient)
        {
            if (userAssertion == null)
            {
                throw new ArgumentNullException("userAssertion");
            }

            this.userAssertion = userAssertion;
            this.DisplayableId = userAssertion.UserName;

            this.SupportADFS = true;
        }
        public AcquireTokenOnBehalfHandler(Authenticator authenticator, TokenCache tokenCache, string resource, ClientKey clientKey, UserAssertion userAssertion, bool callSync)
            : base(authenticator, tokenCache, resource, clientKey, TokenSubjectType.UserPlusClient, callSync)
        {
            if (userAssertion == null)
            {
                throw new ArgumentNullException("userAssertion");
            }

            this.userAssertion = userAssertion;
            this.DisplayableId = userAssertion.UserName;
            this.assertionHash = PlatformSpecificHelper.CreateSha256Hash(userAssertion.Assertion);

            this.SupportADFS = true;
        }
        public AcquireTokenSilentHandler(Authenticator authenticator, TokenCache tokenCache, string resource, ClientKey clientKey, UserIdentifier userId, bool callSync)
            : base(authenticator, tokenCache, resource, clientKey, clientKey.HasCredential ? TokenSubjectType.UserPlusClient : TokenSubjectType.User, callSync)
        {
            if (userId == null)
            {
                throw new ArgumentNullException("userId", AdalErrorMessage.SpecifyAnyUser);
            }

            this.UniqueId = userId.UniqueId;
            this.DisplayableId = userId.DisplayableId;
            this.UserIdentifierType = userId.Type;

            this.SupportADFS = true;
        }
        public AcquireTokenByAuthorizationCodeHandler(Authenticator authenticator, TokenCache tokenCache, string[] scope, ClientKey clientKey, string authorizationCode, Uri redirectUri, string extraQueryParameters)
            : base(authenticator, tokenCache, scope, clientKey, TokenSubjectType.UserPlusClient)
        {
            if (string.IsNullOrWhiteSpace(authorizationCode))
            {
                throw new ArgumentNullException("authorizationCode");
            }

            this.authorizationCode = authorizationCode;
            if (redirectUri == null)
            {
                throw new ArgumentNullException("redirectUri");
            }

            this.redirectUri = redirectUri;
            this.LoadFromCache = false;
            this.SupportADFS = false;
            this.extraQueryParameters = extraQueryParameters;
        }
        public AcquireTokenByRefreshTokenHandler(Authenticator authenticator, TokenCache tokenCache, string resource, ClientKey clientKey, string refreshToken, bool callSync)
            : base(authenticator, tokenCache, resource ?? NullResource, clientKey, TokenSubjectType.UserPlusClient, callSync)
        {
            if (string.IsNullOrWhiteSpace(refreshToken))
            {
                throw new ArgumentNullException("refreshToken");
            }

            if (!string.IsNullOrWhiteSpace(resource) && this.Authenticator.AuthorityType != AuthorityType.AAD)
            {
                throw new ArgumentException(AdalErrorMessage.UnsupportedMultiRefreshToken, "resource");
            }

            this.refreshToken = refreshToken;
            this.LoadFromCache = false;
            this.StoreToCache = false;

            this.SupportADFS = true;
        }
示例#15
0
        protected AcquireTokenHandlerBase(Authenticator authenticator, TokenCache tokenCache, string resource,
                                          ClientKey clientKey, TokenSubjectType subjectType)
        {
            this.Authenticator = authenticator;
            this.CallState     = CreateCallState(this.Authenticator.CorrelationId);
            PlatformPlugin.Logger.Information(this.CallState,
                                              string.Format(CultureInfo.CurrentCulture, "=== Token Acquisition started:\n\tAuthority: {0}\n\tResource: {1}\n\tClientId: {2}\n\tCacheType: {3}\n\tAuthentication Target: {4}\n\t",
                                                            authenticator.Authority, resource, clientKey.ClientId,
                                                            (tokenCache != null) ? tokenCache.GetType().FullName + string.Format(CultureInfo.CurrentCulture, " ({0} items)", tokenCache.Count) : "null",
                                                            subjectType));

            this.tokenCache = tokenCache;

            if (string.IsNullOrWhiteSpace(resource))
            {
                throw new ArgumentNullException("resource");
            }

            this.Resource         = (resource != NullResource) ? resource : null;
            this.ClientKey        = clientKey;
            this.TokenSubjectType = subjectType;

            this.LoadFromCache = (tokenCache != null);
            this.StoreToCache  = (tokenCache != null);
            this.SupportADFS   = false;

            this.brokerParameters              = new Dictionary <string, string>();
            brokerParameters["authority"]      = authenticator.Authority;
            brokerParameters["resource"]       = resource;
            brokerParameters["client_id"]      = clientKey.ClientId;
            brokerParameters["correlation_id"] = this.CallState.CorrelationId.ToString();
            brokerParameters["client_version"] = AdalIdHelper.GetAdalVersion();
            this.ResultEx = null;

            CacheQueryData               = new CacheQueryData();
            CacheQueryData.Authority     = Authenticator.Authority;
            CacheQueryData.Resource      = this.Resource;
            CacheQueryData.ClientId      = this.ClientKey.ClientId;
            CacheQueryData.SubjectType   = this.TokenSubjectType;
            CacheQueryData.UniqueId      = this.UniqueId;
            CacheQueryData.DisplayableId = this.DisplayableId;
        }
        protected AcquireTokenHandlerBase(Authenticator authenticator, TokenCache tokenCache, string resource, ClientKey clientKey, TokenSubjectType subjectType, bool callSync)
        {
            this.Authenticator = authenticator;

            this.tokenCache = tokenCache;

            if (string.IsNullOrWhiteSpace(resource))
            {
                throw new ArgumentNullException("resource");
            }

            this.Resource = (resource != NullResource) ? resource : null;
            this.ClientKey = clientKey;
            this.TokenSubjectType = subjectType;
            this.CallState = CreateCallState(this.Authenticator.CorrelationId, callSync);

            this.LoadFromCache = (tokenCache != null);
            this.StoreToCache = (tokenCache != null);
            this.SupportADFS = false;
        }
        public AcquireTokenByAuthorizationCodeHandler(Authenticator authenticator, TokenCache tokenCache, string resource, ClientKey clientKey, string authorizationCode, Uri redirectUri, bool callSync)
            : base(authenticator, tokenCache, resource ?? NullResource, clientKey, TokenSubjectType.UserPlusClient, callSync)
        {
            if (string.IsNullOrWhiteSpace(authorizationCode))
            {
                throw new ArgumentNullException("authorizationCode");
            }

            this.authorizationCode = authorizationCode;

            if (redirectUri == null)
            {
                throw new ArgumentNullException("redirectUri");
            }

            this.redirectUri = redirectUri;

            this.LoadFromCache = false;

            this.SupportADFS = true;
        }
 public AcquireTokenForClientHandler(Authenticator authenticator, TokenCache tokenCache, string resource, ClientKey clientKey, bool callSync)
     : base(authenticator, tokenCache, resource, clientKey, TokenSubjectType.Client, callSync)
 {
     this.SupportADFS = true;
 }
 private async Task<AuthenticationResult> AcquireTokenOnBehalfCommonAsync(string resource, ClientKey clientKey, UserAssertion userAssertion)
 {
     var handler = new AcquireTokenOnBehalfHandler(this.Authenticator, this.TokenCache, resource, clientKey, userAssertion);
     return await handler.RunAsync();
 }
        protected AcquireTokenHandlerBase(Authenticator authenticator, TokenCache tokenCache, string resource, ClientKey clientKey, TokenSubjectType subjectType, bool callSync)
        {
            this.Authenticator = authenticator;
            this.CallState     = CreateCallState(this.Authenticator.CorrelationId, callSync);
            PlatformPlugin.Logger.Information(this.CallState, "=== Token Acquisition started");

            this.tokenCache = tokenCache;

            if (string.IsNullOrWhiteSpace(resource))
            {
                throw new ArgumentNullException("resource");
            }

            this.Resource         = (resource != NullResource) ? resource : null;
            this.ClientKey        = clientKey;
            this.TokenSubjectType = subjectType;

            this.LoadFromCache = (tokenCache != null);
            this.StoreToCache  = (tokenCache != null);
            this.SupportADFS   = false;
        }
 private async Task<AuthenticationResult> AcquireTokenSilentCommonAsync(string resource, ClientKey clientKey, UserIdentifier userId, bool callSync = false)
 {
     var handler = new AcquireTokenSilentHandler(this.Authenticator, this.TokenCache, resource, clientKey, userId, callSync);
     return await handler.RunAsync();
 }
示例#22
0
        protected AcquireTokenHandlerBase(Authenticator authenticator, TokenCache tokenCache, string resource, ClientKey clientKey, TokenSubjectType subjectType, bool callSync)
        {
            this.Authenticator = authenticator;
            this.CallState     = CreateCallState(this.Authenticator.CorrelationId, callSync);
            Logger.Information(this.CallState,
                               string.Format("=== Token Acquisition started:\n\tAuthority: {0}\n\tResource: {1}\n\tClientId: {2}\n\tCacheType: {3}\n\tAuthentication Target: {4}\n\t",
                                             authenticator.Authority, resource, clientKey.ClientId,
                                             (tokenCache != null) ? tokenCache.GetType().FullName + string.Format(" ({0} items)", tokenCache.Count) : "null",
                                             subjectType));

            this.tokenCache = tokenCache;

            if (string.IsNullOrWhiteSpace(resource))
            {
                var ex = new ArgumentNullException("resource");
                Logger.Error(this.CallState, ex);
                throw ex;
            }

            this.Resource         = (resource != NullResource) ? resource : null;
            this.ClientKey        = clientKey;
            this.TokenSubjectType = subjectType;

            this.LoadFromCache = (tokenCache != null);
            this.StoreToCache  = (tokenCache != null);
            this.SupportADFS   = false;
        }
        private async Task <AuthenticationResult> AcquireTokenByRefreshTokenCommonAsync(string refreshToken, ClientKey clientKey, string resource, bool callSync = false)
        {
            var handler = new AcquireTokenByRefreshTokenHandler(this.Authenticator, this.TokenCache, resource, clientKey, refreshToken, callSync);

            return(await handler.RunAsync());
        }
        private async Task <AuthenticationResult> AcquireTokenByAuthorizationCodeCommonAsync(string authorizationCode, Uri redirectUri, ClientKey clientKey, string resource, bool callSync = false)
        {
            var handler = new AcquireTokenByAuthorizationCodeHandler(this.Authenticator, this.TokenCache, resource, clientKey, authorizationCode, redirectUri, callSync);

            return(await handler.RunAsync());
        }
        private async Task <AuthenticationResult> AcquireTokenForClientCommonAsync(string resource, ClientKey clientKey)
        {
            var handler = new AcquireTokenForClientHandler(this.Authenticator, this.TokenCache, resource, clientKey);

            return(await handler.RunAsync());
        }
示例#26
0
        public AcquireTokenSilentHandler(Authenticator authenticator, TokenCache tokenCache, string resource, ClientKey clientKey, UserIdentifier userId, bool callSync)
            : base(authenticator, tokenCache, resource, clientKey, clientKey.HasCredential ? TokenSubjectType.UserPlusClient : TokenSubjectType.User, callSync)
        {
            if (userId == null)
            {
                throw new ArgumentNullException("userId", AdalErrorMessage.SpecifyAnyUser);
            }

            this.UniqueId           = userId.UniqueId;
            this.DisplayableId      = userId.DisplayableId;
            this.UserIdentifierType = userId.Type;

            this.SupportADFS = true;
        }
示例#27
0
        public AcquireTokenOnBehalfHandler(Authenticator authenticator, TokenCache tokenCache, string resource, ClientKey clientKey, UserAssertion userAssertion, bool callSync)
            : base(authenticator, tokenCache, resource, clientKey, TokenSubjectType.UserPlusClient, callSync)
        {
            if (userAssertion == null)
            {
                throw new ArgumentNullException("userAssertion");
            }

            this.userAssertion = userAssertion;
            this.DisplayableId = userAssertion.UserName;

            this.SupportADFS = true;
        }
示例#28
0
        public AcquireTokenByRefreshTokenHandler(Authenticator authenticator, TokenCache tokenCache, string resource, ClientKey clientKey, string refreshToken, bool callSync)
            : base(authenticator, tokenCache, resource ?? NullResource, clientKey, TokenSubjectType.UserPlusClient, callSync)
        {
            if (string.IsNullOrWhiteSpace(refreshToken))
            {
                throw new ArgumentNullException("refreshToken");
            }

            if (!string.IsNullOrWhiteSpace(resource) && this.Authenticator.AuthorityType != AuthorityType.AAD)
            {
                var ex = new ArgumentException(AdalErrorMessage.UnsupportedMultiRefreshToken, "resource");
                Logger.LogException(this.CallState, ex);
                throw ex;
            }

            this.refreshToken  = refreshToken;
            this.LoadFromCache = false;
            this.StoreToCache  = false;

            this.SupportADFS = true;
        }
 private async Task<AuthenticationResult> AcquireTokenSilentCommonAsync(string[] scope, ClientKey clientKey,
     UserIdentifier userId)
 {
     var handler = new AcquireTokenSilentHandler(this.Authenticator, this.TokenCache, scope, clientKey, userId);
     return await handler.RunAsync();
 }
 private async Task<AuthenticationResult> AcquireTokenByAuthorizationCodeCommonAsync(string authorizationCode,
     Uri redirectUri, ClientKey clientKey, string[] scope, string extraQueryParameters = null)
 {
     var handler = new AcquireTokenByAuthorizationCodeHandler(this.Authenticator, this.TokenCache, scope,
         clientKey, authorizationCode, redirectUri, extraQueryParameters);
     return await handler.RunAsync();
 }
        public AcquireTokenSilentHandler(Authenticator authenticator, TokenCache tokenCache, string resource, ClientKey clientKey, UserIdentifier userId, IPlatformParameters parameters)
            : base(authenticator, tokenCache, resource, clientKey, clientKey.HasCredential ? TokenSubjectType.UserPlusClient : TokenSubjectType.User)
        {
            if (userId == null)
            {
                throw new ArgumentNullException("userId", AdalErrorMessage.SpecifyAnyUser);
            }

            this.UniqueId           = userId.UniqueId;
            this.DisplayableId      = userId.DisplayableId;
            this.UserIdentifierType = userId.Type;
            PlatformPlugin.BrokerHelper.PlatformParameters = parameters;
            this.SupportADFS = true;

            this.brokerParameters["username"]           = userId.Id;
            this.brokerParameters["username_type"]      = userId.Type.ToString();
            this.brokerParameters["silent_broker_flow"] = null; //add key
        }
 private async Task<AuthenticationResult> AcquireTokenByRefreshTokenCommonAsync(string refreshToken, ClientKey clientKey, string resource, bool callSync = false)
 {
     var handler = new AcquireTokenByRefreshTokenHandler(this.Authenticator, this.TokenCache, resource, clientKey, refreshToken, callSync);
     return await handler.RunAsync();
 }
 private async Task<AuthenticationResult> AcquireTokenByAuthorizationCodeCommonAsync(string authorizationCode, Uri redirectUri, ClientKey clientKey, string resource)
 {
     var handler = new AcquireTokenByAuthorizationCodeHandler(this.Authenticator, this.TokenCache, resource, clientKey, authorizationCode, redirectUri);
     return await handler.RunAsync();
 }
 private async Task<AuthenticationResult> AcquireTokenForClientCommonAsync(string resource, ClientKey clientKey)
 {
     var handler = new AcquireTokenForClientHandler(this.Authenticator, this.TokenCache, resource, clientKey);
     return await handler.RunAsync();
 }
        private async Task <AuthenticationResult> AcquireTokenWithClaimsCommonAsync(string resource, ClientKey clientKey, Uri redirectUri, IPlatformParameters parameters,
                                                                                    UserIdentifier userId, string extraQueryParameters, IWebUI webUI, string claims)
        {
            RequestData requestData = new RequestData
            {
                Authenticator           = this.Authenticator,
                TokenCache              = this.TokenCache,
                Resource                = resource,
                ClientKey               = clientKey,
                ExtendedLifeTimeEnabled = this.ExtendedLifeTimeEnabled
            };

            var handler = new AcquireTokenInteractiveHandler(requestData, redirectUri, parameters, userId, extraQueryParameters, webUI, claims);

            return(await handler.RunAsync().ConfigureAwait(false));
        }
        public AcquireTokenOnBehalfHandler(Authenticator authenticator, TokenCache tokenCache, string resource, ClientKey clientKey, UserAssertion userAssertion)
            : base(authenticator, tokenCache, resource, clientKey, TokenSubjectType.UserPlusClient)
        {
            if (userAssertion == null)
            {
                throw new ArgumentNullException("userAssertion");
            }

            this.userAssertion           = userAssertion;
            this.DisplayableId           = userAssertion.UserName;
            CacheQueryData.AssertionHash = PlatformPlugin.CryptographyHelper.CreateSha256Hash(userAssertion.Assertion);

            this.SupportADFS = true;
        }
        private async Task <AuthenticationResult> AcquireTokenByAuthorizationCodeCommonAsync(string authorizationCode, Uri redirectUri, ClientKey clientKey, string resource)
        {
            const string nullResource = "null_resource_as_optional";
            RequestData  requestData  = new RequestData
            {
                Authenticator           = this.Authenticator,
                TokenCache              = this.TokenCache,
                Resource                = resource,
                ClientKey               = clientKey,
                ExtendedLifeTimeEnabled = this.ExtendedLifeTimeEnabled
            };

            if (requestData.Resource == null)
            {
                requestData.Resource = nullResource;
            }
            var handler = new AcquireTokenByAuthorizationCodeHandler(requestData, authorizationCode, redirectUri);

            return(await handler.RunAsync().ConfigureAwait(false));
        }
示例#38
0
        public AcquireTokenByAuthorizationCodeHandler(Authenticator authenticator, TokenCache tokenCache, string resource, ClientKey clientKey, string authorizationCode, Uri redirectUri)
            : base(authenticator, tokenCache, resource ?? NullResource, clientKey, TokenSubjectType.UserPlusClient)
        {
            if (string.IsNullOrWhiteSpace(authorizationCode))
            {
                throw new ArgumentNullException("authorizationCode");
            }

            this.authorizationCode = authorizationCode;

            if (redirectUri == null)
            {
                throw new ArgumentNullException("redirectUri");
            }

            this.redirectUri = redirectUri;

            this.LoadFromCache = false;

            this.SupportADFS = true;
        }
        private async Task <AuthenticationResult> AcquireTokenForClientCommonAsync(string resource, ClientKey clientKey)
        {
            RequestData requestData = new RequestData
            {
                Authenticator           = this.Authenticator,
                TokenCache              = this.TokenCache,
                Resource                = resource,
                ClientKey               = clientKey,
                ExtendedLifeTimeEnabled = this.ExtendedLifeTimeEnabled,
                SubjectType             = TokenSubjectType.Client
            };
            var handler = new AcquireTokenForClientHandler(requestData);

            return(await handler.RunAsync().ConfigureAwait(false));
        }
        private async Task <AuthenticationResult> AcquireTokenSilentCommonAsync(string resource, ClientKey clientKey, UserIdentifier userId, IPlatformParameters parameters)
        {
            var handler = new AcquireTokenSilentHandler(this.Authenticator, this.TokenCache, resource, clientKey, userId, parameters);

            return(await handler.RunAsync());
        }
        private async Task <AuthenticationResult> AcquireTokenOnBehalfCommonAsync(string resource, ClientKey clientKey, UserAssertion userAssertion)
        {
            RequestData requestData = new RequestData
            {
                Authenticator           = this.Authenticator,
                TokenCache              = this.TokenCache,
                Resource                = resource,
                ClientKey               = clientKey,
                ExtendedLifeTimeEnabled = this.ExtendedLifeTimeEnabled
            };

            var handler = new AcquireTokenOnBehalfHandler(requestData, userAssertion);

            return(await handler.RunAsync().ConfigureAwait(false));
        }
        private async Task <AuthenticationResult> AcquireTokenOnBehalfCommonAsync(string resource, ClientKey clientKey, UserAssertion userAssertion, bool callSync = false)
        {
            var handler = new AcquireTokenOnBehalfHandler(this.Authenticator, this.TokenCache, resource, clientKey, userAssertion, callSync);

            return(await handler.RunAsync());
        }
        private async Task <AuthenticationResult> AcquireTokenSilentCommonAsync(string resource, ClientKey clientKey, UserIdentifier userId, IPlatformParameters parameters)
        {
            RequestData requestData = new RequestData
            {
                Authenticator           = Authenticator,
                TokenCache              = this.TokenCache,
                Resource                = resource,
                ExtendedLifeTimeEnabled = this.ExtendedLifeTimeEnabled,
                ClientKey               = clientKey
            };

            var handler = new AcquireTokenSilentHandler(requestData, userId, parameters);

            return(await handler.RunAsync().ConfigureAwait(false));
        }
        private async Task <AuthenticationResult> AcquireTokenSilentCommonAsync(string resource, ClientKey clientKey, UserIdentifier userId, bool callSync = false)
        {
            var handler = new AcquireTokenSilentHandler(this.Authenticator, this.TokenCache, resource, clientKey, userId, callSync);

            return(await handler.RunAsync());
        }
示例#45
0
 public AcquireTokenForClientHandler(Authenticator authenticator, TokenCache tokenCache, string resource, ClientKey clientKey, bool callSync)
     : base(authenticator, tokenCache, resource, clientKey, TokenSubjectType.Client, callSync)
 {
     this.SupportADFS = true;
 }