diff --git a/src/Tgstation.Server.Api/ApiHeaders.cs b/src/Tgstation.Server.Api/ApiHeaders.cs index 0235c5d401..5db3493ae5 100644 --- a/src/Tgstation.Server.Api/ApiHeaders.cs +++ b/src/Tgstation.Server.Api/ApiHeaders.cs @@ -33,12 +33,12 @@ namespace Tgstation.Server.Api /// /// The JWT authentication header scheme /// - const string jwtAuthenticationScheme = "bearer"; + const string jwtAuthenticationScheme = "Bearer"; /// /// The password authentication header scheme /// - const string passwordAuthenticationScheme = "password"; + const string passwordAuthenticationScheme = "Password"; /// /// The current diff --git a/src/Tgstation.Server.Api/Rights/RightsHelper.cs b/src/Tgstation.Server.Api/Rights/RightsHelper.cs index 2b3e0ddbc0..8db36400f4 100644 --- a/src/Tgstation.Server.Api/Rights/RightsHelper.cs +++ b/src/Tgstation.Server.Api/Rights/RightsHelper.cs @@ -46,7 +46,7 @@ namespace Tgstation.Server.Api.Rights /// The /// The right value /// A representing the claim role name - public static string RoleName(RightsType rightsType, int right) + public static string RoleName(RightsType rightsType, Enum right) { var enumType = typeMap[rightsType]; return String.Concat(enumType.Name, '.', Enum.GetName(enumType, right)); diff --git a/src/Tgstation.Server.Host/Controllers/ApiController.cs b/src/Tgstation.Server.Host/Controllers/ApiController.cs index 9c68b32ee3..4c6bcd541f 100644 --- a/src/Tgstation.Server.Host/Controllers/ApiController.cs +++ b/src/Tgstation.Server.Host/Controllers/ApiController.cs @@ -88,10 +88,11 @@ namespace Tgstation.Server.Host.Controllers foreach (RightsType I in enumerator) { var rightInt = authenticationContext.GetRight(I); - var right = (Enum)(ValueType)authenticationContext.GetRight(I); - foreach(Enum J in Enum.GetValues(RightsHelper.RightToType(I))) + var rightEnum = RightsHelper.RightToType(I); + var right = (Enum)Enum.ToObject(rightEnum, authenticationContext.GetRight(I)); + foreach(Enum J in Enum.GetValues(rightEnum)) if(right.HasFlag(J)) - claims.Add(new Claim(ClaimTypes.Role, RightsHelper.RoleName(I, rightInt))); + claims.Add(new Claim(ClaimTypes.Role, RightsHelper.RoleName(I, J))); } context.Principal.AddIdentity(new ClaimsIdentity(claims));