Spring shiro使用
maven依赖:
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
</dependency> <dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-core</artifactId>
<version>1.2.3</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-ehcache</artifactId>
<version>1.2.3</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-web</artifactId>
<version>1.2.3</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-quartz</artifactId>
<version>1.2.3</version>
<exclusions>
<exclusion>
<groupId>org.opensymphony.quartz</groupId>
<artifactId>quartz</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-spring</artifactId>
<version>1.2.3</version>
</dependency>
设计的包:
核心包shiro-core 1.2.0 Web相关包shiro-web 1.2.0 缓存包shiro-ehcache 1.2.0 与spring整合包shiro-spring 1.2.0 Ehcache缓存核心包ehcache-core 2.5.3
第一步:配置web.xml
<!-- 配置Shiro过滤器,先让Shiro过滤系统接收到的请求 -->
<!-- 这里filter-name必须对应applicationContext.xml中定义的<bean id="shiroFilter"/> -->
<!-- 使用[/*]匹配所有请求,保证所有的可控请求都经过Shiro的过滤 -->
<!-- 通常会将此filter-mapping放置到最前面(即其他filter-mapping前面),以保证它是过滤器链中第一个起作用的 -->
<filter>
<filter-name>shiroFilter</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
<init-param>
<!-- 该值缺省为false,表示生命周期由SpringApplicationContext管理,设置为true则表示由ServletContainer管理 -->
<param-name>targetFilterLifecycle</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>shiroFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
http://my.oschina.net/miger/blog/283526
Spring shiro使用的更多相关文章
- Spring+shiro配置JSP权限标签+角色标签+缓存
Spring+shiro,让shiro管理所有权限,特别是实现jsp页面中的权限点标签,每次打开页面需要读取数据库看权限,这样的方式对数据库压力太大,使用缓存就能极大减少数据库访问量. 下面记录下sh ...
- Spring+Shiro搭建基于Redis的分布式权限系统(有实例)
摘要: 简单介绍使用Spring+Shiro搭建基于Redis的分布式权限系统. 这篇主要介绍Shiro如何与redis结合搭建分布式权限系统,至于如何使用和配置Shiro就不多说了.完整实例下载地址 ...
- spring + shiro + cas 实现sso单点登录
sso-shiro-cas spring下使用shiro+cas配置单点登录,多个系统之间的访问,每次只需要登录一次,项目源码 系统模块说明 cas: 单点登录模块,这里直接拿的是cas的项目改了点样 ...
- Spring shiro 初次使用小结
首先引入一段关于shiro的介绍: 开发系统中,少不了权限,目前java里的权限框架有SpringSecurity和Shiro(以前叫做jsecurity),对于SpringSecurity:功能太过 ...
- Spring+Shiro的踩坑
今天想给某个Service的某些方法添加Cache,这个记为A,用的springboot,照常在方法上加上Cacheable注解,测试缓存生效,搞定.然后再在第二个Service,记为B,添加Cach ...
- spring+shiro+ehcache整合
1.导入jar包(pom.xml文件) <!-- ehcache缓存框架 --> <dependency> <groupId>net.sf.ehcache</ ...
- spring+shiro+springmvc+maven权限卡控示例
项目结构 UserController , 主要负责用户登入和注销. LinewellController, 主要负责请求受权限卡控的数据. MyRealm,自定义realm. Authorizati ...
- spring shiro 集成
1.向spring项目中添加shiro相关的依赖 <dependency> <groupId>commons-logging</groupId> <artif ...
- Spring Shiro配置第三方SSO客户端登录
经过实践的Shiro配置,利用 sSOInterceptor 进行sso登录拦截 配置 @Configuration public class ShiroConfiguration extends B ...
随机推荐
- mysql-insert-返回主键id
function gen_this_insert_id($insert) { GLOBAL $link; $insert .= ' SELECT LAST_INSERT_ID();'; if (mys ...
- wajueji
#include<stdio.h>int map[3]={42,3,99};int step[3]={0};int max=99999;void qian(){ int i=0; int ...
- Delphi 如何操作外部程序的控件(如按钮,文本框,单选按钮等)
看你要做什么,比较现在网络很流行的QQ.MSN这些软件都屏蔽了,你可能还可以访问一些小软件的这些控制,思路及方案如下(API函数自己去百度查一下)1.得到你要这个窗口的句柄 使用FindWindow2 ...
- Architecture of a Highly Scalable NIO-Based Server
一. thread-per-connection The thread-per-connection approach uses an exclusive worker thread for each ...
- 创建podSpec,使用pod管理第三方库
提要: podfile文件会先读取.podspec文件,根据.podspec文件的指向来下载第三方库到项目中. 本文先通过一.二.三项,这三个步骤讲解了如何建立一个.podspec文件在本地.coco ...
- [LeetCode]题解(python):037-Sudoku Solver
题目来源 https://leetcode.com/problems/sudoku-solver/ Write a program to solve a Sudoku puzzle by fillin ...
- CS6破解
1) 序列号这里为大家生成了两个,可以通过软件验证:1325-0949-2080-9819-3777-32301325-0160-5283-9851-2671-8951 2) 破解补丁安装时会用到,请 ...
- jQuery动态对表格Table进行添加或删除行以及修改列值操作
jQuery,不仅可以以少量的代码做很多操作,而且兼容性好(各种浏览器,各种版本). 下面用jQuery动态对表格Table进行添加或删除行以及修改列值操作 1.jQuery代码 <script ...
- Sublime用户如何快速高效开发跨平台App
2015年9月15日,APICloud举办了一周年开源分享会,发布开源插件支持Sublime用户开发跨平台App,APICloud 开源技术负责人周兴海分享了Sublime关于插件方面相关的内容. S ...
- JBoss远程方法调用漏洞利用详解
早上起床打开微博看到空虚浪子心大神发的一篇有关Jboss漏洞的文章,对我等菜鸟来说那边文章看起来还是很吃力的,所以查了查国内外的资料,翻译写了这边文章,记录一下. 在JBoss服务器上部署web应用程 ...