spring集成shiro的配置信息
2021-04-11 21:29
标签:访问 auth ati process com real frame enc tar 一.依赖的引入 二.spring的主配置文件中的配置 1.配置自定义realm,class指的是自定义realm的全限定名; 2.配置缓存,需要从shiro缓存包中导入类,property引用resources中的ehcache文件 3.配置shiro核心,可以在里面配置各种属性(注意引用的自定义realm要实现父类方法,不然会报错) 4.配置shro的生命周期 5.配置过滤器 三.web.xml文件中设置过滤器 spring集成shiro的配置信息 标签:访问 auth ati process com real frame enc tar 原文地址:https://www.cnblogs.com/yyk520/p/13358151.htmldependency>
groupId>org.apache.shirogroupId>
artifactId>shiro-coreartifactId>
version>1.3.2version>
exclusions>
exclusion>
groupId>org.slf4jgroupId>
artifactId>slf4j-apiartifactId>
exclusion>
exclusions>
dependency>
dependency>
groupId>org.apache.shirogroupId>
artifactId>shiro-webartifactId>
version>1.3.2version>
dependency>
dependency>
groupId>org.apache.shirogroupId>
artifactId>shiro-springartifactId>
version>1.3.2version>
dependency>
dependency>
groupId>org.apache.shirogroupId>
artifactId>shiro-ehcacheartifactId>
version>1.3.2version>
dependency>
bean id="jdbcRealm" class="com.woniu.ssm.realms.ShiroRealm">bean>
bean id="cacheManager" class="org.apache.shiro.cache.ehcache.EhCacheManager">
property name="cacheManagerConfigFile" value="classpath:ehcache.xml"/>
bean>
bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
property name="cacheManager" ref="cacheManager"/>
property name="realm" ref="jdbcRealm"/>
bean>
bean id="lifecycleBeanPostProcessor" class="org.apache.shiro.spring.LifecycleBeanPostProcessor"/>
bean class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator"
depends-on="lifecycleBeanPostProcessor"/>
bean class="org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor">
property name="securityManager" ref="securityManager"/>
bean>
bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">
property name="securityManager" ref="securityManager"/>
property name="loginUrl" value="/jsp/login.jsp"/>
property name="successUrl" value="/jsp/success.jsp"/>
property name="unauthorizedUrl" value="/jsp/unauthorized.jsp"/>
property name="filterChainDefinitions">
value>
/jsp/login.jsp = anon
/user/login = anon
/** = authc
value>
property>
bean>
filter>
filter-name>shiroFilterfilter-name>
filter-class>org.springframework.web.filter.DelegatingFilterProxyfilter-class>
init-param>
param-name>targetFilterLifecycleparam-name>
param-value>trueparam-value>
init-param>
filter>
filter-mapping>
filter-name>shiroFilterfilter-name>
url-pattern>/*url-pattern>
filter-mapping>
上一篇:排序算法好坏的评定
下一篇:4. python逻辑语句
文章标题:spring集成shiro的配置信息
文章链接:http://soscw.com/index.php/essay/74418.html