Spring 带有 ADFS 的 saml 扩展

Spring saml Extension with ADFS

我正在为 SSO 在 ADFS 中集成 Spring saml 扩展。我使用 ADFS2.0 作为 IDP,我已经为 Spring 应用程序生成元数据并将元数据导入 ADFS。我会将电子邮件地址和显示名称传递给 spring 应用程序。

这里是我在ADFS中设置的声明规则。

1 获取属性

c:[Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname", Issuer == "AD AUTHORITY"]
 => issue(store = "Active Directory", types = ("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress"), query = ";displayName,mail;{0}", param = c.Value);

2 发送电子邮件地址作为名称 ID

c:[Type == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress"] => 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:1.1:nameid-format:emailAddress");

我可以登录 Spring 应用程序。在一般信息中,信息是正确的。但在校长的属性部分。属性的值变为 org.opensaml.xml.schema.impl.XSAnyImpl@5abb6d06 和 org.opensaml.xml.schema.impl.XSAnyImpl@46f2d373。

有谁知道为什么会这样?我该如何解决?

非常感谢。

您应该更新到 Spring SAML 1.0.0.RELEASE(在 Spring repos 中可用)。该版本包含可正确处理 XSAny 元素中的字符串值的辅助方法。有关示例,请参阅 sample 项目中的文件 index.jspSAMLCredential 个实例上有用的方法是:

String value = credential.getAttributeAsString("attributeName");

String[] value = credential.getAttributeAsStringArray("attributeName");