Skip to content

Commit

Permalink
Fixes #1163 (#1245)
Browse files Browse the repository at this point in the history
based on updates from EasyAuth people
  • Loading branch information
jmprieur authored Jun 7, 2021
1 parent e435bbb commit 37471e7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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)
);
}
}

Expand Down
2 changes: 2 additions & 0 deletions tests/Microsoft.Identity.Web.Test/WebAppExtensionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 37471e7

Please sign in to comment.