0 0

通过Spring的方式做Shiro集成CAS出现循环重定向的问题20

CAS服务器配置没有问题。
1.普通的servlet项目做CAS客户端 OK
2.不用Spring,直接使用shiro.ini配置做的CAS客户端正常。

通过Spring来配置CAS客户端就出现循环重定向的问题。Debug根本不进CasRelam

大家碰到过这种问题吗,怎么解决的啊。

CAS服务器已经修改了,通过数据库来验证用户。

<?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:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation=" 
     http://www.springframework.org/schema/beans  
     http://www.springframework.org/schema/beans/spring-beans-3.2.xsd 
     http://www.springframework.org/schema/context  
     http://www.springframework.org/schema/context/spring-context-3.2.xsd 
     http://www.springframework.org/schema/util 
     http://www.springframework.org/schema/util/spring-util-3.2.xsd">

<bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
<property name="cacheManager" ref="cacheManager" />
<property name="realm" ref="myShiroRealm" />
<property name="subjectFactory" ref="casSubjectFactory" />
</bean>

<bean id="cacheManager" class="org.apache.shiro.cache.ehcache.EhCacheManager">
<!-- <property name="cacheManagerConfigFile" value="classpath:ehcache.xml"/> -->
</bean>

<bean id="lifecycleBeanPostProcessor" class="org.apache.shiro.spring.LifecycleBeanPostProcessor" />

<bean
class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator"
depends-on="lifecycleBeanPostProcessor">
<property name="proxyTargetClass" value="true" />
</bean>
<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="https://casserver:8443/cas/login?service=http://192.168.1.177:8080/spms" />
<property name="successUrl" value="/admin.jsp" />
<property name="unauthorizedUrl" value="/error/accessDenied.jsp" />
<property name="filters">
<util:map>
<entry key="casFilter" value-ref="casFilter" />
</util:map>
</property>
<property name="filterChainDefinitions">
<value>
/spms = casFilter
/error/* = anon
/common/* = anon
/login/**=anon
/randomcode = anon
/sys/login.do = anon
/sys/resetPwd.jsp = anon
/pwd/pwdReset.do = anon
/** = authc
</value>
</property>
</bean>

<bean id="casFilter" class="org.apache.shiro.cas.CasFilter">
<property name="failureUrl" value="/error/error.jsp" />
</bean>

<bean id="myShiroRealm" class="com.hmnet.spms.security.realm.MyCasShiroRealm">
<property name="defaultRoles" value="ROLE_USER" />
<property name="casServerUrlPrefix" value="https://casserver:8443/cas" />
<property name="casService" value="http://192.168.1.177:8080/spms" />
<property name="validationProtocol" value="SAML" />
</bean>

<bean id="casSubjectFactory" class="org.apache.shiro.cas.CasSubjectFactory" />
</beans>
2013年7月09日 10:52

2个答案 按时间排序 按投票排序

0 0

这个问题看是否是你的web.xml中配置是否有问题
我也遇到过这个问题,后来发现是web.xml中配置错误。

2014年6月05日 15:20
0 0

问题解决没啊 我也遇到这个问题 搞不定

2013年9月03日 18:59

相关推荐

Global site tag (gtag.js) - Google Analytics