コード例 #1
0
 /// <summary>
 /// Creates an instance of the ManagedIdentityCredential capable of authenticating a resource with a managed identity.
 /// </summary>
 /// <param name="clientId">
 /// The client id to authenticate for a user assigned managed identity.  More information on user assigned managed identities can be found here:
 /// https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/overview#how-a-user-assigned-managed-identity-works-with-an-azure-vm
 /// </param>
 /// <param name="options">Options to configure the management of the requests sent to the Azure Active Directory service.</param>
 public ManagedIdentityCredential(string clientId = null, TokenCredentialOptions options = null)
     : this(clientId, CredentialPipeline.GetInstance(options))
 {
 }
コード例 #2
0
 /// <summary>
 /// Creates a new <see cref="SharedTokenCacheCredential"/> which will authenticate users signed in through developer tools supporting Azure single sign on.
 /// </summary>
 public SharedTokenCacheCredential()
     : this(null, null, CredentialPipeline.GetInstance(null))
 {
 }
コード例 #3
0
 /// <summary>
 /// Creates a new <see cref="SharedTokenCacheCredential"/> which will authenticate users signed in through developer tools supporting Azure single sign on.
 /// </summary>
 /// <param name="username">The username of the user to authenticate</param>
 /// <param name="options">The client options for the newly created <see cref="SharedTokenCacheCredential"/></param>
 public SharedTokenCacheCredential(string username, TokenCredentialOptions options = default)
     : this(tenantId : null, username : username, pipeline : CredentialPipeline.GetInstance(options))
 {
 }
コード例 #4
0
 internal AzureCliCredential(CredentialPipeline pipeline)
     : this(pipeline, new AzureCliCredentialClient())
 {
 }
コード例 #5
0
 /// <summary>
 /// Creates an instance of the <see cref="DefaultAzureCredential"/> class.
 /// </summary>
 /// <param name="options">Options that configure the management of the requests sent to Azure Active Directory services, and determine which credentials are included in the <see cref="DefaultAzureCredential"/> authentication flow.</param>
 public DefaultAzureCredential(DefaultAzureCredentialOptions options)
     : this(new DefaultAzureCredentialFactory(CredentialPipeline.GetInstance(options)), options)
 {
 }
コード例 #6
0
 protected ManagedIdentitySource(CredentialPipeline pipeline)
 {
     Pipeline            = pipeline;
     _responseClassifier = new ManagedIdentityResponseClassifier();
 }
 private AppServiceV2017ManagedIdentitySource(CredentialPipeline pipeline, Uri endpoint, string secret,
                                              ManagedIdentityClientOptions options) : base(pipeline, endpoint, secret, options)
 {
 }
コード例 #8
0
 /// <summary>
 /// Creates an instance of the <see cref="UsernamePasswordCredential"/> with the details needed to authenticate against Azure Active Directory with a simple username
 /// and password.
 /// </summary>
 /// <param name="username"></param>
 /// <param name="password">The user account's user name, UPN.</param>
 /// <param name="tenantId">The Azure Active Directory tenant (directory) ID or name.</param>
 /// <param name="clientId">The client (application) ID of an App Registration in the tenant.</param>
 /// <param name="options">The client options for the newly created UsernamePasswordCredential</param>
 public UsernamePasswordCredential(string username, string password, string tenantId, string clientId, TokenCredentialOptions options)
     : this(username, password, tenantId, clientId, CredentialPipeline.GetInstance(options))
 {
 }
コード例 #9
0
 internal UsernamePasswordCredential(string username, string password, string tenantId, string clientId, CredentialPipeline pipeline)
     : this(username, password, pipeline, pipeline.CreateMsalPublicClient(clientId, tenantId))
 {
 }
コード例 #10
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;
 }
コード例 #11
0
        internal InteractiveBrowserCredential(string tenantId, string clientId, TokenCredentialOptions options, CredentialPipeline pipeline, MsalPublicClient client)
        {
            _clientId = clientId ?? throw new ArgumentNullException(nameof(clientId));

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

            _client = client ?? new MsalPublicClient(_pipeline, tenantId, clientId, null, options as ITokenCacheOptions);
        }
コード例 #12
0
 internal DefaultAzureCredential(DefaultAzureCredentialFactory factory, DefaultAzureCredentialOptions options)
 {
     _pipeline       = factory.Pipeline;
     _sources        = GetDefaultAzureCredentialChain(factory, options);
     _credentialLock = new AsyncLockWithValue <TokenCredential>();
 }
コード例 #13
0
        internal ManagedIdentityCredential(CredentialPipeline pipeline, ManagedIdentityClient client)
        {
            _pipeline = pipeline;

            _client = client;
        }
コード例 #14
0
 internal ManagedIdentityCredential(string clientId, CredentialPipeline pipeline)
     : this(pipeline, new ManagedIdentityClient(pipeline, clientId))
 {
 }
