I assign a claim to a user in a certain endpoint
await userManager.AddClaimAsync(user, new Claim("role", "admin"));
and retrieve it from within another endpoint via the injected HttpContext
.
app.MapGet("", (HttpContext context) =>
{
var cp = context.User;
var response = string.Join(", ", cp.Claims.Select(c => $"({c.Type},{c.Value})"));
return TypedResults.Ok(response);
});
The output is not (role, admin)
but (http://schemas.microsoft.com/ws/2008/06/identity/claims/role,admin)
.
The framework under the hood automatically associates my "role"
with ClaimTypes.Role
? Is there any trick to stop this behavior?