更新 JWT
This commit is contained in:
1 parent
f84c4c1949
commit
8526e5e0d2
10 files changed
+40
-63
No files matched your search
@@ -1,4 +1,4 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System.Globalization;
|
||||
using System.Security.Claims;
|
||||
|
||||
@@ -24,16 +24,6 @@ public class CurrentUser : ICurrentUser
|
||||
/// <inheritdoc />
|
||||
public bool IsAuthenticated => Principal?.Identity?.IsAuthenticated == true;
|
||||
|
||||
/// <inheritdoc />
|
||||
public int? Id
|
||||
{
|
||||
get
|
||||
{
|
||||
string? value = GetClaimValue(JwtClaimTypes.UserId);
|
||||
return int.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out int id) ? id : null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public string? UserName => GetClaimValue(JwtClaimTypes.UserName);
|
||||
|
||||
|
||||
Reference in new issue
Block a user