大版本更新
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
using Microsoft.IdentityModel.JsonWebTokens;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -29,16 +30,21 @@ namespace Yi.Framework.WebCore.AttributeExtend
|
||||
{
|
||||
throw new Exception("权限不能为空!");
|
||||
}
|
||||
|
||||
//可以从Redis得到用户菜单列表,或者直接从jwt中获取
|
||||
|
||||
var result = false;
|
||||
|
||||
//判断权限是否存在Redis中
|
||||
if (permission.Length>0)
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
|
||||
//可以从Redis得到用户菜单列表,或者直接从jwt中获取
|
||||
var sid = context.HttpContext.User.Claims.FirstOrDefault(u => u.Type == JwtRegisteredClaimNames.Sid);
|
||||
|
||||
//jwt存在的权限列表
|
||||
var perList = context.HttpContext.User.Claims.Where(u => u.Type == "permission").Select(u=> u.Value.ToString().ToLower()). ToList();
|
||||
//判断权限是否存在Redis中,或者jwt中
|
||||
|
||||
//if (perList.Contains(permission.ToLower()))
|
||||
//{
|
||||
// result = true;
|
||||
//}
|
||||
result = true;
|
||||
|
||||
|
||||
if (!result)
|
||||
|
||||
Reference in New Issue
Block a user