return claim name to jwt

This commit is contained in:
Alex Bezdieniezhnykh
2025-01-20 10:35:37 +02:00
parent bfb7b89f32
commit 52c7ec09c6
+1
View File
@@ -44,6 +44,7 @@ public class AuthService(IHttpContextAccessor httpContextAccessor, IOptions<JwtC
{ {
Subject = new ClaimsIdentity([ Subject = new ClaimsIdentity([
new Claim(ClaimTypes.NameIdentifier, user.Id.ToString()), new Claim(ClaimTypes.NameIdentifier, user.Id.ToString()),
new Claim(ClaimTypes.Name, user.Email),
new Claim(ClaimTypes.Role, user.Role.ToString()) new Claim(ClaimTypes.Role, user.Role.ToString())
]), ]),
Expires = DateTime.UtcNow.AddHours(jwtConfig.Value.TokenLifetimeHours), Expires = DateTime.UtcNow.AddHours(jwtConfig.Value.TokenLifetimeHours),