简体   繁体   English

Spring Security SAML2 未找到 entityID

[英]Spring Security SAML2 no entityID is found

I'm working to get my Spring Boot (v. 2.0.1) application working with an SSO provider.我正在努力让我的 Spring Boot (v. 2.0.1) 应用程序与 SSO 提供程序一起工作。 When I try to hit the login page, I get the following error:当我尝试点击登录页面时,出现以下错误:

No hosted service provider is configured and no alias was selected未配置托管服务提供商且未选择别名

and when I try to hit the discovery page, I get the following error:当我尝试点击发现页面时,出现以下错误:

Entity ID parameter must be specified必须指定实体 ID 参数

Both appear to be because of a missing entityID.两者似乎都是因为缺少 entityID。 It's not clear to me if it's the SP or IDP entityID that's missing.我不清楚是缺少 SP 还是 IDP entityID。 My application is setting the entityId in a bean as such:我的应用程序在 bean 中设置 entityId 如下:

@Bean
fun metadataGenerator():MetadataGenerator {
    val metadataGenerator = MetadataGenerator()
    metadataGenerator.entityId = "my:custom:entity:id"
    metadataGenerator.extendedMetadata = extendedMetadata()
    metadataGenerator.isIncludeDiscoveryExtension = true
    metadataGenerator.setKeyManager(keyManager())
    return metadataGenerator
}

And the IDP's metadata XML is being read (I can see it getting parsed at one point during start up) and contains an entityID.并且 IDP 的元数据 XML 正在被读取(我可以看到它在启动期间被解析)并包含一个 entityID。

Somewhere along the way, some entityID is getting lost and creating these errors.在此过程中,某些 entityID 丢失并产生了这些错误。 I can't seem to track down how that's happening.我似乎无法追踪这是如何发生的。

The missing entityID must be the IDP's.缺少的 entityID 必须是 IDP。

Have you setup your CachingMetadataManager properly?您是否正确设置了 CachingMetadataManager? Make sure the IDP is added as a MetadataProvider.确保将 IDP 添加为 MetadataProvider。 And the IDP's ExtendedMetadata must set idpDiscoveryEnabled to true并且 IDP 的 ExtendedMetadata 必须将 idpDiscoveryEnabled 设置为 true

In case you haven't checked, go take a look at the SP's metadata config at IDP.如果您还没有检查,请在 IDP 上查看 SP 的元数据配置。 Make sure SP you are using at the IDP is configured to the values from SP's metadata, eg: /saml/metadata.确保您在 IDP 使用的 SP 配置为来自 SP 元数据的值,例如:/saml/metadata。 Should be an xml content.应该是一个xml内容。 Ensure the two Locations, certData, and SingleLogoutService is correct.确保两个 Locations、certData 和 SingleLogoutService 是正确的。 This is the fix from my senior colleague.这是我的高级同事的修复。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM