# 我无法正确映射使用SAML插件的属性

**URL:** <https://meta.discourse.org/t/i-dont-get-proper-mapping-of-attributes-using-saml-plugin/194312>\
**Category:** SSO\
**Tags:** saml\
**Created:** [2021 年6 月 18 日 14:36 UTC](https://meta.discourse.org/t/i-dont-get-proper-mapping-of-attributes-using-saml-plugin/194312 "2021-06-18T14:36:01Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

作者： ![JoreisPy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/joreispy/32/224708_2.png) [@JoreisPy](https://meta.discourse.org/u/JoreisPy)\
发布日期： [2021 年6 月 18 日 14:36 UTC](https://meta.discourse.org/t/i-dont-get-proper-mapping-of-attributes-using-saml-plugin/194312/1 "2021-06-18T14:36:01Z")

</div>

您好，

我正尝试将我们的 Shibboleth 与 Discourse 实例集成。目前登录功能正常，但我获取到的数据（姓名、邮箱等）不正确。

以下是来自 SSO 的部分数据：

```plaintext
    <saml2:Attribute FriendlyName="givenName" Name="urn:oid:2.5.4.42" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri">
      <saml2:AttributeValue>Joao Miguel</saml2:AttributeValue>

```

以下是错误日志：

```plaintext
SAML 调试：saml_auth: {:uid=>"AAdzZWNyZXQ0uudwQFYHs1n7nrvB/A4t4l6q+6aAXInZRL4XIO+mnEEEq4t8UwBnzJRh50mnTGDsQAPvWThJNaUNR6smCochT1I2oXwvyoU4lQG+5hbVmCvkkmYDPOujrvgNloXWNg==", :info=>{"name"=>nil, "email"=>nil, "first_name"=>nil, "last_name"=>nil, "nickname"=>nil}....... @attributes={............."urn:oid:2.5.4.42"=>["Joao Miguel"]

```

我认为问题出在 FriendlyName 上，因为它与 saml\_authenticator.rb 中的任何选项都不匹配：

statements = “name:name|email:email,mail|first\_name:first\_name,firstname,firstName|last\_name:last\_name,lastname,lastName|nickname:screenName”

由于 FriendlyName 在每个属性中都会重复，我不确定如何进行映射。有人知道如何处理这个问题吗？

谢谢

---

_[View the full topic](https://meta.discourse.org/t/i-dont-get-proper-mapping-of-attributes-using-saml-plugin/194312)._
