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 DictionaryRequestParameters(string resource, ClientKey clientKey) { if (!string.IsNullOrWhiteSpace(resource)) { this[OAuthParameter.Resource] = resource; } clientKey.AddToParameters(this); }
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; }
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> 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) { var handler = new AcquireTokenOnBehalfHandler(this.Authenticator, this.TokenCache, resource, clientKey, userAssertion); 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> 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()); }
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.CacheQueryData.DisplayableId = this.DisplayableId; this.CacheQueryData.UniqueId = this.UniqueId; this.brokerParameters["username"] = userId.Id; this.brokerParameters["username_type"] = userId.Type.ToString(); this.brokerParameters["silent_broker_flow"] = null; //add key }
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; }