Esempio n. 1
0
        internal AuthorizationCodeCredential(string tenantId, string clientId, string clientSecret, string authorizationCode, TokenCredentialOptions options, MsalConfidentialClient client, CredentialPipeline pipeline = null)
        {
            Validations.ValidateTenantId(tenantId, nameof(tenantId));
            _tenantId = tenantId;
            Argument.AssertNotNull(clientSecret, nameof(clientSecret));
            Argument.AssertNotNull(clientId, nameof(clientId));
            Argument.AssertNotNull(authorizationCode, nameof(authorizationCode));
            _clientId    = clientId;
            _authCode    = authorizationCode;
            _pipeline    = pipeline ?? CredentialPipeline.GetInstance(options ?? new TokenCredentialOptions());
            _redirectUri = options switch
            {
                AuthorizationCodeCredentialOptions o => o.RedirectUri?.AbsoluteUri,
                                                   _ => null
            };

            _client = client ??
                      new MsalConfidentialClient(
                _pipeline,
                tenantId,
                clientId,
                clientSecret,
                _redirectUri,
                options as ITokenCacheOptions,
                null,
                options?.IsLoggingPIIEnabled ?? false);
        }
 internal ClientCertificateCredential(
     string tenantId,
     string clientId,
     string certificatePath,
     TokenCredentialOptions options,
     CredentialPipeline pipeline,
     MsalConfidentialClient client)
     : this(
         tenantId,
         clientId,
 internal OnBehalfOfCredential(
     string tenantId,
     string clientId,
     X509Certificate2 certificate,
     string userAssertion,
     OnBehalfOfCredentialOptions options,
     CredentialPipeline pipeline,
     MsalConfidentialClient client)
     : this(
         tenantId,
         clientId,
        internal ClientSecretCredential(string tenantId, string clientId, string clientSecret, TokenCredentialOptions options, CredentialPipeline pipeline, MsalConfidentialClient client)
        {
            TenantId = tenantId ?? throw new ArgumentNullException(nameof(tenantId));

            ClientId = clientId ?? throw new ArgumentNullException(nameof(clientId));

            ClientSecret = clientSecret ?? throw new ArgumentNullException(nameof(clientSecret));

            _pipeline = pipeline ?? CredentialPipeline.GetInstance(options);

            _client = client ?? new MsalConfidentialClient(_pipeline, tenantId, clientId, clientSecret, options as ITokenCacheOptions);
        }
        internal AuthorizationCodeCredential(string tenantId, string clientId, string clientSecret, string authorizationCode, TokenCredentialOptions options, MsalConfidentialClient client)
        {
            Validations.ValidateTenantId(tenantId, nameof(tenantId));
            _tenantId = tenantId;
            Argument.AssertNotNull(clientSecret, nameof(clientSecret));
            Argument.AssertNotNull(clientId, nameof(clientId));
            Argument.AssertNotNull(authorizationCode, nameof(authorizationCode));
            _clientId = clientId;
            _authCode = authorizationCode;
            options ??= new TokenCredentialOptions();
            _pipeline    = CredentialPipeline.GetInstance(options);
            _redirectUri = options switch
            {
                AuthorizationCodeCredentialOptions o => o.RedirectUri?.ToString(),
                                                   _ => null
            };

            _client = client ?? new MsalConfidentialClient(_pipeline, tenantId, clientId, clientSecret, options as ITokenCacheOptions);
        }
 internal ClientCertificateCredential(string tenantId, string clientId, string certificatePath, TokenCredentialOptions options, CredentialPipeline pipeline, MsalConfidentialClient client)
     : this(tenantId, clientId, new X509Certificate2FromFileProvider(certificatePath ?? throw new ArgumentNullException(nameof(certificatePath))), options, pipeline, client)
Esempio n. 7
0
        internal ClientSecretCredential(string tenantId, string clientId, string clientSecret, TokenCredentialOptions options, CredentialPipeline pipeline, MsalConfidentialClient client)
        {
            Argument.AssertNotNull(clientId, nameof(clientId));
            Argument.AssertNotNull(clientSecret, nameof(clientSecret));
            TenantId = Validations.ValidateTenantId(tenantId, nameof(tenantId));
            ClientId = clientId ?? throw new ArgumentNullException(nameof(clientId));

            ClientSecret = clientSecret;
            _allowMultiTenantAuthentication = options?.AllowMultiTenantAuthentication ?? false;
            _pipeline = pipeline ?? CredentialPipeline.GetInstance(options);
            Client    = client ??
                        new MsalConfidentialClient(
                _pipeline,
                tenantId,
                clientId,
                clientSecret,
                options as ITokenCacheOptions,
                (options as ClientSecretCredentialOptions)?.RegionalAuthority,
                options?.IsLoggingPIIEnabled ?? false);
        }
Esempio n. 8
0
        internal ClientSecretCredential(string tenantId, string clientId, string clientSecret, TokenCredentialOptions options, CredentialPipeline pipeline, MsalConfidentialClient client)
        {
            Argument.AssertNotNull(clientId, nameof(clientId));
            Argument.AssertNotNull(clientSecret, nameof(clientSecret));
            TenantId = Validations.ValidateTenantId(tenantId, nameof(tenantId));
            ClientId = clientId ?? throw new ArgumentNullException(nameof(clientId));

            ClientSecret = clientSecret;
            _pipeline    = pipeline ?? CredentialPipeline.GetInstance(options);
            Client       = client ??
                           new MsalConfidentialClient(
                _pipeline,
                tenantId,
                clientId,
                clientSecret,
                null,
                options,
                (options as ClientSecretCredentialOptions)?.RegionalAuthority);
        }