private void Initialize(OAuthConfiguration configurationOAuth, HttpClient customHttpClient) { if (customHttpClient != null) { var httpClientFactory = new ConstantHttpClientFactory(customHttpClient); this.authContext = new AuthenticationContext(configurationOAuth.Authority, configurationOAuth.ValidateAuthority, new TokenCache(), httpClientFactory); } else { this.authContext = new AuthenticationContext(configurationOAuth.Authority, configurationOAuth.ValidateAuthority); } }
public AdalAuthenticator(ClientCredential clientCredential, OAuthConfiguration configurationOAuth, HttpClient customHttpClient = null) { this._oAuthConfig = configurationOAuth ?? throw new ArgumentNullException(nameof(configurationOAuth)); this.clientCredential = clientCredential ?? throw new ArgumentNullException(nameof(clientCredential)); if (customHttpClient != null) { var httpClientFactory = new ConstantHttpClientFactory(customHttpClient); this.authContext = new AuthenticationContext(configurationOAuth.Authority, true, new TokenCache(), httpClientFactory); } else { this.authContext = new AuthenticationContext(configurationOAuth.Authority); } }