gpt4 book ai didi

single-sign-on - SAML 2.0 是否允许将 SP 数据发送到 IdP?

转载 作者:行者123 更新时间:2023-12-02 03:43:40 25 4
gpt4 key购买 nike

我正在阅读 SAML 规范并尝试使用 KeycloakShibboleth IdP,但我不确定如何在 SP 发起的登录中实现一项功能。

我有一项服务,传统上在其登录页面上显示 SP 状态信息(例如应用程序版本、状态)。切换到使用 IdP 登录页面后,我希望继续在 IdP 的登录页面上显示此类每个 SP 的附加信息。我对数据交换感兴趣,而不是对登录页面本身进行模板化。

SAML 2.0 规范是否允许向 IdP 发送任意数据以进行登录?如果没有,还有哪些其他选项可用于使用 SP 生成的数据来装饰 IdP 登录页面?

最佳答案

有点。从 SP 到 IdP 的身份验证请求允许具有“自定义”扩展(Extensions 父元素),扩展的内容由您决定。从规范来看:

[Optional] This extension point contains optional protocol message extension elements that are agreed on between the communicating parties. No extension schema is required in order to make use of this extension point, and even if one is provided, the lax validation setting does not impose a requirement for the extension to be valid. SAML extension elements MUST be namespace-qualified in a non-SAML-defined namespace.

如果您正在编写自己的 IdP,您当然可以使用扩展并用它做任何您想做的事情。 “标准”(商业/OSS)IdP 不会知道如何处理您的扩展。看看 Shibboleth 或 Keycloak 库是否解析 Extensions 元素并为您提供内容将是一个有趣的测试。

另一种更标准的可能性是使用 RelayState。这是一种符合规范的方式,用于传递一些特定于提供者的状态信息,包括。从 SP 到 IdP:

3.1.1 Use of RelayState Some bindings define a "RelayState" mechanism for preserving and conveying state information. When such a mechanism is used in conveying a request message as the initial step of a SAML protocol, it places requirements on the selection and use of the binding subsequently used to convey the response. Namely, if a SAML request message is accompanied by RelayState data, then the SAML responder MUST return its SAML protocol response using a binding that also supports a RelayState mechanism, and it MUST place the exact RelayState data it received with the request into the corresponding RelayState parameter in the response.

同样,所有 IdP 或 downstack 库都会解析 RelayState,但它们如何处理它取决于它们对规范的阅读。首先,规范要求 RelayState 为 80 字节,并通过签名或“其他方式”进行完整性保护。 IdP 和 SP 经常忽略此限制。

您想要在 IdP 登录页面上显示哪些特定于 SP 的信息?

关于single-sign-on - SAML 2.0 是否允许将 SP 数据发送到 IdP?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56852143/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com