-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…#1168) * Fix for #1136 - case insensitive comparison to detect app service env * Add another test to keep SQ happy * Test * update test (#1173) Co-authored-by: jennyf19 <[email protected]>
- Loading branch information
Showing
3 changed files
with
111 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
tests/Microsoft.Identity.Web.Test/AppServicesAuthenticationInformationTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using Microsoft.Extensions.Primitives; | ||
using Xunit; | ||
|
||
namespace Microsoft.Identity.Web.Test | ||
{ | ||
public class AppServicesAuthenticationInformationTests | ||
{ | ||
[Fact] | ||
public void SimulateGetttingHeaderFromDebugEnvironmentVariable() | ||
{ | ||
try | ||
{ | ||
Environment.SetEnvironmentVariable( | ||
AppServicesAuthenticationInformation.AppServicesAuthDebugHeadersEnvironmentVariable, | ||
$"a;{AppServicesAuthenticationInformation.AppServicesAuthIdTokenHeader}:xyz"); | ||
|
||
var res = AppServicesAuthenticationInformation.GetIdToken( | ||
new Dictionary<string, StringValues>() | ||
{ | ||
{ AppServicesAuthenticationInformation.AppServicesAuthIdTokenHeader, new StringValues(string.Empty) }, | ||
}); | ||
|
||
#if DEBUG | ||
Assert.Equal("xyz", res); | ||
#else | ||
Assert.Equal(string.Empty, res); | ||
#endif | ||
} | ||
finally | ||
{ | ||
Environment.SetEnvironmentVariable( | ||
AppServicesAuthenticationInformation.AppServicesAuthDebugHeadersEnvironmentVariable, | ||
string.Empty); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters