async Task<string> GenerateJwtTokenAsync(User user)

This commit is contained in:
Artemy
2025-07-02 15:26:27 +07:00
parent 0967fe1b4e
commit 0669614a5e
13 changed files with 131 additions and 22 deletions
+2 -2
View File
@@ -57,7 +57,7 @@ public class AuthService : IAccountService
SetRole(user, invitation);
return _jwtService.GenerateJwtToken(user);
return await _jwtService.GenerateJwtTokenAsync(user);
}
@@ -71,7 +71,7 @@ public class AuthService : IAccountService
if (_passwordHasher.Verify(password, user.PasswordHash) == false)
throw new LoginUserException();
return _jwtService.GenerateJwtToken(user);
return await _jwtService.GenerateJwtTokenAsync(user);
}
private async void SetRole(User user, Invitation invitation)
+2 -2
View File
@@ -19,12 +19,12 @@ public class JwtService : IJwtService
_invitesService = invitesService;
}
public string GenerateJwtToken(User user)
public async Task<string> GenerateJwtTokenAsync(User user)
{
var claims = new[]
{
new Claim("userId", user.Id.ToString()),
new Claim(ClaimTypes.Role, _invitesService.GetRoleAsync(user).Result, ClaimValueTypes.String)
new Claim(ClaimTypes.Role, await _invitesService.GetRoleAsync(user), ClaimValueTypes.String)
};
var singing = new SigningCredentials(