mirror of
https://github.com/Govor-team/Govor.git
synced 2026-07-21 19:54:55 +00:00
Add sessionId to JWT and update session handling
The JwtService now includes sessionId in access tokens, and all usages have been updated to pass sessionId when generating tokens. UserSession now supports public encryption and signing keys. Tests and session management logic have been updated to reflect these changes, ensuring session-specific claims in JWTs and improved session tracking.
This commit is contained in:
@@ -21,11 +21,12 @@ public class JwtService : IJwtService
|
||||
_invitesService = invitesService;
|
||||
}
|
||||
|
||||
public async Task<string> GenerateAccessTokenAsync(User user)
|
||||
public async Task<string> GenerateAccessTokenAsync(User user, Guid sessionId)
|
||||
{
|
||||
var claims = new[]
|
||||
{
|
||||
new Claim("userId", user.Id.ToString()),
|
||||
new Claim("sid", sessionId.ToString()),
|
||||
new Claim(ClaimTypes.Role, await _invitesService.GetRoleAsync(user), ClaimValueTypes.String)
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user