来自ADFS的SAMLResponse中的UserPrincipalName(UPN)

时间:2015-04-21 16:59:34

标签: java active-directory saml-2.0 adfs adfs2.0

我正在使用ADFS实现SP启动的SSO。我向ADFS提交了SAMLRequest,在验证SAMLRequest后,ADFS以SAMLResponse回复。 在ADFS中,声明规则将UPN映射到名称ID。但我无法在SAMLResponse中看到姓名ID或UPN。是我必须告诉我SAMLRequest中的ADFS还是ADFS的配置问题?

这是我的SAMLRequest:

<?xml version="1.0" encoding="UTF-8"?>
<samlp:AuthnRequest xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
    AssertionConsumerServiceURL="https://http://testurl.com/mysite/samlrequest"
    ForceAuthn="false" ID="_bec424fa5103428909a30ff1e31168327f79474984"
    IsPassive="false" IssueInstant="2015-04-22T11:49:03.815Z"
    ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
    Version="2.0">
    <saml:Issuer xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">http://testurl.com/mysite</saml:Issuer>
    <samlp:NameIDPolicy AllowCreate="true" Format="urn:oasis:names:tc:SAML:2.0:nameid-format:transient" />
    <samlp:RequestedAuthnContext Comparison="exact">
        <saml:AuthnContextClassRef xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport</saml:AuthnContextClassRef>
    </samlp:RequestedAuthnContext>
</samlp:AuthnRequest>

1 个答案:

答案 0 :(得分:0)

我不知道您的声明规则是什么样的,但我将电子邮件地址属性映射到nameidentifier并且它有效。这应该是ADFS中的自定义规则,应该如下所示:

c:[Type == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn"] => issue(Type = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier", Issuer = c.Issuer, OriginalIssuer = c.OriginalIssuer, Value = c.Value, ValueType = c.ValueType, Properties["http://schemas.xmlsoap.org/ws/2005/05/identity/claimproperties/format"] = "urn:oasis:names:tc:SAML:2.0:nameid-format:transient", Properties["http://schemas.xmlsoap.org/ws/2005/05/identity/claimproperties/spnamequalifier"] = "SP_ENTITY_ID");

如果要将此作为属性发送,只需使用“将LDAP属性作为声明发送”

创建规则

我知道现在已经很晚了,但希望这有助于某人。