Skip to content

Commit

Permalink
Modify GetRequestedRoles function
Browse files Browse the repository at this point in the history
  • Loading branch information
betaniat committed Aug 13, 2024
1 parent 68e4f0c commit b5f535e
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions backend/api/Utilities/HttpContextExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,9 @@ public static string GetRequestToken(this HttpContext client)

public static List<System.Security.Claims.Claim> GetRequestedRoles(this HttpContext client)
{
string accessTokenBase64 = client.GetRequestToken();

var handler = new JwtSecurityTokenHandler();
var jwtSecurityToken = handler.ReadJwtToken(accessTokenBase64);

var claims = jwtSecurityToken.Claims;
var claims = client.GetRequestedClaims();
var roles = claims.Where((c) => c.Type == "roles" || c.Type.EndsWith("role", StringComparison.CurrentCulture)).ToList();
return roles;

}

public static List<string> GetRequestedRoleNames(this HttpContext client)
Expand Down

0 comments on commit b5f535e

Please sign in to comment.