maven依赖:

  1. <dependency>
  2. <groupId>commons-collections</groupId>
  3. <artifactId>commons-collections</artifactId>
  4. <version>3.2.1</version>
  5. </dependency>
  6.  
  7. <dependency>
  8. <groupId>org.apache.shiro</groupId>
  9. <artifactId>shiro-core</artifactId>
  10. <version>1.2.3</version>
  11. </dependency>
  12. <dependency>
  13. <groupId>org.apache.shiro</groupId>
  14. <artifactId>shiro-ehcache</artifactId>
  15. <version>1.2.3</version>
  16. </dependency>
  17. <dependency>
  18. <groupId>org.apache.shiro</groupId>
  19. <artifactId>shiro-web</artifactId>
  20. <version>1.2.3</version>
  21. </dependency>
  22. <dependency>
  23. <groupId>org.apache.shiro</groupId>
  24. <artifactId>shiro-quartz</artifactId>
  25. <version>1.2.3</version>
  26. <exclusions>
  27. <exclusion>
  28. <groupId>org.opensymphony.quartz</groupId>
  29. <artifactId>quartz</artifactId>
  30. </exclusion>
  31. </exclusions>
  32. </dependency>
  33. <dependency>
  34. <groupId>org.apache.shiro</groupId>
  35. <artifactId>shiro-spring</artifactId>
  36. <version>1.2.3</version>
  37. </dependency>

设计的包:

  1. 核心包shiro-core
  2.  
  3. 1.2.0
  4.  
  5. Web相关包shiro-web
  6.  
  7. 1.2.0
  8.  
  9. 缓存包shiro-ehcache
  10.  
  11. 1.2.0
  12.  
  13. spring整合包shiro-spring
  14.  
  15. 1.2.0
  16.  
  17. Ehcache缓存核心包ehcache-core
  18.  
  19. 2.5.3

第一步:配置web.xml

  1. <!-- 配置Shiro过滤器,先让Shiro过滤系统接收到的请求 -->
  2. <!-- 这里filter-name必须对应applicationContext.xml中定义的<bean id="shiroFilter"/> -->
  3. <!-- 使用[/*]匹配所有请求,保证所有的可控请求都经过Shiro的过滤 -->
  4. <!-- 通常会将此filter-mapping放置到最前面(即其他filter-mapping前面),以保证它是过滤器链中第一个起作用的 -->
  5. <filter>
  6. <filter-name>shiroFilter</filter-name>
  7. <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
  8. <init-param>
  9. <!-- 该值缺省为false,表示生命周期由SpringApplicationContext管理,设置为true则表示由ServletContainer管理 -->
  10. <param-name>targetFilterLifecycle</param-name>
  11. <param-value>true</param-value>
  12. </init-param>
  13. </filter>
  14. <filter-mapping>
  15. <filter-name>shiroFilter</filter-name>
  16. <url-pattern>/*</url-pattern>
  17. </filter-mapping>

http://my.oschina.net/miger/blog/283526

Spring shiro使用的更多相关文章

  1. Spring+shiro配置JSP权限标签+角色标签+缓存

    Spring+shiro,让shiro管理所有权限,特别是实现jsp页面中的权限点标签,每次打开页面需要读取数据库看权限,这样的方式对数据库压力太大,使用缓存就能极大减少数据库访问量. 下面记录下sh ...

  2. Spring+Shiro搭建基于Redis的分布式权限系统(有实例)

    摘要: 简单介绍使用Spring+Shiro搭建基于Redis的分布式权限系统. 这篇主要介绍Shiro如何与redis结合搭建分布式权限系统,至于如何使用和配置Shiro就不多说了.完整实例下载地址 ...

  3. spring + shiro + cas 实现sso单点登录

    sso-shiro-cas spring下使用shiro+cas配置单点登录,多个系统之间的访问,每次只需要登录一次,项目源码 系统模块说明 cas: 单点登录模块,这里直接拿的是cas的项目改了点样 ...

  4. Spring shiro 初次使用小结

    首先引入一段关于shiro的介绍: 开发系统中,少不了权限,目前java里的权限框架有SpringSecurity和Shiro(以前叫做jsecurity),对于SpringSecurity:功能太过 ...

  5. Spring+Shiro的踩坑

    今天想给某个Service的某些方法添加Cache,这个记为A,用的springboot,照常在方法上加上Cacheable注解,测试缓存生效,搞定.然后再在第二个Service,记为B,添加Cach ...

  6. spring+shiro+ehcache整合

    1.导入jar包(pom.xml文件) <!-- ehcache缓存框架 --> <dependency> <groupId>net.sf.ehcache</ ...

  7. spring+shiro+springmvc+maven权限卡控示例

    项目结构 UserController , 主要负责用户登入和注销. LinewellController, 主要负责请求受权限卡控的数据. MyRealm,自定义realm. Authorizati ...

  8. spring shiro 集成

    1.向spring项目中添加shiro相关的依赖 <dependency> <groupId>commons-logging</groupId> <artif ...

  9. Spring Shiro配置第三方SSO客户端登录

    经过实践的Shiro配置,利用 sSOInterceptor 进行sso登录拦截 配置 @Configuration public class ShiroConfiguration extends B ...

随机推荐

  1. Latex使用

    tex是一种文本格式化程序语言,通过使用各种命令,对文本进行排版定义,最后通过编译,生成美观的排版完毕的文档. 同html.css的组合很想,定义元素以及元素的显示属性,按照编写好的文本格式化内容,在 ...

  2. ArcGIS Server 服务迁移、恢复

    服务迁移与恢复 如果服务可以迁移,那么备份迁移所需文件,即可恢复原服务,所以"服务的迁移与恢复"."服务的备份"问题可以汇总为一个问题"怎样迁移服务. ...

  3. fortran中如何提供计算程序运行时间?

    如下: Real time_begin , time_end1 , time_end2 Integer i , j call CPU_TIME(time_begin) write(*,*) time_ ...

  4. spark mllib 之线性回归

    public static void main(String[] args) { SparkConf sparkConf = new SparkConf() .setAppName("Reg ...

  5. IOS 入门开发教程

    object-c: http://mobile.51cto.com/iphone-261129.htm Objective-C入门教材 Objective-C入门教材 2011-05-11 15:58 ...

  6. GZip压缩的js文件IE6下面不能包含<script>标签

    IE6下面,GZip压缩的js文件,如果js中包含<script>标签,一遇到这样的标签,后面的内容居然都截断了,狂晕! 花了我一个晚上来找原因.. 需要将字符串'<script&g ...

  7. 在使用EFCodeFirst中出现类型“System.Data.Objects.ObjectContext”在未被引用的程序集中定义的解决方案

    我安装了EF4.1版本,并在一个项目中映射一个数据库并生成了EF的MODEL实体层 测试:在Default.aspx页面上加了个GridView控件,后台进行绑定 using System; usin ...

  8. github中国版本coding.net 的部署和使用

    1.在coding.net注册帐号. 2.安装github,自己百度github软件然后安装. 3.打开coding.net 输入帐号后新建项目 创建项目 创建后,创建ssh公钥,如果不创建的话,在每 ...

  9. Github 与Git pages

    基础git命令 设置username,email $ git config --global user.name "your name" $ git config --global ...

  10. imx6 mac地址设置

    imx6的mac地址总是固定的值,所以需要更改,采用的方法是在uboot中设置环境变量,之后在kernel中使用uboot中设置的mac地址的值.本文记录更改的过程. 参考链接: http://www ...