我需要使用CAS来保护我的RESTful无状态网络服务,现在我正在尝试关注此Spring Stateless CAS演示,但不断收到以下错误:
22:42:27.885 [http-nio-8443-exec-8] [first-spring-stateless] DEBUG o.s.s.c.web.CasAuthenticationFilter - Authentication request failed: org.springframework.security.authentication.BadCredentialsException:
The supplied proxy callback url 'https://localhost:8443/first-spring-stateless/j_spring_cas_security_proxyreceptor' could not be authenticated.
访问https://localhost:8443/first-spring-cas/testProxy.do
网址时
这是我的appointmentServiceUrl
- https://localhost:8443/first-spring-stateless/appointment.jsp?ticket=PT-110-a2a6eOE3lwImcwGpZ2Jp-cas.example.com
这可能是什么原因?
答案 0 :(得分:1)
添加
解决<property name="proxyReceptorUrl" value="/j_spring_cas_security_proxyreceptor"/>
到casFilter
这是casFilter
中的applicationContext-security.xml
:
<bean id="casFilter"
class="org.springframework.security.cas.web.CasAuthenticationFilter">
<property name="authenticationManager" ref="authenticationManager"/>
<property name="proxyGrantingTicketStorage" ref="pgtStorage"/>
<property name="serviceProperties" ref="serviceProperties"/>
<property name="proxyReceptorUrl" value="/j_spring_cas_security_proxyreceptor"/>
<property name="authenticationDetailsSource">
<bean class="org.springframework.security.cas.web.authentication.ServiceAuthenticationDetailsSource"/>
</property>
</bean>