rating adding completed
This commit is contained in:
@@ -8,4 +8,5 @@ public interface IUserService
|
||||
string? GetRawToken();
|
||||
UserValidator GetValidator();
|
||||
Guid GetJti();
|
||||
long GetUserId();
|
||||
}
|
||||
@@ -40,6 +40,14 @@ public class UserService(DatabaseContext database, IHttpContextAccessor accessor
|
||||
Guid guid = Guid.Parse(jtiClaim.Value);
|
||||
return guid;
|
||||
}
|
||||
|
||||
public long GetUserId()
|
||||
{
|
||||
ClaimsPrincipal user = GetRawUser();
|
||||
Claim subClaim = user.FindFirst(JwtRegisteredClaimNames.Sub)!;
|
||||
long id = long.Parse(subClaim.Value);
|
||||
return id;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
Reference in New Issue
Block a user