diff --git a/src/Api/AdminConsole/Authorization/ClaimsExtensions.cs b/src/Api/AdminConsole/Authorization/ClaimsExtensions.cs
index fab601aa89..99040bc0c6 100644
--- a/src/Api/AdminConsole/Authorization/ClaimsExtensions.cs
+++ b/src/Api/AdminConsole/Authorization/ClaimsExtensions.cs
@@ -51,30 +51,31 @@ public static class ClaimsExtensions
///
private static HasClaim GetClaimsParser(ClaimsPrincipal user, Guid organizationId)
{
- // Transform into a dict based on the claim type
+ // Group claims by ClaimType
var claimsDict = user.Claims
- .GetGuidClaims()
.GroupBy(c => c.Type)
.ToDictionary(
c => c.Key,
- c => c.Select(v => v.Value));
+ c => c.ToList());
return claimType
- => claimsDict.TryGetValue(claimType, out var claimValue) &&
- claimValue.Any(v => v == organizationId);
+ => claimsDict.TryGetValue(claimType, out var claims) &&
+ claims
+ .ParseGuids()
+ .Any(v => v == organizationId);
}
///
- /// Parses all claims into proper Guids, or ignore them if they are not valid guids.
+ /// Parses the provided claims into proper Guids, or ignore them if they are not valid guids.
///
- private static List<(string Type, Guid Value)> GetGuidClaims(this IEnumerable claims)
+ private static List ParseGuids(this IEnumerable claims)
{
- List<(string Type, Guid Value)> result = [];
+ List result = [];
foreach (var claim in claims)
{
if (Guid.TryParse(claim.Value, out var guid))
{
- result.Add((claim.Type, guid));
+ result.Add(guid);
}
}