/// <summary> /// Initializes a new instance of the <see cref="AdalAuthenticator"/> class. /// </summary> /// <param name="clientCredential">The client credential to use for token acquisition.</param> /// <param name="configurationOAuth">A configuration object for OAuth client credential authentication.</param> /// <param name="customHttpClient">A customized instance of the HttpClient class.</param> /// <param name="logger">The type used to perform logging.</param> public AdalAuthenticator(ClientCredential clientCredential, OAuthConfiguration configurationOAuth, HttpClient customHttpClient = null, ILogger logger = null) { this.authConfig = configurationOAuth ?? throw new ArgumentNullException(nameof(configurationOAuth)); this.clientCredential = clientCredential ?? throw new ArgumentNullException(nameof(clientCredential)); this.logger = logger; Initialize(configurationOAuth, customHttpClient); }
/// <summary> /// Initializes a new instance of the <see cref="AdalAuthenticator"/> class. /// </summary> /// <param name="clientCertificate">A client credential that includes a X509Certificate.</param> /// <param name="sendX5c">Enables easy certificates roll-over in Azure AD. Setting it to true sends the public certficate to Azure AD along with token requests.</param> /// <param name="configurationOAuth">A configuration object for OAuth client credential authentication.</param> /// <param name="customHttpClient">A customized instance of the HttpClient class.</param> /// <param name="logger">The type used to perform logging.</param> public AdalAuthenticator(ClientAssertionCertificate clientCertificate, bool sendX5c, OAuthConfiguration configurationOAuth, HttpClient customHttpClient = null, ILogger logger = null) { this.authConfig = configurationOAuth ?? throw new ArgumentNullException(nameof(configurationOAuth)); this.clientCertificate = clientCertificate ?? throw new ArgumentNullException(nameof(clientCertificate)); this.logger = logger; this.clientCertSendX5c = sendX5c; Initialize(configurationOAuth, customHttpClient); }
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 oAuthConfig, HttpClient customHttpClient = null) { this.oAuthConfig = oAuthConfig ?? throw new ArgumentNullException(nameof(oAuthConfig)); this.clientCredential = clientCredential ?? throw new ArgumentNullException(nameof(clientCredential)); if (customHttpClient != null) { this.authContext = new AuthenticationContext(oAuthConfig.Authority, true, new TokenCache(), customHttpClient); } else { this.authContext = new AuthenticationContext(oAuthConfig.Authority); } }
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); } }
/// <summary> /// Initializes a new instance of the <see cref="AdalAuthenticator"/> class. /// </summary> /// <param name="clientCertificate">A client credential that includes a X509Certificate.</param> /// <param name="configurationOAuth">A configuration object for OAuth client credential authentication.</param> /// <param name="customHttpClient">A customized instance of the HttpClient class.</param> /// <param name="logger">The type used to perform logging.</param> public AdalAuthenticator(ClientAssertionCertificate clientCertificate, OAuthConfiguration configurationOAuth, HttpClient customHttpClient = null, ILogger logger = null) : this(clientCertificate, false, configurationOAuth, customHttpClient, logger) { }
/// <summary> /// Initializes a new instance of the <see cref="AdalAuthenticator"/> class. /// </summary> /// <param name="clientCredential">The client credential to use for token acquisition.</param> /// <param name="configurationOAuth">A configuration object for OAuth client credential authentication.</param> /// <param name="customHttpClient">A customized instance of the HttpClient class.</param> public AdalAuthenticator(ClientCredential clientCredential, OAuthConfiguration configurationOAuth, HttpClient customHttpClient = null) : this(clientCredential, configurationOAuth, customHttpClient, null) { }