aboutsummaryrefslogtreecommitdiff
path: root/BackEnd/Timeline/Auth
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-11-13 16:23:54 +0800
committercrupest <crupest@outlook.com>2020-11-13 16:25:02 +0800
commit379b4bafe982a8a8cd3158f0a9fa38a563dbdb57 (patch)
tree0719f4a4a7dece64f08388603eb0cd91fb5f8a9b /BackEnd/Timeline/Auth
parent299067a798077363d0df281fc3bfb4160df06e1f (diff)
downloadtimeline-379b4bafe982a8a8cd3158f0a9fa38a563dbdb57.tar.gz
timeline-379b4bafe982a8a8cd3158f0a9fa38a563dbdb57.tar.bz2
timeline-379b4bafe982a8a8cd3158f0a9fa38a563dbdb57.zip
refactor: Fix #178 .
Diffstat (limited to 'BackEnd/Timeline/Auth')
-rw-r--r--BackEnd/Timeline/Auth/MyAuthenticationHandler.cs2
-rw-r--r--BackEnd/Timeline/Auth/PrincipalExtensions.cs2
2 files changed, 2 insertions, 2 deletions
diff --git a/BackEnd/Timeline/Auth/MyAuthenticationHandler.cs b/BackEnd/Timeline/Auth/MyAuthenticationHandler.cs
index b5e22a14..223ff187 100644
--- a/BackEnd/Timeline/Auth/MyAuthenticationHandler.cs
+++ b/BackEnd/Timeline/Auth/MyAuthenticationHandler.cs
@@ -45,7 +45,7 @@ namespace Timeline.Auth
{
// check the authorization header
string header = Request.Headers[HeaderNames.Authorization];
- if (!string.IsNullOrEmpty(header) && header.StartsWith("Bearer ", StringComparison.InvariantCultureIgnoreCase))
+ if (!string.IsNullOrEmpty(header) && header.StartsWith("Bearer ", StringComparison.OrdinalIgnoreCase))
{
var token = header.Substring("Bearer ".Length).Trim();
_logger.LogInformation(LogTokenFoundInHeader, token);
diff --git a/BackEnd/Timeline/Auth/PrincipalExtensions.cs b/BackEnd/Timeline/Auth/PrincipalExtensions.cs
index 9f86e8ac..c0f9de14 100644
--- a/BackEnd/Timeline/Auth/PrincipalExtensions.cs
+++ b/BackEnd/Timeline/Auth/PrincipalExtensions.cs
@@ -9,7 +9,7 @@ namespace Timeline.Auth
internal static bool HasPermission(this ClaimsPrincipal principal, UserPermission permission)
{
return principal.HasClaim(
- claim => claim.Type == AuthenticationConstants.PermissionClaimName && string.Equals(claim.Value, permission.ToString(), StringComparison.InvariantCultureIgnoreCase));
+ claim => claim.Type == AuthenticationConstants.PermissionClaimName && string.Equals(claim.Value, permission.ToString(), StringComparison.OrdinalIgnoreCase));
}
}
}