我的shiro之旅-注解方式授权
来源:互联网 发布:mp3音乐合成软件 编辑:程序博客网 时间:2024/06/11 04:45
相关的注解如下:
The RequiresAuthentication annotation(RequiresAuthentication 注解)
要求当前Subject 已经在当前的session 中被验证通过才能被访问或调用。例如:
@RequiresAuthentication
public void updateAccount(Account userAccount) {
//this method will only be invoked by a
//Subject that is guaranteed authenticated
…
}
The RequiresGuest annotation(RequiresGuest 注解)
要求当前的Subject 是一个"guest",也就是说,他们必须是在之前的session 中没有被验证或被记住才能被访问或调用。例如:
@RequiresGuest
public void signUp(User newUser) {
//this method will only be invoked by a
//Subject that is unknown/anonymous
…
}
The RequiresPermissions annotation(RequiresPermissions 注解)
要求当前的Subject 被允许一个或多个权限,以便执行注解的方法。例如:
@RequiresPermissions("account:create")
public void createAccount(Account account) {
//this method will only be invoked by a Subject
//that is permitted to create an account
…
}
The RequiresRoles annotation(RequiresRoles 注解)
要求当前的Subject 拥有所有指定的角色。如果他们没有,则该方法将不会被执行,而且AuthorizationException 异常将会被抛出。例如:
@RequiresRoles("administrator")
public void deleteUser(User user) {
//this method will only be invoked by an administrator
…
}
The RequiresUser annotation(RequiresUser 注解)
RequiresUser 注解需要当前的Subject 是一个应用程序用户才能被注解的类/实例/方法访问或调用。一个“应用程序用户”被定义为一个拥有已知身份,或在当前session 中由于通过验证被确认,或者在之前session 中的'RememberMe'服务被记住。例如:
@RequiresUser
public void updateAccount(Account account) {
//this method will only be invoked by a 'user'
//i.e. a Subject with a known identity
…
}
- 我的shiro之旅-注解方式授权
- Apache Shiro 注解方式授权
- Shiro之授权管理与授权的三种方式(1、编程方式,2、注解方式,3、jsp标签)-yellowcong
- Shiro 采用注解方式无法进入自定义Realm类的授权方法 解决方案
- Shiro授权的三种方式
- Shiro教程之注解式&jsp标签授权
- shiro注解授权源码分析
- spring集成shiro注解授权
- 我的shiro之旅: 三 浅谈shiro的filter
- 我的shiro之旅: 六 自定义shiro的sessionId
- 我的shiro之旅: 十 自定义shiro的SessionIdCookie
- 我的shiro之旅: 十一 shiro的权限设计
- 在SpringMVC中开启Shiro注解授权的正确方法
- 解决springMVC中 shiro 注解授权失效 的问题
- Shiro的注解(@RequiresRoles,@RequiresPermissions)授权不起作用
- Shiro的注解(@RequiresRoles,@RequiresPermissions)授权不起作用
- 我的shiro之旅: 一 shiro简介
- 我的shiro之旅: 七 shiro session 共享
- Android中在4.4 KitKat版本中设置Status Bar透明化处理
- SpringMVC常用基础知识
- Git
- python的一个小游戏之五子棋
- python unittest 实现输出HTML、XML测试报告
- 我的shiro之旅-注解方式授权
- MySQL单表百万数据记录分页性能优化
- .lib和.dll的区别和使用
- 使用java MapReduce job 批量导入大额数据到Hbase
- php session 管理
- 设计模式---工厂模式
- java中String s=”abc“及String s=new String("abc")
- Arch linux 的安装
- linux常用命令