public MsalConfidentialClient(
     CredentialPipeline pipeline,
     string tenantId,
     string clientId,
     ClientCertificateCredential.IX509Certificate2Provider certificateProvider,
     bool includeX5CClaimHeader,
     ITokenCacheOptions cacheOptions)
     : base(pipeline, tenantId, clientId, cacheOptions)
 {
     _includeX5CClaimHeader = includeX5CClaimHeader;
     _certificateProvider   = certificateProvider;
 }
Ejemplo n.º 2
0
        protected MsalClientBase(CredentialPipeline pipeline, string tenantId, string clientId, TokenCredentialOptions options)
        {
            // This validation is performed as a backstop. Validation in TokenCredentialOptions.AuthorityHost prevents users from explicitly
            // setting AuthorityHost to a non TLS endpoint. However, the AuthorityHost can also be set by the AZURE_AUTHORITY_HOST environment
            // variable rather than in code. In this case we need to validate the endpoint before we use it. However, we can't validate in
            // CredentialPipeline as this is also used by the ManagedIdentityCredential which allows non TLS endpoints. For this reason
            // we validate here as all other credentials will create an MSAL client.
            Validations.ValidateAuthorityHost(pipeline.AuthorityHost);
            ITokenCacheOptions cacheOptions = options as ITokenCacheOptions;

            IsPiiLoggingEnabled = options?.IsLoggingPIIEnabled ?? false;
            Pipeline            = pipeline;
            TenantId            = tenantId;
            ClientId            = clientId;
            TokenCache          = cacheOptions?.TokenCachePersistenceOptions == null ? null : new TokenCache(cacheOptions?.TokenCachePersistenceOptions);
            _clientAsyncLock    = new AsyncLockWithValue <TClient>();
        }
 public MsalConfidentialClient(CredentialPipeline pipeline, string tenantId, string clientId, Func <string> assertionCallback, ITokenCacheOptions cacheOptions, RegionalAuthority?regionalAuthority, bool isPiiLoggingEnabled)
     : base(pipeline, tenantId, clientId, isPiiLoggingEnabled, cacheOptions)
 {
     _assertionCallback = assertionCallback;
     RegionalAuthority  = regionalAuthority;
 }
 public MsalConfidentialClient(CredentialPipeline pipeline, string tenantId, string clientId, IX509Certificate2Provider certificateProvider, bool includeX5CClaimHeader, ITokenCacheOptions cacheOptions, RegionalAuthority?regionalAuthority, bool isPiiLoggingEnabled)
     : base(pipeline, tenantId, clientId, isPiiLoggingEnabled, cacheOptions)
 {
     _includeX5CClaimHeader = includeX5CClaimHeader;
     _certificateProvider   = certificateProvider;
     RegionalAuthority      = regionalAuthority;
 }
 public MsalConfidentialClient(CredentialPipeline pipeline, string tenantId, string clientId, string clientSecret, string redirectUrl, ITokenCacheOptions cacheOptions, RegionalAuthority?regionalAuthority, bool isPiiLoggingEnabled)
     : base(pipeline, tenantId, clientId, isPiiLoggingEnabled, cacheOptions)
 {
     _clientSecret     = clientSecret;
     RedirectUrl       = redirectUrl;
     RegionalAuthority = regionalAuthority;
 }
Ejemplo n.º 6
0
 public MsalPublicClient(CredentialPipeline pipeline, string tenantId, string clientId, string redirectUrl, ITokenCacheOptions cacheOptions, bool isPiiLoggingEnabled, Action <PublicClientApplicationBuilder> beforeBuildClient = null)
     : base(pipeline, tenantId, clientId, isPiiLoggingEnabled, cacheOptions)
 {
     RedirectUrl        = redirectUrl;
     _beforeBuildClient = beforeBuildClient;
 }
Ejemplo n.º 7
0
 public MsalPublicClient CreateMsalPublicClient(string clientId, string tenantId = default, string redirectUrl = default, ITokenCacheOptions cacheOptions = default)
 {
     return(new MsalPublicClient(HttpPipeline, AuthorityHost, clientId, tenantId, redirectUrl, cacheOptions));
 }
Ejemplo n.º 8
0
 public MsalPublicClient(CredentialPipeline pipeline, string tenantId, string clientId, string redirectUrl, ITokenCacheOptions cacheOptions, bool isPiiLoggingEnabled)
     : base(pipeline, tenantId, clientId, isPiiLoggingEnabled, cacheOptions)
 {
     RedirectUrl = redirectUrl;
 }
