【发布时间】:2021-11-26 14:37:59
【问题描述】:
我使用this 工具对其进行了测试,发现我需要身份验证类型:Form 和令牌请求:SAML-P (SAML2.0),但我不需要'不知道如何配置 spring-security 以发送 RequestedAuthenticationContext 作为 urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport 而不是 urn:oasis:names: tc:SAML:2.0:ac:classes:Kerberos 在 SAML 请求中。
所以不是这样:
- 身份验证类型:Windows 集成身份验证
- 令牌请求: SAML-P (SAML 2.0)
- 对 IdP 的请求: GET https://ospa.company.com/adfs/ls/IdpInitiatedSignOn? LoginToRP=urn:microsoft:adfs:claimsxray& RequestedAuthenticationContext=urn:oasis:names:tc:SAML:2.0:ac:classes:Kerberos
- 来自 IdP 的回复:
<samlp:Response ID="..."
Version="2.0"
IssueInstant="..."
Destination="https://adfshelp.microsoft.com/ClaimsXray/TokenResponse"
Consent="urn:oasis:names:tc:SAML:2.0:consent:unspecified"
xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol">
...
<AuthnStatement AuthnInstant="..." SessionIndex="...">
<AuthnContext>
<AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:Kerberos</AuthnContextClassRef>
</AuthnContext>
</AuthnStatement>
</Assertion>
</samlp:Response>
我需要这个:
- 身份验证类型:表单
- 令牌请求: SAML-P (SAML 2.0)
- 对 IdP 的请求: GET https://ospa.company.com/adfs/ls/IdpInitiatedSignOn? LoginToRP=urn:microsoft:adfs:claimsxray& RequestedAuthenticationContext=urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport
- 来自 IdP 的回复:
<samlp:Response ID="..."
Version="2.0"
IssueInstant="..."
Destination="https://adfshelp.microsoft.com/ClaimsXray/TokenResponse"
Consent="urn:oasis:names:tc:SAML:2.0:consent:unspecified"
xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol">
...
<AuthnStatement AuthnInstant="..." SessionIndex="...">
<AuthnContext>
<AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport</AuthnContextClassRef>
</AuthnContext>
</AuthnStatement>
</Assertion>
</samlp:Response>
更新: 我们使用spring-boot 2.5.5
【问题讨论】:
-
您使用的是最新的 Spring Security,它附带 SAML 支持吗? (也有一个已弃用的
spring-security-saml插件,这就是我问的原因。)另外,我是否正确理解您是一个希望 Spring Security 重定向到您描述的端点以启动身份验证的 SP? -
我们有一个通用的spring boot lib,使用的是2.2.5.RELEASE版本的spring boot。只有在必要时,我才能升级补丁版本。 spring-security-saml2-service-provider 的版本是 5.2.2.RELEASE。我们不使用 saml 插件。
-
你描述的案例正是我们想要达到的。
-
如果不能这样解决,我可以跳过common lib,在主应用中使用最新的spring security。
-
当然,如果我能在公共库中以某种方式解决这个问题,那将是最好的。
标签: spring-boot spring-security saml saml-2.0