< Summary

Class:Azure.Identity.AzureAuthorityHosts
Assembly:Azure.Identity
File(s):C:\Git\azure-sdk-for-net\sdk\identity\Azure.Identity\src\AzureAuthorityHosts.cs
Covered lines:7
Uncovered lines:5
Coverable lines:12
Total lines:64
Line coverage:58.3% (7 of 12)
Covered branches:3
Total branches:10
Branch coverage:30% (3 of 10)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_AzurePublicCloud()-100%100%
get_AzureChina()-100%100%
get_AzureGermany()-100%100%
get_AzureGovernment()-0%100%
GetDefault()-100%100%
GetDefaultScope(...)-33.33%12.5%
GetDeviceCodeRedirectUri(...)-100%100%

File(s)

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

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5
 6namespace Azure.Identity
 7{
 8    /// <summary>
 9    /// Defines fields exposing the well known authority hosts for the Azure Public Cloud and sovereign clouds.
 10    /// </summary>
 11    public static class AzureAuthorityHosts
 12    {
 13        private const string AzurePublicCloudHostUrl = "https://login.microsoftonline.com/";
 14        private const string AzureChinaHostUrl = "https://login.chinacloudapi.cn/";
 15        private const string AzureGermanyHostUrl = "https://login.microsoftonline.de/";
 16        private const string AzureGovernmentHostUrl = "https://login.microsoftonline.us/";
 17        /// <summary>
 18        /// The host of the Azure Active Directory authority for tenants in the Azure Public Cloud.
 19        /// </summary>
 23220        public static Uri AzurePublicCloud { get; } = new Uri(AzurePublicCloudHostUrl);
 21
 22        /// <summary>
 23        /// The host of the Azure Active Directory authority for tenants in the Azure China Cloud.
 24        /// </summary>
 1025        public static Uri AzureChina { get; } = new Uri(AzureChinaHostUrl);
 26
 27        /// <summary>
 28        /// The host of the Azure Active Directory authority for tenants in the Azure German Cloud.
 29        /// </summary>
 630        public static Uri AzureGermany { get; } = new Uri(AzureGermanyHostUrl);
 31
 32        /// <summary>
 33        /// The host of the Azure Active Directory authority for tenants in the Azure US Government Cloud.
 34        /// </summary>
 035        public static Uri AzureGovernment { get; } = new Uri(AzureGovernmentHostUrl);
 36
 37        internal static Uri GetDefault()
 38        {
 20639            return EnvironmentVariables.AuthorityHost != null ? new Uri(EnvironmentVariables.AuthorityHost) : AzurePubli
 40        }
 41
 42        internal static string GetDefaultScope(Uri authorityHost)
 43        {
 2844            switch (authorityHost.ToString())
 45            {
 46                case AzurePublicCloudHostUrl:
 2847                    return "https://management.core.windows.net//.default";
 48                case AzureChinaHostUrl:
 049                    return "https://management.core.chinacloudapi.cn//.default";
 50                case AzureGermanyHostUrl:
 051                    return "https://management.core.cloudapi.de//.default";
 52                case AzureGovernmentHostUrl:
 053                    return "https://management.core.usgovcloudapi.net//.default";
 54                default:
 055                    return null;
 56            }
 57        }
 58
 59        internal static Uri GetDeviceCodeRedirectUri(Uri authorityHost)
 60        {
 2461            return new Uri(authorityHost, "/common/oauth2/nativeclient");
 62        }
 63    }
 64}