shiro默认filter

2022-03-28 19:10:52 浏览数 (1)

使用过shiro的对下面的配置一定不会陌生,

代码语言:javascript复制
[urls]

 /logout2=logout
 /login=anon
 /logout=anon
 /unauthorized=anon
 /static/**=anon
 /authenticated=authc
 /role=authc,roles[admin]
  
/permission=authc,perms["user:create"]

但是里面的anon以及authc到底指什么呢,就像spring security一样,shiro在启动时也会创建一些默认filter,下面就是shiro默认filter列表:

Filter Name

Class

anon

org.apache.shiro.web.filter.authc.AnonymousFilter

authc

org.apache.shiro.web.filter.authc.FormAuthenticationFilter

authcBasic

org.apache.shiro.web.filter.authc.BasicHttpAuthenticationFilter

logout

org.apache.shiro.web.filter.authc.LogoutFilter

noSessionCreation

org.apache.shiro.web.filter.session.NoSessionCreationFilter

perms

org.apache.shiro.web.filter.authz.PermissionsAuthorizationFilter

port

org.apache.shiro.web.filter.authz.PortFilter

rest

org.apache.shiro.web.filter.authz.HttpMethodPermissionFilter

roles

org.apache.shiro.web.filter.authz.RolesAuthorizationFilter

ssl

org.apache.shiro.web.filter.authz.SslFilter

user

org.apache.shiro.web.filter.authc.UserFilter

至于上面每个filter的作用,感兴趣的可以调试跟踪~

0 人点赞