SAML Spring安全会话超时

时间:2016-04-12 15:41:15

标签: spring-security saml spring-saml

我已经配置了SAML SSO,它运行正常。当会话过期时,它会在日志中给出以下内容。

2017-04-15 15:14:16,933 [http-nio-7070-exec-8] INFO  org.springframework.boot.actuate.audit.listener.AuditListener - AuditEvent [timestamp=Sat Apr 15 15:14:16 IST 2017, principal=anonymousUser, type=AUTHORIZATION_FAILURE, data={message=Access is denied, type=org.springframework.security.access.AccessDeniedException}]
2017-04-15 15:14:17,035 [http-nio-7070-exec-8] INFO  org.springframework.security.saml.log.SAMLDefaultLogger - AuthNRequest;SUCCESS;0:0:0:0:0:0:0:1;com.hbo.sso:portal;http://www.okta.com/xxxxxxx;;;

这是我的 spring-security.xml

<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:security="http://www.springframework.org/schema/security"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd">

    <import resource="classpath*:applicationContext-saml.xml" />

    <security:http  entry-point-ref="samlEntryPoint" use-expressions="true">
       <security:intercept-url .... />
       /* Logging out user */
       <security:intercept-url pattern="/${myapp.logout.url}" access="permitAll()"/>
    </security:http>

</beans>  

1 个答案:

答案 0 :(得分:1)

当会话过期时,会自动清除spring会话,因此它会抛出Access Denied Exception,解决方案可能是1.在spring-security.xml中添加访问被拒绝的页面重定向详细信息。 e.g。

<security:http > <security:access-denied-handler error-page="/anonymous/accessdeniedpage.jsp"/> </security:http> 要么 2.如果IDP允许配置/重定向页面在会话超时,则将其映射到您的登录页面。