shiro学习笔记(5)——shiro与项目整合+xml配置

5 shiro与项目整合

 5.1 需求

将原来基于url的工程改成使用shiro实现。

 5.2 创建新工程

创建web工程 :permission_shiro1110

 

​​​​​​​ ​​​​​​​5.3 去除原工程 的认证和授权的拦截

 

删除springmvc.xml中:

<mvc:interceptors>

 

 ​​​​​​​5.4 jar包

包括 :

shiro-web的jar、

shiro-spring的jar

shiro-code的jar

 

​​​​​​​​​​​​​​5.5 web.xml中配置shiro的filter

在web系统中,shiro也通过filter进行拦截。filter拦截后将操作权交给spring中配置的filterChain(过虑链儿)

shiro提供很多filter。

 

在web.xml中配置filter

 

 

​​​​​​​5.6 applicationContext-shiro.xml

 

在applicationContext-shiro.xml 中配置web.xml中fitler对应spring容器中的bean。

​​​​​​​​​​​​​​5.7 静态资源

 

对静态资源设置逆名访问:

修改applicationContext-shiro.xml:

 

猜你喜欢

转载自blog.csdn.net/xinpz/article/details/81460170