9/06更新
This commit is contained in:
@@ -23,15 +23,15 @@ namespace Yi.Framework.Core
|
||||
}
|
||||
public string GetRefreshToken(UserEntity user)
|
||||
{
|
||||
return this.GetToken(_JWTTokenOptions.ReExpiration, user,null, true);
|
||||
return this.GetToken(_JWTTokenOptions.ReExpiration, user, null, true);
|
||||
}
|
||||
|
||||
public string GetAccessToken(UserEntity user,HashSet<MenuEntity> menus)
|
||||
public string GetAccessToken(UserEntity user, HashSet<MenuEntity> menus)
|
||||
{
|
||||
return this.GetToken(_JWTTokenOptions.Expiration, user, menus);
|
||||
}
|
||||
|
||||
private string GetToken(int minutes, UserEntity user, HashSet<MenuEntity> menus,bool isRefresh = false)
|
||||
private string GetToken(int minutes, UserEntity user, HashSet<MenuEntity> menus, bool isRefresh = false)
|
||||
{
|
||||
List<Claim> claims = new List<Claim>();
|
||||
claims.Add(new Claim(JwtRegisteredClaimNames.Nbf, $"{new DateTimeOffset(DateTime.Now).ToUnixTimeSeconds()}"));
|
||||
@@ -42,7 +42,10 @@ namespace Yi.Framework.Core
|
||||
|
||||
foreach (var m in menus)
|
||||
{
|
||||
claims.Add(new Claim("permission", m.PermissionCode.ToString()));
|
||||
if (!string.IsNullOrEmpty(m.PermissionCode))
|
||||
{
|
||||
claims.Add(new Claim("permission", m.PermissionCode.ToString()));
|
||||
}
|
||||
}
|
||||
|
||||
if (isRefresh)
|
||||
|
||||
Reference in New Issue
Block a user