hi
This may be a cache problem. Please try to clear Redis.
I tested the microservice project today, and everything works.
hi
You can use the methods of IPermissionManager
below.
GetForRoleAsync
GetAllForRoleAsync
SetForRoleAsync
https://github.com/abpframework/abp/blob/dev/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/RolePermissionManagerExtensions.cs
hi
Please remove these lines from your program.cs file and reproduce the issue and share the full request logs. liming.ma@volosoft.com
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
.MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning)
https://github.com/abpframework/abp/pull/15842
ok, I see. will work on it.
hi
The only thing that temporarily makes permissions work again is clearing cookies and flushing Redis cache.
After that, refreshing the page will work.
options.Events.OnValidatePrincipal
context.Services.AddAuthentication(options =>
{
options.DefaultScheme = "Cookies";
options.DefaultChallengeScheme = "oidc";
})
.AddCookie("Cookies", options =>
{
options.ExpireTimeSpan = TimeSpan.FromDays(365);
options.Events.OnValidatePrincipal = async principalContext =>
{
if (principalContext.Principal != null && principalContext.Principal.Identity != null && principalContext.Principal.Identity.IsAuthenticated)
{
var accessToken = principalContext.Properties.GetTokenValue("access_token");
if (accessToken.IsNullOrWhiteSpace())
{
principalContext.RejectPrincipal();
await principalContext.HttpContext.SignOutAsync("Cookies");
return;
}
var httpClient = principalContext.HttpContext.RequestServices.GetRequiredService<IHttpClientFactory>().CreateClient();
var response = await httpClient.IntrospectTokenAsync(new TokenIntrospectionRequest
{
Address = configuration["AuthServer:Authority"] + "/connect/introspect",
ClientId = configuration["AuthServer:ClientId"],
ClientSecret = configuration["AuthServer:ClientSecret"],
Token = accessToken
});
if (!response.IsActive)
{
principalContext.RejectPrincipal();
await principalContext.HttpContext.SignOutAsync("Cookies");
}
}
};
})
.AddAbpOpenIdConnect("oidc", options =>
{
options.Authority = configuration["AuthServer:Authority"];
options.RequireHttpsMetadata = Convert.ToBoolean(configuration["AuthServer:RequireHttpsMetadata"]);;
options.ResponseType = OpenIdConnectResponseType.CodeIdToken;
options.ClientId = configuration["AuthServer:ClientId"];
options.ClientSecret = configuration["AuthServer:ClientSecret"];
options.SaveTokens = true;
options.GetClaimsFromUserInfoEndpoint = true;
options.Scope.Add("roles");
options.Scope.Add("email");
options.Scope.Add("phone");
options.Scope.Add("BookStore");
});
we are using the blazorise library.
https://blazorise.com/docs/components/tab