What is the output of the new middleware?
logger.LogError
ok, you can test your code in a new template project.
Thanks.
hi
Your access token is no problem. which means builder.SetAccessTokenLifetime(TimeSpan.FromHours(24));
works,
but still unauthorized after 1 hour
Can you share the logs for the unauthorized
error?
See https://abp.io/support/questions/8622/How-to-enable-Debug-logs-for-troubleshoot-problems to enable debug logs.
Thanks.
hi
The CFData.Structure.Core
is used Sdk="Microsoft.NET.Sdk.Web"
as SDK.
It can not be used in a WASM project.
Can you try to remove this project from your CFData.Structure.Tenant.Licensing
project?
Or change CFData.Structure.Core
to using Sdk="Microsoft.NET.Sdk"
Thanks.
hi Spospisil
I have reproduced your problem. I will provide a solution soon.
Thanks.
hi
OpenIddict occasionally encounters conflicts under concurrent conditions, and we've made improvements to address this in the latest version.
Thanks.
hi
The 9.1.3 is the latest 9.1 patch version.
You can upgrade all packages to 9.1.3.
Thanks.
hi
Can you try to upgrade all abp&volo packages to the latest(9.1.3)?
Thanks.
hi andmattia
when I enter a tenant and request data from a new microservice, I only see data for my tenant, as expected. However, when I request user data, I see Host-level data.
This should be due to the tenant not identifying correctly.
You can add a middleware to your user data
website. That prints the current claims and claim types.
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);
});
Thanks