spring-shiro.xml文件

<?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:aop="http://www.springframework.org/schema/aop"
	xmlns:tx="http://www.springframework.org/schema/tx" 
	xmlns:util="http://www.springframework.org/schema/util"
	xmlns:context="http://www.springframework.org/schema/context"
	xsi:schemaLocation="
       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
       http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
       http://www.springframework.org/schema/context 
       http://www.springframework.org/schema/context/spring-context.xsd">
	 <!-- shiro工厂bean配置 -->
     <bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">
         <!-- shiro的核心安全接口 -->
         <property name="securityManager" ref="securityManager"/>
         <!-- 要求登录时的连接 -->
         <property name="loginUrl" value="/loginUI.do"></property>
         <!-- 登录成功后要跳转的连接(此处已经在登录中处理了) -->
         <!-- <property name="successUrl" value="/index.jsp"></property> -->
         <!-- 访问未对其授权的资源时,要跳转的连接 
         <property name="unauthorizedUrl" value="/default.html"></property>-->
         <!-- shiro连接约束配置 -->
         <property name="filterChainDefinitions">
             <value>
                 <!-- 对静态资源设置允许匿名访问 -->
                 /images/** = anon
                 /js/** = anon
                 /css/** = anon
                 /static/** = anon
                 /bootstrap/** = anon
                 /jquery/** = anon
                 <!-- 可匿名访问路径,例如:验证码、登录连接、退出连接等 -->
                 /login.do = anon
                 <!-- 退出 -->
                 /logout.do = logout  <!-- 会调用Subject的logout方法,此方法会将session清空 -->
                 <!-- 剩余其他路径,必须认证通过才可以访问 -->
                 /** = authc
             </value>
         </property>
     </bean>
     <!-- 配置shiro安全管理器 -->
     <bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
         <property name="realm" ref="shiroUserRealm"></property>
     </bean>
     <!-- 自定义Realm -->
    <bean id="shiroUserRealm" class="cn.tedu.ttms.common.service.impl.ShiroUserRealm">
    	<!-- 配置凭证算法匹配器 -->
    	<property name="credentialsMatcher">
    		<bean class="org.apache.shiro.authc.credential.HashedCredentialsMatcher">
    			<property name="hashAlgorithmName" value="MD5"/>
    			<!-- <property name="hashIterations" value="1024"/> -->
    		</bean>
    	</property>
    </bean>
	<!--Shiro生命周期处理器-->
	<bean id="lifecycleBeanPostProcessor" class="org.apache.shiro.spring.LifecycleBeanPostProcessor"/>
	
</beans>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值