Ejemplo n.º 9
0
 public MsalConfidentialClient(CredentialPipeline pipeline, string tenantId, string clientId, string clientSecret, ITokenCacheOptions cacheOptions, RegionalAuthority?regionalAuthority, bool logPii)
     : base(pipeline, tenantId, clientId, cacheOptions)
 {
     _clientSecret     = clientSecret;
     RegionalAuthority = regionalAuthority;
     LogPII            = logPii;
 }
Ejemplo n.º 10
0
        protected MsalClientBase(CredentialPipeline pipeline, string tenantId, string clientId, ITokenCacheOptions cacheOptions)
        {
            Pipeline = pipeline;

            TenantId = tenantId;

            ClientId = clientId;

            EnablePersistentCache = cacheOptions?.EnablePersistentCache ?? false;

            AllowUnencryptedCache = cacheOptions?.AllowUnencryptedCache ?? false;

            _clientAsyncLock = new AsyncLockWithValue <TClient>();
        }
 public MsalConfidentialClient(CredentialPipeline pipeline, string tenantId, string clientId, string clientSecret, ITokenCacheOptions cacheOptions)
     : base(pipeline, tenantId, clientId, cacheOptions)
 {
     _clientSecret = clientSecret;
 }
Ejemplo n.º 12
0
 public MockMsalClient(CredentialPipeline pipeline, string tenantId, string clientId, bool isPiiLoggingEnabled, ITokenCacheOptions cacheOptions)
     : base(pipeline, tenantId, clientId, isPiiLoggingEnabled, cacheOptions)
 {
 }
Ejemplo n.º 13
0
        public MsalPublicClient(HttpPipeline pipeline, Uri authorityHost, string clientId, string tenantId = default, string redirectUrl = default, ITokenCacheOptions cacheOptions = default)
        {
            tenantId ??= Constants.OrganizationsTenantId;

            var authorityUri = new UriBuilder(authorityHost.Scheme, authorityHost.Host, authorityHost.Port, tenantId).Uri;

            PublicClientApplicationBuilder pubAppBuilder = PublicClientApplicationBuilder.Create(clientId).WithAuthority(authorityUri).WithHttpClientFactory(new HttpPipelineClientFactory(pipeline));

            pubAppBuilder = pubAppBuilder.WithTenantId(tenantId);

            if (!string.IsNullOrEmpty(redirectUrl))
            {
                pubAppBuilder = pubAppBuilder.WithRedirectUri(redirectUrl);
            }

            _client = pubAppBuilder.Build();

            _clientId = clientId;

            _ensureInitAsync = new Lazy <Task>(InitializeAsync);

            _attachSharedCache = cacheOptions?.EnablePersistentCache ?? false;
        }
Ejemplo n.º 14
0
 public MsalConfidentialClient(CredentialPipeline pipeline, string tenantId, string clientId, string clientAssertion, ITokenCacheOptions cacheOptions)
     : base(pipeline, tenantId, clientId, cacheOptions)
 {
     this.clientAssertion = clientAssertion;
 }
Ejemplo n.º 15
0
        protected MsalClientBase(CredentialPipeline pipeline, string tenantId, string clientId, ITokenCacheOptions cacheOptions)
        {
            Pipeline = pipeline;

            TenantId = tenantId;

            ClientId = clientId;

            EnablePersistentCache = cacheOptions?.EnablePersistentCache ?? false;

            AllowUnencryptedCache = cacheOptions?.AllowUnencryptedCache ?? false;

            _ensureInitAsync = new Lazy <Task>(InitializeAsync);
        }
Ejemplo n.º 16
0
 public MsalPublicClient(CredentialPipeline pipeline, string tenantId, string clientId, string redirectUrl, ITokenCacheOptions cacheOptions)
     : base(pipeline, tenantId, clientId, cacheOptions)
 {
     RedirectUrl = redirectUrl;
 }
Ejemplo n.º 17
0
 public MsalConfidentialClient(CredentialPipeline pipeline, string tenantId, string clientId, ClientCertificateCredential.IX509Certificate2Provider certificateProvider, bool includeX5CClaimHeader, ITokenCacheOptions cacheOptions, RegionalAuthority?regionalAuthority, bool logPii)
     : base(pipeline, tenantId, clientId, cacheOptions)
 {
     _includeX5CClaimHeader = includeX5CClaimHeader;
     _certificateProvider   = certificateProvider;
     RegionalAuthority      = regionalAuthority;
     LogPII = logPii;
 }