你的位置:
首页
>
软件开发 >
Java > Apache Shiro 使用手册(三)Shiro 授权
Apache Shiro 使用手册(三)Shiro 授权
发布时间:2015-06-24 00:00:26
授权即访问控制,它将判断用户在应用程序中对资源是否拥有相应的访问权限。 如,判断一个用户有查看页面的权限,编辑数据的权限,拥有某一按钮的权限,以及是否拥有打印的权限等等。一、授权的三要素授权有着三个核心元素:权限、角色和用户。权限权限是Apache Shiro安全机制最核心的元素 ...
授权即访问控制,它将判断用户在应用程序中对资源是否拥有相应的访问权限。 一、授权的三要素授权有着三个核心元素:权限、角色和用户。权限权限声明及粒度角色二、授权实现Shiro支持三种方式实现授权过程:1.1基于传统角色授权实现类似基于对象的实现相关方法,基于字符串的实现相关方法:基于权限对象的断言实现相关的注解:@ RequiresPermissions@ RequiresUser3、基于JSP TAG的授权实现
- <shiro:guest>
- Hi there! Please <a href="login.jsp">Login</a> or <a href="signup.jsp">Signup</a> today!
- </shiro:guest>
- <shiro:user>
- Welcome back John! Not John? Click <a href="login.jsp">here<a> to login.
- </shiro:user>
- <shiro:authenticated>
- <a href="updateAccount.jsp">Update your contact information</a>.
- </shiro:authenticated>
- <shiro:notAuthenticated>
- Please <a href="login.jsp">login</a> in order to update your credit card information.
- </shiro:notAuthenticated>
- Hello, <shiro:principal/>, how are you today?
- <shiro:hasRole name="administrator">
- <a href="admin.jsp">Administer the system</a>
- </shiro:hasRole>
- <shiro:lacksRole name="administrator">
- Sorry, you are not allowed to administer the system.
- </shiro:lacksRole>
- <shiro:hasAnyRoles name="developer, project manager, administrator">
- You are either a developer, project manager, or administrator.
- </shiro:lacksRole>
- <shiro:hasPermission name="user:create">
- <a href="createUser.jsp">Create a new User</a>
- </shiro:hasPermission>
- <shiro:hasPermission name="user:create">
- <a href="createUser.jsp">Create a new User</a>
- </shiro:hasPermission>
三、Shiro授权的内部处理机制当使用多个Realm时,不同于认证策略处理方式,授权处理过程中:
原标题:Apache Shiro 使用手册(三)Shiro 授权
关键词:Apache
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。
Google Play:https://www.ikjzd.com/w/1573207293387251714
博客营销:https://www.ikjzd.com/w/1573207293970604034
国际小包:https://www.ikjzd.com/w/1573207294473576449
B2B营销:https://www.ikjzd.com/w/1573207294985625602
节日营销:https://www.ikjzd.com/w/1573207295526346753
跨境结算:https://www.ikjzd.com/w/1573207296092577793
长治婚庆女司仪和主持人:https://www.vstour.cn/a/366176.html
北京丰台区水上乐园哪家好玩?:https://www.vstour.cn/a/366177.html