2019独角兽企业重金招聘Python工程师标准>>>
guest(游客) <@shiro.guest> 您当前是游客,<a href="javascript:void(0);" class="dropdown-toggle qqlogin" >登录</a> </@shiro.guest> user(已经登录,或者记住我登录) <@shiro.user> 欢迎[<@shiro.principal/>]登录,<a href="/logout.shtml">退出</a> </@shiro.user> authenticated(已经认证,排除记住我登录的) <@shiro.authenticated> 用户[<@shiro.principal/>]已身份验证通过 </@shiro.authenticated> .notAuthenticated(和authenticated相反) <@shiro.notAuthenticated> 当前身份未认证(包括记住我登录的) </@shiro.notAuthenticated> return new SimpleAuthenticationInfo(user,user.getPswd(), getName()); 在new SimpleAuthenticationInfo(第一个参数,....)的第一个参数放的如果是一个username,那么就可以直接用 <@shiro. principal/> 取到username 如果第一个参数放的是对象,比如我喜欢放User对象。那么如果要取username字段。 <@shiro.principal property="username"/> 需要指定property- 判断是否拥有这个角色 <@shiro.hasRole name="admin"> 用户[<@shiro.principal/>]拥有角色admin<br/> </@shiro.hasRole> 判断是否拥有这些角色的其中一个 <@shiro.hasAnyRoles name="admin,user,member"> 用户[<@shiro.principal/>]拥有角色admin或user或member<br/> </@shiro.hasAnyRoles> .lacksRole标签(判断是否不拥有这个角色) <@shiro.lacksRole name="admin"> 用户[<@shiro.principal/>]不拥有admin角色 </@shiro.lacksRole> hasPermission标签(判断是否有拥有这个权限) <@shiro.hasPermission name="user:add"> 用户[<@shiro.principal/>]拥有user:add权限 </@shiro.hasPermission> lacksPermission标签(判断是否没有这个权限) <@shiro.lacksPermission name="user:add"> 用户[<@shiro.principal/>]不拥有user:add权限 </@shiro.lacksPermission>