コード例 #15
0
 internal AzureCliCredential(CredentialPipeline pipeline, IProcessService processService)
 {
     _pipeline       = pipeline;
     _path           = !string.IsNullOrEmpty(EnvironmentVariables.Path) ? EnvironmentVariables.Path : DefaultPath;
     _processService = processService ?? ProcessService.Default;
 }
コード例 #16
0
 internal InteractiveBrowserCredential(string tenantId, string clientId, TokenCredentialOptions options, CredentialPipeline pipeline)
     : this(tenantId, clientId, options, pipeline, null)
 {
 }
コード例 #17
0
        internal ClientSecretCredential(string tenantId, string clientId, string clientSecret, TokenCredentialOptions options, CredentialPipeline pipeline, MsalConfidentialClient client)
        {
            TenantId = Validations.ValidateTenantId(tenantId, 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);
        }
コード例 #18
0
        internal InteractiveBrowserCredential(string tenantId, string clientId, TokenCredentialOptions options, CredentialPipeline pipeline, MsalPublicClient client)
        {
            Argument.AssertNotNull(clientId, nameof(clientId));

            ClientId  = clientId;
            _tenantId = tenantId;
            _allowMultiTenantAuthentication = options?.AllowMultiTenantAuthentication ?? false;
            Pipeline  = pipeline ?? CredentialPipeline.GetInstance(options);
            LoginHint = (options as InteractiveBrowserCredentialOptions)?.LoginHint;
            var redirectUrl = (options as InteractiveBrowserCredentialOptions)?.RedirectUri?.AbsoluteUri ?? Constants.DefaultRedirectUrl;

            Client = client ?? new MsalPublicClient(Pipeline, tenantId, clientId, redirectUrl, options as ITokenCacheOptions, options?.IsLoggingPIIEnabled ?? false);
        }
コード例 #19
0
        public ManagedIdentityClient(CredentialPipeline pipeline, string clientId = null)
        {
            _pipeline = pipeline;

            ClientId = clientId;
        }
コード例 #20
0
 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;
 }
コード例 #21
0
 /// <summary>
 /// Create an instance of CliCredential class.
 /// </summary>
 public AzureCliCredential()
     : this(CredentialPipeline.GetInstance(null), new AzureCliCredentialClient())
 {
 }
コード例 #22
0
 internal DeviceCodeCredential(Func <DeviceCodeInfo, CancellationToken, Task> deviceCodeCallback, string tenantId, string clientId, TokenCredentialOptions options, CredentialPipeline pipeline)
     : this(deviceCodeCallback, tenantId, clientId, options, pipeline, null)
 {
 }
コード例 #23
0
        internal AzureCliCredential(CredentialPipeline pipeline, AzureCliCredentialClient client)
        {
            _pipeline = pipeline;

            _client = client;
        }
コード例 #24
0
        internal DeviceCodeCredential(Func <DeviceCodeInfo, CancellationToken, Task> deviceCodeCallback, string tenantId, string clientId, TokenCredentialOptions options, CredentialPipeline pipeline, MsalPublicClient client)
        {
            _clientId = clientId ?? throw new ArgumentNullException(nameof(clientId));

            _deviceCodeCallback = deviceCodeCallback ?? throw new ArgumentNullException(nameof(deviceCodeCallback));

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

            _client = client ?? new MsalPublicClient(_pipeline, tenantId, clientId, AzureAuthorityHosts.GetDeviceCodeRedirectUri(_pipeline.AuthorityHost).ToString(), options as ITokenCacheOptions);
        }
コード例 #25
0
        internal DefaultAzureCredential(DefaultAzureCredentialFactory factory, DefaultAzureCredentialOptions options)
        {
            _pipeline = factory.Pipeline;

            _sources = GetDefaultAzureCredentialChain(factory, options);
        }
 public DefaultAzureCredentialFactory(CredentialPipeline pipeline)
 {
     Pipeline = pipeline;
 }
コード例 #27
0
 /// <summary>
 /// Creates a new <see cref="SharedTokenCacheCredential"/> which will authenticate users signed in through developer tools supporting Azure single sign on.
 /// </summary>
 /// <param name="options">The client options for the newly created <see cref="SharedTokenCacheCredential"/></param>
 public SharedTokenCacheCredential(SharedTokenCacheCredentialOptions options)
     : this(options?.TenantId, options?.Username, CredentialPipeline.GetInstance(options))
 {
 }
コード例 #28
0
 /// <summary>
 /// Create an instance of CliCredential class.
 /// </summary>
 public AzureCliCredential()
     : this(CredentialPipeline.GetInstance(null), default)
 {
 }
コード例 #29
0
 internal SharedTokenCacheCredential(string tenantId, string username, CredentialPipeline pipeline)
     : this(tenantId : tenantId, username : username, pipeline : pipeline, client : pipeline.CreateMsalPublicClient(Constants.DeveloperSignOnClientId, tenantId : tenantId, attachSharedCache : true))
 {
 }
コード例 #30
0
        internal EnvironmentCredential(CredentialPipeline pipeline, TokenCredential credential)
        {
            _pipeline = pipeline;

            _credential = credential;
        }