Closed indcoder closed 5 years ago
As you may notice, appending "permissions" before the claim name is not required anymore, so if this is the case please remove it.
options.AddPolicy("read:weather_forecast", policy => policy.RequireClaim("read:weather_forecast"));
For the example projects to run it is needed to have an API in Auth0 configured as follows:
Also, I recommend using the new Universal Login version, especially if you're testing against Google or Facebook:
Hi, any update regarding this issue?
Hi @henalbrod , my Auth0 app already had RBAC enabled API since we tested this successfully with the preview 8 code. But I was iterating through the list of claims that was sent across but the permissions are not visible. I'm not sure if Auth0 is not sending them across or the Blazor.Auth0 is not displaying them.
if (user.Identity.IsAuthenticated)
{
// Since the user is a ClaimsPrincipal, you can also enumerate claims,
// evaluate membership in roles, etc.
Console.WriteLine($"Hello, {user.Identity.Name}");
var claimsIdentity = (ClaimsIdentity)user.Identity;
foreach(var claim in claimsIdentity.Claims)
{
Console.WriteLine($"User has {claim} claim");
}
currentCount++;
}
My bad. An error on my part during configuration
My bad. An error on my part during configuration
In the previous version we had permissions appended before the claim. While following Example.Clientside, I have been testing the claims based fetch data. But I cannot see the permissions in the claims of the User Identity and hence the page is displayed the UnAuthorized message..
So while the example has @attribute [Authorize("read:weather_forecast")] , on the MS doc @attribute [Authorize( Policy = "read:weather_forecast")]
This was working for preview 8 codebase On the Auth0 dashboard , the relevant API had the RBAC enabled and the User has the Permission ["read:weather_forecast] set .