如何为 SAML Google IDP 预填电子邮件?

How can I pre-fill email for SAML Google IDP?

我们正在为 SSO 使用 SAML 2.0,并希望通过允许用户仅输入一次电子邮件(以确定他们需要 SSO)来改进用户体验。使用 Google 的 SAML IDP 进行身份验证时是否可以预填 SAML SSO 电子邮件字段?

我知道 AuthnRequest 有一个可选的主题字段,可以将主体信息传递给 IdP,但到目前为止,我还没有设法预填充 Google 的 SSO 表单。 IdP 不支持它,或者我发送了错误的配置。

我一直在尝试使用的现有配置如下所示:

<AuthnRequest xmlns="urn:oasis:names:tc:SAML:2.0:protocol" ID="_cd...." Version="2.0" IssueInstant="2019-01-01T00:00:00Z" Destination="https://accounts.google.com/o/saml2/idp?idpid=...">
    <saml:Issuer xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">(issuer_name)</saml:Issuer>
    <Subject xmlns="urn:oasis:names:tc:SAML:2.0:assertion">
        <NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress">me@example.com</NameID>
    </Subject>
</AuthnRequest>

我希望 Google SSO 表单自动填充我@example.com,但没有任何反应。

Subject 元素在身份验证请求中是可选的,即使包含在内,它也会被大多数 IdP 忽略。由于身份验证请求可以由匿名方发送给身份提供者,因此执行您正在考虑的 UX 操作肯定会导致一个简单的网络钓鱼向量。