【问题标题】:Spring SAML WSO2 Refresh AssertionSpring SAML WSO2 刷新断言
【发布时间】:2017-07-17 06:19:28
【问题描述】:

我已经使用 WSO2 配置了 Spring SAML 应用程序。当用户登录时,他检索到有效期等于 5 分钟的断言。但 5 分钟后,没有刷新断言发生。

断言过期后如何在页面重新加载时调用/saml/sso?也许您知道另一种解决方案?一些bean的特性?

maxAuthenticationAge 中的org.springframework.security.saml.websso.WebSSOProfileConsumerImpl 不起作用。

org.springframework.security.saml.websso.WebSSOProfileOptions 中的forceAuthN 不起作用。

【问题讨论】:

    标签: spring wso2 saml wso2is spring-saml


    【解决方案1】:

    首先,在AuthnStatement中的断言不是SessionNotOnOrAfter属性,所以过期时间是null。在这种情况下,我从 NotOnOrAfter 属性中的 Conditions 元素获取过期时间,恕我直言,它与 SessionNotOnOrAfter 应该具有相同的值。

    其次,为了安全起见,我从到期时间减去 1 分钟,以确保该断言将始终有效。

    解决方法是在自定义 SAMLAuthenticationProvider getExpirationDate 方法中覆盖:

    protected Date getExpirationDate(SAMLCredential credential) {
        List<AuthnStatement> statementList = credential.getAuthenticationAssertion().getAuthnStatements();
        DateTime expiration = null;
        for (AuthnStatement statement : statementList) {
            DateTime newExpiration = statement.getSessionNotOnOrAfter();
            if (newExpiration != null) {
                if (expiration == null || expiration.isAfter(newExpiration)) {
                    expiration = newExpiration;
                }
            }
        }
        if (expiration == null) {
            Conditions conditions = credential.getAuthenticationAssertion().getConditions();
            expiration = conditions.getNotOnOrAfter();
        }
        return expiration != null ? expiration.minusMinutes(1).toDate() : null;
    }
    

    【讨论】:

      猜你喜欢
      • 2013-01-23
      • 2021-12-14
      • 1970-01-01
      • 2021-05-07
      • 2016-11-06
      • 2017-05-12
      • 2016-04-19
      • 2016-01-25
      相关资源
      最近更新 更多