We have an asp.net core 6.0 web app. When we login we need to add a few additional claims to control users. These new claims come from database, but we can't do it in the "GenerateClaimsAsync" of the IdentityUser since this is a multi tenant SAAS app with a single database and depending on the tenant the user is, those claims are going to be different.
await _signInManager.SignInWithClaimsAsync(user, isPersistent: true, GetUserTenantAdditionalClaims(user));
In the "GetUserTenantAdditionalClaims" we get the claims for the user depending on which tenant is.
Everything works just fine when connecting but after a few minutes (15-20) the Athentication Cookie changes and loses all the additional claims, BUT the user is still logged !!! So after that time we have the user logged with the "regular" claims but we have lost our additional claims.
I know this is a problem when .NET refreshes the cookie, but is there any way to not refreshing that cookie or can add a few lines of code in a "on refreshing cookie" procedure to reload also our additional claims?
Thanks in advance.