6

我正在尝试 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

4

3 回答 3

6

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

于 2016-02-18T16:51:32.297 回答
0

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

saml.sp=http://fqdn-of-my.domain.com:8082/saml/metadataSpring 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 中重新部署它最终解决了这个问题。

于 2021-06-04T17:44:25.327 回答
0

在 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
于 2021-06-04T16:43:35.290 回答