首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Spring安全SAML断言已过期

问Spring安全SAML断言已过期
EN

Stack Overflow用户
提问于 2015-10-26 17:33:14
回答 1查看 5.6K关注 0票数 0

服务提供者(Spring Security SAML)如何以及何时验证断言是否过期?我在and应用程序中创建并配置了一个服务提供商。我的身份提供者是ADFS2.0,进行身份验证并返回带有断言的SAML-response。这个断言有一个带有"NotBefore“和"NotOnOrAfter”标志的"Condition“。到目前为止,我的断言的有效期为1分钟。

当我通过身份验证时,我的客户端会话的有效期为10分钟。这意味着我的断言将在客户端会话仍然有效时过期。服务提供商是否应检测到我的断言已过期,并因此要求IDP重新进行身份验证?我遗漏了什么?

EN

回答 1

Stack Overflow用户

发布于 2015-10-26 20:29:09

我也遇到过你同样的问题,而且还在调查。这似乎是sp和isp之间的不同时间。你可以测试它扩展WebSSOProfileConsumerImpl,implementing verifyAssertion method.Here it代码注释:

代码语言:javascript
复制
@Override
protected void verifyAssertion(Assertion assertion, AuthnRequest request,   SAMLMessageContext context) throws AuthenticationException, SAMLException, org.opensaml.xml.security.SecurityException, ValidationException, DecryptionException {

    /*// Verify storage time skew
    if (!isDateTimeSkewValid(getResponseSkew(), getMaxAssertionTime(), assertion.getIssueInstant())) {
        throw new SAMLException("Assertion is too old to be used, value can be customized by setting maxAssertionTime value " + assertion.getIssueInstant());
    }*/

    // Verify validity of storage
    // Advice is ignored, core 574
    verifyIssuer(assertion.getIssuer(), context);
    verifyAssertionSignature(assertion.getSignature(), context);

    // Check subject
    if (assertion.getSubject() != null) {
        verifySubject(assertion.getSubject(), request, context);
    } else {
        throw new SAMLException("Assertion does not contain subject and is discarded");
    }

    // Assertion with authentication statement must contain audience restriction
    if (assertion.getAuthnStatements().size() > 0) {
        //verifyAssertionConditions(assertion.getConditions(), context, true);
        for (AuthnStatement statement : assertion.getAuthnStatements()) {
            if (request != null) {
                verifyAuthenticationStatement(statement, request.getRequestedAuthnContext(), context);
            } else {
                verifyAuthenticationStatement(statement, null, context);
            }
        }
    } else {
        verifyAssertionConditions(assertion.getConditions(), context, false);
    }

}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33342414

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档