< Summary

Class:Azure.Identity.DefaultAzureCredentialFactory
Assembly:Azure.Identity
File(s):C:\Git\azure-sdk-for-net\sdk\identity\Azure.Identity\src\DefaultAzureCredentialFactory.cs
Covered lines:12
Uncovered lines:0
Coverable lines:12
Total lines:55
Line coverage:100% (12 of 12)
Covered branches:0
Total branches:0

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-100%100%
.ctor(...)-100%100%
get_Pipeline()-100%100%
CreateEnvironmentCredential()-100%100%
CreateManagedIdentityCredential(...)-100%100%
CreateSharedTokenCacheCredential(...)-100%100%
CreateInteractiveBrowserCredential(...)-100%100%
CreateAzureCliCredential()-100%100%
CreateVisualStudioCredential(...)-100%100%
CreateVisualStudioCodeCredential(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\identity\Azure.Identity\src\DefaultAzureCredentialFactory.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using Azure.Core;
 5
 6namespace Azure.Identity
 7{
 8    internal class DefaultAzureCredentialFactory
 9    {
 10        public DefaultAzureCredentialFactory(TokenCredentialOptions options)
 14811            : this(CredentialPipeline.GetInstance(options)) { }
 12
 118613        protected DefaultAzureCredentialFactory(CredentialPipeline pipeline)
 14        {
 118615            Pipeline = pipeline;
 118616        }
 17
 135218        public CredentialPipeline Pipeline { get; }
 19
 20        public virtual TokenCredential CreateEnvironmentCredential()
 21        {
 622            return new EnvironmentCredential(Pipeline);
 23        }
 24
 25        public virtual TokenCredential CreateManagedIdentityCredential(string clientId)
 26        {
 627            return new ManagedIdentityCredential(clientId, Pipeline);
 28        }
 29
 30        public virtual TokenCredential CreateSharedTokenCacheCredential(string tenantId, string username)
 31        {
 632            return new SharedTokenCacheCredential(tenantId, username, null, Pipeline);
 33        }
 34
 35        public virtual TokenCredential CreateInteractiveBrowserCredential(string tenantId)
 36        {
 437            return new InteractiveBrowserCredential(tenantId, Constants.DeveloperSignOnClientId, new InteractiveBrowserC
 38        }
 39
 40        public virtual TokenCredential CreateAzureCliCredential()
 41        {
 642            return new AzureCliCredential(Pipeline, default);
 43        }
 44
 45        public virtual TokenCredential CreateVisualStudioCredential(string tenantId)
 46        {
 647            return new VisualStudioCredential(tenantId, Pipeline, default, default);
 48        }
 49
 50        public virtual TokenCredential CreateVisualStudioCodeCredential(string tenantId)
 51        {
 652            return new VisualStudioCodeCredential(new VisualStudioCodeCredentialOptions { TenantId = tenantId }, Pipelin
 53        }
 54    }
 55}