Files
Yi.Framework/Yi.Doc.Md/02.框架功能模块/13.接口授权.md
2023-12-15 23:44:35 +08:00

18 lines
673 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## 简介
> 授权必须基于鉴权之后,知道了用户的信息,根据用户权限列表进行判断是否有权限进入
框架内部集成授权方式并非为Asp.netcore授权方式而是提供一种更简单的方式
使用起来非常简单
## 使用
只需要在需要授权的接口上打上特性 `[Permission("code")]`接口
code为登录时候颁发的token中的权限如果该用户的token 权限列表中不包含code将被会拦截并提示未授权被拒绝
``` cs
[Permission("system:user:delete")]
public override async Task DeleteAsync(Guid id)
{
await base.DeleteAsync(id);
}
```