使用ADFS的Spring saml扩展

时间:2015-01-02 07:28:48

标签: spring-security saml adfs spring-saml

我正在将ADAM中的Spring saml Extension集成到SSO中。我使用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"]   =>问题(Type =" http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier",   Issuer = c.Issuer,OriginalIssuer = c.OriginalIssuer,Value = c.Value,   ValueType = c.ValueType,   特性[" HTTP://schemas.xmlsoap.org/ws/2005/05/identity/claimproperties/format"]   =" urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress");

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

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

非常感谢。

1 个答案:

答案 0 :(得分:0)

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

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

String[] value = credential.getAttributeAsStringArray("attributeName");
相关问题