Skip to content

Commit 5951eaf

Browse files
authored
Merge pull request #294166 from MicrosoftDocs/repo_sync_working_branch
Confirm merge from repo_sync_working_branch to main to sync with https://github.com/MicrosoftDocs/azure-docs (branch main)
2 parents 17874d4 + f8376fc commit 5951eaf

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

articles/app-service/monitor-instances-health-check.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,18 @@ If you're using your own authentication system, the Health check path must allow
7474

7575
```C#
7676
using System;
77+
using System.Security.Cryptography;
7778
using System.Text;
7879

7980
/// <summary>
8081
/// Method <c>HeaderMatchesEnvVar</c> returns true if <c>headerValue</c> matches WEBSITE_AUTH_ENCRYPTION_KEY.
8182
/// </summary>
82-
public Boolean HeaderMatchesEnvVar(string headerValue) {
83-
var sha = System.Security.Cryptography.SHA256.Create();
84-
String envVar = Environment.GetEnvironmentVariable("WEBSITE_AUTH_ENCRYPTION_KEY");
85-
String hash = System.Convert.ToBase64String(sha.ComputeHash(Encoding.UTF8.GetBytes(envVar)));
86-
return hash == headerValue;
83+
public bool HeaderMatchesEnvVar(string headerValue)
84+
{
85+
var sha = SHA256.Create();
86+
string envVar = Environment.GetEnvironmentVariable("WEBSITE_AUTH_ENCRYPTION_KEY");
87+
string hash = Convert.ToBase64String(sha.ComputeHash(Encoding.UTF8.GetBytes(envVar)));
88+
return string.Equals(hash, headerValue, StringComparison.Ordinal);
8789
}
8890
```
8991

0 commit comments

Comments
 (0)