hi
The DTO classes for requests and responses need to use primitive objects/types; otherwise, you'll have to add a JSON converter for serialization and deserialization.
Can you share the returned JSON? You can call the API in Swagger to see the returned JSON.
Of course. You can also share a minimal project to reproduce the error.
liming.ma@volosoft.com
Thanks.
hi
I need to check the code. Please share a project. Thank you.
Hi
Please share your DTO(input/output) class code.
Thank
hi
When using [Authorize("Permission.View")] on API method, a user that has the "Permission.View" permission granted and on correct tenant, does not get Authorized and I get a 403 error.
Can you add a custom middleware and share full debug logs?
liming.ma@volosoft.com
see https://abp.io/support/questions/8622/How-to-enable-Debug-logs-for-troubleshoot-problems
var loggerConfiguration = new LoggerConfiguration()
.MinimumLevel.Debug()
.MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning)
.Enrich.FromLogContext()
.WriteTo.Async(c => c.File("Logs/logs.txt"))
app.UseAuthentication();
app.Use(async (httpContext, next) =>
{
var logger = httpContext.RequestServices.GetRequiredService<ILogger<YourModule>>();
var claims = httpContext.User.Claims.Select(x => new { x.Type, x.Value }).ToList();
logger.LogError("HttpContext.User Claims:");
logger.LogError(JsonSerializer.Serialize(claims));
var currentUser = httpContext.RequestServices.GetRequiredService<ICurrentUser>().GetAllClaims().Select(x => new { x.Type, x.Value }).ToList();
logger.LogError("Current User Claims:");
logger.LogError(JsonSerializer.Serialize(currentUser));
var userid = AbpClaimTypes.UserId;
var username = AbpClaimTypes.UserName;
var roleClaimType = AbpClaimTypes.Role;
logger.LogError($"UserId Claim Type: {userid}");
logger.LogError($"UserName Claim Type: {username}");
logger.LogError($"Role Claim Type: {roleClaimType}");
var authorizationHeader = httpContext.Request.Headers["Authorization"];
logger.LogError(!string.IsNullOrEmpty(authorizationHeader)
? $"Authorization Header: {authorizationHeader}"
: "Authorization Header is missing or empty.");
await next(httpContext);
});
hi
I tested in the latest Blazor Server template project. And it works.
Can you share your project or a demo project to reproduce?
Thanks
Thanks. I will test it .
Hi
Can you share a project and steps to reproduce the problem?
Thanks
hi
Please share your Blazor Server module class code.
liming.ma@volosoft.com
Thanks