Shiro

扫码查看

Apache Shiro

ShiroFilterFactoryBean

全局URL配置

  • loginUrl
  • successUrl
  • unauthorizedUrl

FilterChainDefinition

以上配置等价于 url = filter1[op1], ..., filterN[opN], 一条连接中配置的多个filter组成一条filterChain.

如: /index.htmlfilterChiananon(AnonymousFilter)组成

当浏览器发起请求时候通过url匹配来选择所需要的filterChain达到权限过滤的目的.

Shiro Filter

anon匿名过滤器o.a.s.w.f.authc.AnonymousFilter
authc如果继续操作,需要做对应的表单验证否则不能通过o.a.s.w.f.authc.FormAuthenticationFilter
authcBasic基本http验证过滤如果不通过,跳转屋登录页面o.a.s.w.f.authc.BasicHttpAuthenticationFilter
logout登录退出过滤器o.a.s.w.f.authc.LogoutFilter
noSessionCreation没有session创建过滤器o.a.s.w.f.session.NoSessionCreationFilter
perms权限过滤器o.a.s.w.f.authz.PermissionsAuthorizationFilter
port端口过滤器,可以设置是否是指定端口如果不是跳转到登录页面o.a.s.w.f.authz.PortFilter
resthttp方法过滤器,可以指定如post不能进行访问等o.a.s.w.f.authz.HttpMethodPermissionFilter
roles角色过滤器,判断当前用户是否指定角色o.a.s.w.f.authz.RolesAuthorizationFilter
ssl请求需要通过ssl,如果不是跳转回登录页o.a.s.w.f.authz.SslFilter
user如果访问一个已知用户,比如记住我功能,走这个过滤器o.a.s.w.f.authc.UserFilter

原文:大专栏  Shiro


01-18 23:52
查看更多