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; }
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; }
protected AcquireTokenHandlerBase(RequestData requestData) { this.Authenticator = requestData.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", requestData.Authenticator.Authority, requestData.Resource, requestData.ClientKey.ClientId, (tokenCache != null) ? tokenCache.GetType().FullName + string.Format(CultureInfo.CurrentCulture, " ({0} items)", tokenCache.Count) : "null", requestData.SubjectType)); this.tokenCache = requestData.TokenCache; if (string.IsNullOrWhiteSpace(requestData.Resource)) { throw new ArgumentNullException("resource"); } this.Resource = (requestData.Resource != NullResource) ? requestData.Resource : null; this.ClientKey = requestData.ClientKey; this.TokenSubjectType = requestData.SubjectType; this.LoadFromCache = (tokenCache != null); this.StoreToCache = (tokenCache != null); this.SupportADFS = false; this.brokerParameters = new Dictionary <string, string>(); brokerParameters["authority"] = requestData.Authenticator.Authority; brokerParameters["resource"] = requestData.Resource; brokerParameters["client_id"] = requestData.ClientKey.ClientId; brokerParameters["correlation_id"] = this.CallState.CorrelationId.ToString(); brokerParameters["client_version"] = AdalIdHelper.GetAdalVersion(); this.ResultEx = null; CacheQueryData.ExtendedLifeTimeEnabled = requestData.ExtendedLifeTimeEnabled; }
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); }
protected AcquireTokenHandlerBase(RequestData requestData) { this.Authenticator = requestData.Authenticator; this.CallState = CreateCallState(this.Authenticator.CorrelationId); brokerHelper.CallState = this.CallState; CallState.Logger.Information(null, string.Format(CultureInfo.CurrentCulture, "ADAL {0} with assembly version '{1}', file version '{2}' and informational version '{3}' is running...", platformInformation.GetProductName(), AdalIdHelper.GetAdalVersion(), AdalIdHelper.GetAssemblyFileVersion(), AdalIdHelper.GetAssemblyInformationalVersion())); CallState.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", requestData.Authenticator.Authority, requestData.Resource, requestData.ClientKey.ClientId, (tokenCache != null) ? tokenCache.GetType().FullName + string.Format(CultureInfo.CurrentCulture, " ({0} items)", tokenCache.Count) : "null", requestData.SubjectType)); this.tokenCache = requestData.TokenCache; if (string.IsNullOrWhiteSpace(requestData.Resource)) { throw new ArgumentNullException("resource"); } this.Resource = (requestData.Resource != NullResource) ? requestData.Resource : null; this.ClientKey = requestData.ClientKey; this.TokenSubjectType = requestData.SubjectType; this.LoadFromCache = (tokenCache != null); this.StoreToCache = (tokenCache != null); this.SupportADFS = false; this.brokerParameters = new Dictionary <string, string>(); brokerParameters[BrokerParameter.Authority] = requestData.Authenticator.Authority; brokerParameters[BrokerParameter.Resource] = requestData.Resource; brokerParameters[BrokerParameter.ClientId] = requestData.ClientKey.ClientId; brokerParameters[BrokerParameter.CorrelationId] = this.CallState.CorrelationId.ToString(); brokerParameters[BrokerParameter.ClientVersion] = AdalIdHelper.GetAdalVersion(); this.ResultEx = null; CacheQueryData.ExtendedLifeTimeEnabled = requestData.ExtendedLifeTimeEnabled; }