【问题标题】:Error validating SAML message验证 SAML 消息时出错
【发布时间】:2016-05-30 17:53:59
【问题描述】:

我正在尝试 Java Tomcat SAML 的 Okta 快速入门,我对这个主题非常陌生。
当我启动我的测试应用程序时,我确实看到了一个指向 Okta IDP 的链接,在单击“开始单点登录”按钮后,我被重定向到 Okta 地址,其信息为“Sining in to SAML - Test”(我的 Okta 测试名称)之后我再次被重定向到我的应用程序:
Error Error validating SAML message
之后有一个堆栈跟踪
Caused by: org.opensaml.common.SAMLException: Response doesn't have any valid assertion which would pass subject validation at org.springframework.security.saml.websso.WebSSOProfileConsumerImpl.processAuthenticationResponse(WebSSOProfileConsumerImpl.java:229) at org.springframework.security.saml.SAMLAuthenticationProvider.authenticate(SAMLAuthenticationProvider.java:82) ... 27 more Caused by: org.opensaml.common.SAMLException: Local entity is not the intended audience of the assertion in at least one AudienceRestriction at org.springframework.security.saml.websso.WebSSOProfileConsumerImpl.verifyAudience(WebSSOProfileConsumerImpl.java:506) at org.springframework.security.saml.websso.WebSSOProfileConsumerImpl.verifyAssertionConditions(WebSSOProfileConsumerImpl.java:458) at org.springframework.security.saml.websso.WebSSOProfileConsumerImpl.verifyAssertion(WebSSOProfileConsumerImpl.java:303) at org.springframework.security.saml.websso.WebSSOProfileConsumerImpl.processAuthenticationResponse(WebSSOProfileConsumerImpl.java:214) ... 28 more
我错过了什么?我究竟做错了什么?
感谢您对 Zack 的所有帮助。

【问题讨论】:

    标签: saml-2.0 spring-saml okta


    【解决方案1】:

    您的 Spring SAML 服务提供者的实体 ID 与来自 Okta 的 SAML 响应中的目标元素不匹配。比较这两个值并在 Spring SAML 或 Okta 端修复该值。

    【讨论】:

    • 获得与 ADFS 3.0 相同的异常。 Spring SAML SP 应用程序的实体 ID 与回复方的信任标识符匹配。仅当应用程序部署在远程服务器上时才会发生异常(在 localhost 上工作正常)。请提出一些修复建议。
    • 相同.. 仅当应用程序部署在远程服务器上时才会发生异常
    【解决方案2】:

    在 Azure 容器实例中部署 Spring Boot 应用并使用 Okta SAML 时出现同样的问题。 saml.sp=http://fqdn-of-my.domain.com:8082/saml/metadata,由 AWS 托管的 DNS 区域 A 记录解析的 FQDN,URL 本身可访问并下载 spring_saml_metadata.xml。

    Caused by: org.opensaml.common.SAMLException: Local entity is not the intended audience of the assertion in at least one AudienceRestriction
            at org.springframework.security.saml.websso.WebSSOProfileConsumerImpl.verifyAudience(WebSSOProfileConsumerImpl.java:542)
            at org.springframework.security.saml.websso.WebSSOProfileConsumerImpl.verifyAssertionConditions(WebSSOProfileConsumerImpl.java:494)
            at org.springframework.security.saml.websso.WebSSOProfileConsumerImpl.verifyAssertion(WebSSOProfileConsumerImpl.java:339)
            at org.springframework.security.saml.websso.WebSSOProfileConsumerImpl.processAuthenticationResponse(WebSSOProfileConsumerImpl.java:250)
            ... 53 more
    

    【讨论】:

      【解决方案3】:

      30 分钟后更新:我注意到在重建和重新部署应用程序后错误消失了!!

      saml.sp=http://fqdn-of-my.domain.com:8082/saml/metadata在Spring application.properties中,同一URL可用的SP元数据原来如下,报错:

      <?xml version="1.0" encoding="UTF-8"?>
      <md:EntityDescriptor 
        xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" 
        ID="http___localhost_8082_saml_metadata" 
        entityID="http://localhost:8082/saml/metadata">
      

      使用如下元数据重建和重新部署应用程序导致握手成功:

      <?xml version="1.0" encoding="UTF-8"?>
      <md:EntityDescriptor 
        xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" 
        ID="http___fqdn-of-my.domain.com_8082_saml_metadata" 
        entityID="http://fqdn-of-my.domain.com:8082/saml/metadata">
      

      我很确定我已经正确设置了属性,即使它给出了错误。但无论如何,重建 Dockerized Spring 应用程序并在 Azure 中重新部署该应用程序最终解决了问题。

      【讨论】:

        猜你喜欢
        • 2020-05-19
        • 2023-03-04
        • 2017-05-05
        • 2017-10-01
        • 2017-05-05
        • 2014-07-28
        • 1970-01-01
        • 1970-01-01
        • 2015-11-01
        相关资源
        最近更新 更多