`
ErHuo
  • 浏览: 21546 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

SPRING+SHIRO集成配置

阅读更多
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:aop="http://www.springframework.org/schema/aop" xmlns:util="http://www.springframework.org/schema/util"
	xmlns:cache="http://www.springframework.org/schema/cache"
	xsi:schemaLocation="
	http://www.springframework.org/schema/beans 
	http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
	http://www.springframework.org/schema/tx 
	http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
	http://www.springframework.org/schema/aop 
	http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
	http://www.springframework.org/schema/util
	http://www.springframework.org/schema/util/spring-util-3.0.xsd
	http://www.springframework.org/schema/cache
	http://www.springframework.org/schema/cache/spring-cache.xsd
	">
	<!-- ehcache 的配置 -->
	<bean id="cacheManager"
		class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
		<property name="configLocation">
			<value>classpath:ehcache.xml</value>
		</property>
	</bean>
	<bean id="shiroCacheManager" class="org.apache.shiro.cache.ehcache.EhCacheManager"> 
    	<property name="cacheManager" ref="cacheManager"/> 
    </bean>
	<!-- shiro的配置 -->
	<bean id="myShiroRealm" class="com.btlh.shiro.MyShiroRealm">
		<!--  用来实现用户名密码的查询 -->
		<property name="sysUserService" ref="sysUserService"></property>
		<property name="authenticationCacheName" value="shiroAuthorizationCache"></property>
	</bean>
	<bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
		<property name="cacheManager" ref="shiroCacheManager" />  
		<property name="realm" ref="myShiroRealm" />
		<property name="sessionManager" ref="sessionManager" />
	</bean>
	<bean id="shiroSessionDao" class="org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO" />
	<bean id="sessionManager"
		class="org.apache.shiro.web.session.mgt.DefaultWebSessionManager">
		<!-- 超时时间 -->
		<property name="globalSessionTimeout" value="3600000" />
		<!-- session存储的实现 -->
		<property name="sessionDAO" ref="shiroSessionDao" />
		<!-- 定时检查失效的session -->
		<property name="sessionValidationSchedulerEnabled" value="true" />
	</bean>
	<bean id="lifecycleBeanPostProcessor" class="org.apache.shiro.spring.LifecycleBeanPostProcessor" />
	<bean id="formAuthenticationFilter"
		class="org.apache.shiro.web.filter.authc.FormAuthenticationFilter" />
	<bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">
		<property name="securityManager" ref="securityManager" />
		<property name="loginUrl" value="/login.jsp" />
		<property name="successUrl" value="/index.jsp" />
		<property name="unauthorizedUrl" value="/error.jsp" />
		<property name="filters">
			<util:map>
				<entry key="authc" value-ref="formAuthenticationFilter" />
			</util:map>
		</property>
		<property name="filterChainDefinitions">
			<value>
				/Kaptcha.jpg = anon
				/scripts/** = anon
				/#section-bar-1 = anon
				/#section-bar-2 = anon
				/fonts/** = anon
				/style/** = anon
				/images/** anon
				/login.jsp = anon
				/sys/login.action = anon
				/** = authc
	       </value>
		</property>
	</bean>
	
</beans>


分享到:
评论

相关推荐

    spring+springMVC+shiro 完美例子

    总之,这个"spring+springMVC+shiro 完美例子"是一个很好的学习资源,帮助开发者深入理解如何在Java Web应用中集成和使用这些强大的框架,实现安全、高效的权限管理。通过分析和实践这个例子,开发者不仅可以提升...

    springMVC+hibernate+spring+shiro整合例子

    5. **整合步骤**:在Spring配置中引入Hibernate和Shiro的相关bean,确保它们之间的依赖关系得到正确处理。同时,SpringMVC的Controller可以调用由Spring管理的Service层,而Service层则可以使用Hibernate进行数据...

    springmvc+mybatis+shiro jar包

    Spring MVC、MyBatis 和 Shiro 是三个在Java Web开发中广泛应用的开源框架。Spring MVC 是 Spring 框架的一部分,用于构建 MVC(Model-View-Controller)模式的Web应用程序,提供灵活的请求处理和视图渲染。MyBatis ...

    SpringMVC+Mybatis+Spring+Shiro+ehcache整合配置文件

    Shiro与Spring的集成使得安全控制更为便捷,可以在应用中实现权限控制、登录验证等。 Ehcache是一个流行的Java缓存解决方案,用于提高应用程序的性能。它可以缓存数据库查询结果、对象实例等,减少对后端存储的访问...

    Spring MVC+mybatis+easyui+ueditor+shiro权限框架管理系统

    《构建基于Spring MVC+MyBatis+EasyUI+UEditor+Shiro的权限管理框架系统》 在现代企业级Web应用开发中,高效、安全、易维护的框架选择至关重要。本项目采用Spring MVC、MyBatis、EasyUI、UEditor以及Shiro这五大...

    spring+shiro+ehcache例子

    项目简介:此项目只是简单的集成spring+springmvc+shiro+ehcahce 二: 步骤说明: 1:项目集成spring 在web.xml中配置spring容器的监听器。 2:项目集成springmvc 在web.xml中配置前端控制器 3:项目集成...

    spring boot+shiro 权限认证管理案例

    5. 集成 Session 管理:Shiro 可以与 Spring Session 集成,实现分布式会话管理,尤其在微服务环境中。 四、Shiro 缓存处理 为了提高性能,Shiro 支持缓存机制,可以在认证和授权过程中减少对数据库的访问。常见的...

    spring+mvc+jpa+shiro+hibernate+maven案例

    标题 "spring+mvc+jpa+shiro+hibernate+maven案例" 描述了一种集成多种技术的Web应用开发架构,其中包括Spring MVC、Spring JPA、Shiro、Hibernate以及Maven。这些技术都是Java开发中的关键组件,用于构建高效、安全...

    Springboot+Mybatis-plus+ SpringMvc+Shiro+Redis企业级报表后台管理系统

    在上家公司自己集成的一套系统,用了两个多月的时间完成的:Springboot+Mybatis-plus+ SpringMvc+Shiro+Redis企业级开发系统 Springboot作为容器,使用mybatis作为持久层框架 使用官方推荐的thymeleaf做为模板引擎...

    Spring+SpringMVC+MyBatis+Shiro+Maven集成web项目

    本项目以"Spring+SpringMVC+MyBatis+Shiro+Maven"为核心技术栈,旨在提供一个可直接使用的集成解决方案。接下来,我们将深入探讨这些技术及其集成的关键点。 首先,Spring框架作为Java企业级应用的核心,提供了依赖...

    spring +shiro+redis

    1. **Shiro的集成**:在Spring应用中集成Shiro,通常需要配置Shiro的Filter链,并将Shiro的Subject、SecurityManager等组件通过Spring的bean进行管理。这样,我们可以利用Spring的IoC和AOP能力来定制和控制Shiro的...

    Springboot+Mybatis-plus+ SpringMvc+Shiro+Redis企业级报表后台管理系统.rar

    shiro作为安全框架,主流技术 几乎零XML,极简配置 两套UI实现(bootstrap+layer ui),可以自由切换 报表后端采用技术: SpringBoot整合SSM(Spring+Mybatis-plus+ SpringMvc),spring security 全注解式的权限管理和...

    springboot+springdatajpa+thymeleaf+shiro 的管理平台框架

    Shiro的简单API和灵活的配置使其能轻松集成到SpringBoot项目中,实现细粒度的权限控制。 在"wechat_admin"这个压缩包中,包含了该管理平台的源代码。开发者可以通过阅读和学习这些代码,了解如何将上述技术融合在...

    springboot +shiro+redis实现session共享(方案二)1

    Shiro 是一个功能强大且灵活的权限控制框架,可以与 Spring Boot 集成以实现权限控制。在本方案中,Shiro 将用于实现登录 session 的统一。 6. Session 共享 通过使用 Redis 作为 Session 存储,多个应用服务器...

    spring+shiro权限整合

    3. 集成Spring:将Shiro配置到Spring应用上下文中,通过Spring的Bean定义来管理Shiro的组件,例如SecurityManager、FilterChainDefinitionMap等。 4. 自定义过滤器:配置Shiro的过滤器链,指定哪些URL需要经过哪个...

    shirodemo(spring3+shiro)(认证授权)

    在Spring3环境中,Shiro可以通过XML配置或Java配置进行集成。配置主要包括 Realm(认证和授权的数据源)、Filter Chain(定义URL过滤规则)等。在“shirodemo”项目中,你可以查看相关配置文件了解具体设置。 **6. ...

    spring boot+shiro

    综合以上,"spring boot+shiro"的项目旨在创建一个高效、灵活的权限管理系统,利用Spring Boot的便利性和Shiro的安全性,实现用户认证、权限控制以及与Oracle数据库的集成,以满足企业的权限管理需求。

    springMVC+mybatis+shiro+redis 项目整合demo

    这个"springMVC+mybatis+shiro+redis 项目整合demo"就是一个实例,展示了如何将这些技术集成到一个项目中,以实现高效的数据处理、用户认证授权和缓存管理。 首先,`SpringMVC` 是 Spring 框架的一部分,它是一个...

    springboot+shiro+cas+redis+mybatis+thymeleaf 集成开发框架

    由于项目需要从网上搜集的相关的集成框架,很多都是部分集成,一直没有找到整个流程全部集成好的,所以将集成好的框架分享出来供大家学习。 主要实现SSO、后台RBAC角色认证管理。 下载后需要自行修改配置,项目包内...

    springboot+shiro+redis整合

    3. **编写Shiro配置**:创建一个Shiro配置类,配置Realm(权限认证),并设置SessionManager使用RedisSessionDAO,以便将Session数据保存到Redis中。 4. **自定义Realm**:根据实际业务需求,实现自定义的...

Global site tag (gtag.js) - Google Analytics