我在获取Spring SAML集成时遇到问题,为我的IdP生成正确的元数据文件.我获得了新的SHA256 SSL证书.我已经完成了创建相应keyStore的所有步骤,并将我的Spring安全配置文件全部设置完毕.我确实有98%的方式,但生成的元数据文件中缺少一件事,我不能为我的生活弄清楚为什么它没有设置.
这是MetadataGeneratorFilter的ExtendedMetadata配置:
<bean id="metadataGeneratorFilter" class="org.springframework.security.saml.metadata.MetadataGeneratorFilter">
<constructor-arg>
<bean class="org.springframework.security.saml.metadata.MetadataGenerator">
<property name="entityId" value="urn:myentityidhere"/>
<property name="entityBaseURL" value="https://${saml.url}"/>
<property name="extendedMetadata">
<bean class="org.springframework.security.saml.metadata.ExtendedMetadata">
<property name="signMetadata" value="true"/>
<property name="signingAlgorithm" value="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
<property name="alias" value="ceo"/>
<property name="signingKey" value="${saml.sp.alias}"/>
<property name="encryptionKey" value="${saml.sp.alias}"/>
</bean>
</property>
</bean>
</constructor-arg>
Run Code Online (Sandbox Code Playgroud)
当我运行我的应用程序并转到/ saml/metadata URI以获取Spring生成我需要发送到我的IdP的元数据文件时,SHA256算法在SignatureMethod上正确设置,但子DigestMethod标记的算法值仍然设置到SHA1,当我需要将ALSO设置为SHA256以及DigestValue作为SHA256值而不是SHA1值.
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
<ds:Reference URI="#urn_myentityidhere">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<ds:DigestValue>xxxxxxx</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
Run Code Online (Sandbox Code Playgroud)
有人可以指导我如何/我需要设置什么来将DigestMethod算法值设置为256?我想,因为它是SignedInfo标记的子代,它将从Extendedmetadata配置继承signedAlgorithm值,但实际上并非如此.
任何帮助将不胜感激.非常感谢.
解决方案 - 万一有人关心
因此,经过一天的挖掘,我决定自己实施.我通过添加字段digestMethodAlgorithm扩展了ExtendedMetadata类,并添加了适当的getter/setter:
/**
* Algorithm used for creation of digest method of this entity. At the …Run Code Online (Sandbox Code Playgroud) 我正在努力将Spring SAML Extension集成到我们的应用程序中,并将SSO与我们客户的ADFS2.0之一作为IDP,我们从我们的应用程序生成服务提供程序元数据并将ADFS元数据导入我们的appliaction.When我选择客户端idp然后单击开始单一符号并提供正确的客户端凭据,我们将看到SAML响应,如下所示:
Saml回应.
<samlp:Response xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" Consent="urn:oasis:names:tc:SAML:2.0:consent:unspecified"
Destination="https://sso.spire2grow.com:8443/<our application>/saml/SSO" ID="_d7fa7cb7-a858-4d4e-aa4c-bf7a5d11e485"
InResponseTo="a2icei36d347di68gi33534cc13fd1" IssueInstant="2014-09-30T14:17:21.819Z" Version="2.0"><Issuer
xmlns="urn:oasis:names:tc:SAML:2.0:assertion"><Clients ADFS trust services URL></Issuer><samlp:Status><samlp:StatusCode
Value="urn:oasis:names:tc:SAML:2.0:status:Responder"></samlp:StatusCode></samlp:Status></samlp:Response>
Run Code Online (Sandbox Code Playgroud)
但我也看到以下异常被抛出,因为服务提供商无法验证消息.
异常消息:
[351545]2014-09-30 19:47:21,714 DEBUG - SAML message intended destination endpoint matched recipient endpoint
[351545]2014-09-30 19:47:21,714 DEBUG - Authentication attempt using org.springframework.security.saml.SAMLAuthenticationProvider
[351545]2014-09-30 19:47:21,715 DEBUG - Error validating SAML message
org.opensaml.common.SAMLException: Response has invalid status code urn:oasis:names:tc:SAML:2.0:status:Responder, status message is null
at org.springframework.security.saml.websso.WebSSOProfileConsumerImpl.processAuthenticationResponse(WebSSOProfileConsumerImpl.java:113)
at org.springframework.security.saml.SAMLAuthenticationProvider.authenticate(SAMLAuthenticationProvider.java:82)
at org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:156)
at org.springframework.security.saml.SAMLProcessingFilter.attemptAuthentication(SAMLProcessingFilter.java:84)
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:195)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
Run Code Online (Sandbox Code Playgroud)
如果我在这里做任何事情,请指出任何人.
更新:
看到为这个问题提供的答案后,我看到了ADFS的以下错误.
Microsoft.IdentityServer.Protocols.Saml.SamlProtocolSignatureAlgorithmMismatchException: MSIS7093: The message is …Run Code Online (Sandbox Code Playgroud) 我正在开发Spring SAML和Microsoft ADFS 3.0之间的集成.即使它已经在Spring SAML的文档中说明如下:
通过双击打开提供程序,选择选项卡Advanced并将"Secure hash algorithm"更改为SHA-1
据我所知,Spring SAML目前只支持SHA-1作为哈希算法,但我的要求是使用SHA-256.如果我尝试仅在ADFS中配置SHA-256,则它不起作用.我想我必须对Spring SAML做点什么.你知道怎么做吗?
我在使用我们的平台与客户设置 SAML 集成方面花费了相当多的时间。我们使用OneLogin 的 php sdk作为服务提供商。不确定他们使用什么作为身份提供者,或者它是否是自定义的。
似乎无论我们做什么,我们从他们那里收到的 AuthN 响应都会具有以下状态:urn:oasis:names:tc:SAML:2.0:status:Responder
正如我在这里读到的那样,这意味着他们这边存在问题(我们不知道是什么)。相当于 php 中的 500 状态。
与我一起工作的人确信这是配置不匹配的问题。要么他们没有提供正确的声明,要么没有签署我们要求他们签署的部分,等等。
但如果是这样的话...他们不会仍然向我们发送成功状态的响应吗?如果他们没有正确签署,我们这边可能会出现错误。但我没想到会收到他们的“响应者”状态。
任何人都可以确认我做出了正确的假设或纠正我的错误吗?
我试图运行https://github.com/spring-projects/spring-security-saml(主版本)提供的应用程序,并使用adfs作为idp,并遵循文档中给出的所有步骤。我收到以下错误
org.opensaml.saml2.metadata.impl.AssertionConsumerServiceImpl@7a033ee2 for request URL https://localhost:8443/spring-security-saml2-sample3/saml/SSO based on location attribute in metadata
- Authentication attempt using org.springframework.security.saml.SAMLAuthenticationProvider
- Error validating SAML message
org.opensaml.common.SAMLException: Response has invalid status code urn:oasis:names:tc:SAML:2.0:status:Responder, status message is null
at org.springframework.security.saml.websso.WebSSOProfileConsumerImpl.processAuthenticationResponse(WebSSOProfileConsumerImpl.java:113)
at org.springframework.security.saml.SAMLAuthenticationProvider.authenticate(SAMLAuthenticationProvider.java:87)
at org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:156)
Run Code Online (Sandbox Code Playgroud)