WSO2 Identify Server 能否发回 SAML 响应的 NameID 中的电子邮件地址?

Can WSO2 Identify Server send back the email address in the NameID of a SAML response?

我正在尝试使用云应用程序配置 WSO2 身份服务器。

到目前为止我已经做到了:

  1. 云应用程序被重定向到 WSO2 IS 并且它的登录页面出现了。
  2. WSO2 IS 登录已成功通过 LDAP 支持的辅助用户存储进行身份验证。

但是云APP登录还是失败。我认为这是因为 SAML 响应具有用户名,而云应用程序需要用户电子邮件地址而不是用户名。我这样说是因为您在云应用程序中配置用户时使用的是他们的电子邮件地址而不是用户名。

所以无论如何你可以让 WSO2 IS 到 return 电子邮件地址而不是用户名。我附上 SAML 来说明我的意思,我希望我的电子邮件地址在 <saml:NameID> 字段中被 returned 而不是我的用户名 smith.

<?xml version="1.0" encoding="UTF-8"?>
<saml2p:Response Destination="https://cloudapp.com/auth/saml/callback"
             ID="ijnccdceglphfggpnhhdkckhdkendndabahdjlef" InResponseTo="_4b740f60-a420-0132-eb44-002590a743aa"
             IssueInstant="2015-03-03T22:12:25.000Z" Version="2.0"
             xmlns:saml2p="urn:oasis:names:tc:SAML:2.0:protocol">
<saml2:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity"
              xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion">localhost
</saml2:Issuer>
<saml2p:Status>
    <saml2p:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/>
</saml2p:Status>
<saml2:Assertion ID="kjggobfabnbnfnpbngjeeolfjjjoimapmkpadbfl" IssueInstant="2015-03-03T22:12:25.000Z" Version="2.0"
                 xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion">
    <saml2:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">localhost</saml2:Issuer>
    <saml2:Subject>
        <saml2:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress">smith</saml2:NameID>
        <saml2:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
            <saml2:SubjectConfirmationData InResponseTo="_4b740f60-a420-0132-eb44-002590a743aa"
                                           NotOnOrAfter="2015-03-03T22:17:25.000Z"
                                           Recipient="https://cloudapp.com/auth/saml/callback"/>
        </saml2:SubjectConfirmation>
    </saml2:Subject>
    <saml2:Conditions NotBefore="2015-03-03T22:12:25.000Z" NotOnOrAfter="2015-03-03T22:17:25.000Z">
        <saml2:AudienceRestriction>
            <saml2:Audience>https://cloudapp.com/</saml2:Audience>
        </saml2:AudienceRestriction>
    </saml2:Conditions>
    <saml2:AuthnStatement AuthnInstant="2015-03-03T22:12:25.001Z">
        <saml2:AuthnContext>
            <saml2:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:Password</saml2:AuthnContextClassRef>
        </saml2:AuthnContext>
    </saml2:AuthnStatement>
</saml2:Assertion>

是的。你可以通过使用 WSO2IS 中的配置来做到这一点。默认情况下 WSO2IS returns 经过身份验证的用户名。但是你可以select验证用户的哪个属性,必须添加为SAML2 Assertion中的NameID。如果您使用的是 IS 5.0.0,在声明配置下,您可以找到名为 Subject Claim URI: 的配置。在这里,您可以 select 必须 select 编辑为 NameID 的所需声明 uri。您可以从主题 "User Name for SAML2 Assertion" 下的 here 中找到更多配置详细信息。

但是,当您使用电子邮件时,如果发现任何问题,您可能需要在 carbon.xml 文件中配置以下元素。然而上面 link 包含更多关于它的内容。

<EnableEmailUserName>true</EnableEmailUserName>