diff --git a/src/Microsoft.Identity.Web/AppServicesAuth/AppServicesAuthenticationInformation.cs b/src/Microsoft.Identity.Web/AppServicesAuth/AppServicesAuthenticationInformation.cs index 6700c477f..feea7f853 100644 --- a/src/Microsoft.Identity.Web/AppServicesAuth/AppServicesAuthenticationInformation.cs +++ b/src/Microsoft.Identity.Web/AppServicesAuth/AppServicesAuthenticationInformation.cs @@ -23,6 +23,7 @@ public static class AppServicesAuthenticationInformation internal const string AppServicesAuthLogoutPathEnvironmentVariable = "WEBSITE_AUTH_LOGOUT_PATH"; // /.auth/logout internal const string AppServicesAuthIdentityProviderEnvironmentVariable = "WEBSITE_AUTH_DEFAULT_PROVIDER"; // AzureActiveDirectory internal const string AppServicesAuthAzureActiveDirectory = "AzureActiveDirectory"; + internal const string AppServicesAuthAAD = "AAD"; internal const string AppServicesAuthIdTokenHeader = "X-MS-TOKEN-AAD-ID-TOKEN"; internal const string AppServicesWebSiteAuthApiPrefix = "WEBSITE_AUTH_API_PREFIX"; private const string AppServicesAuthIdpTokenHeader = "X-MS-CLIENT-PRINCIPAL-IDP"; @@ -44,10 +45,16 @@ public static bool IsAppServicesAadAuthenticationEnabled Constants.True, StringComparison.OrdinalIgnoreCase) && - string.Equals( + (string.Equals( Environment.GetEnvironmentVariable(AppServicesAuthIdentityProviderEnvironmentVariable), AppServicesAuthAzureActiveDirectory, - StringComparison.OrdinalIgnoreCase); + StringComparison.OrdinalIgnoreCase) + || + string.Equals( + Environment.GetEnvironmentVariable(AppServicesAuthIdentityProviderEnvironmentVariable), + AppServicesAuthAAD, + StringComparison.OrdinalIgnoreCase) + ); } } diff --git a/tests/Microsoft.Identity.Web.Test/WebAppExtensionsTests.cs b/tests/Microsoft.Identity.Web.Test/WebAppExtensionsTests.cs index 7ffbd6706..bbf8cc161 100644 --- a/tests/Microsoft.Identity.Web.Test/WebAppExtensionsTests.cs +++ b/tests/Microsoft.Identity.Web.Test/WebAppExtensionsTests.cs @@ -428,6 +428,8 @@ public void AddMicrosoftIdentityWebApp_AddsInMemoryTokenCaches() [InlineData("true", "azureactivedirectory")] [InlineData("tRue", AppServicesAuthenticationInformation.AppServicesAuthAzureActiveDirectory)] [InlineData("true", AppServicesAuthenticationInformation.AppServicesAuthAzureActiveDirectory)] + [InlineData("tRue", AppServicesAuthenticationInformation.AppServicesAuthAAD)] + [InlineData("true", AppServicesAuthenticationInformation.AppServicesAuthAAD)] // Regression for https://github.com/AzureAD/microsoft-identity-web/issues/1163 public void AppServices_EnvironmentTest(string appServicesEnvEnabledValue, string idpEnvValue) {