SAMLプラグインで属性のマッピングがうまくいかない

Hello,

I am trying to integrate our shibboleth with our discourse instance. For now logging in works but I am getting the wrong data (name, email, etc…)

here is part of the data coming from the SSO

    <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>

here is the error log:

SAML Debugging: 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"]

I would say the issue has to do with the FriendlyName, as it doesnt match any of the options in saml_authenticator.rb:

statements = “name:name|email:email,mail|first_name:first_name,firstname,firstName|last_name:last_name,lastname,lastName|nickname:screenName”

Since friendly name repeats itself for every atribute I am not sure how to make the mapping. Has anyone an idea of how to deal with this?

Thank you

これが機能したかどうか確認できましたか?

こんにちは @Ivan.bacher さん、@JoreisPy さん、discourse-saml の設定で適切な属性のマッピングに成功しましたか?

プラグインでこの設定を試しましたが、今のところうまくいっていません。

良い一日を! :slight_smile:

SAML統合をテスト中に同じ問題に遭遇しましたが、最終的に機能させることができました。ログを有効にして、@attributesの内容を確認してください。マッピングに必要な実際のキーは、フレンドリー名ではなく、これらです。これらはXMLデータのName属性に対応します。私の場合は、app.yml内のマッピングは次のようになりました。

DISCOURSE_SAML_REQUEST_ATTRIBUTES: "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress"
DISCOURSE_SAML_ATTRIBUTE_STATEMENTS: "email:http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress"

設定を変更した後は、再構築することも重要です。その後、SAML応答からメール値が正しくマッピングされました。

共有ありがとうございます。discourse-saml/config/locales/server.en.yml at main · discourse/discourse-saml · GitHub から、正確な形式の意味が不明瞭です。
さらに、将来のSAMLプラグインでは、複数の属性をDiscourse変数にマッピングできる可能性があるため、形式は基本的に次のように示します。

‘<Discourse_variable>:<SAML_attribute1>,<SAML_attribute2>’

「いいね!」 1

おそらく適切な場所ではありませんが、追加情報として、SAMLプラグインを使用するには、Discourse属性と同様にemailnamefirst_namelast_name、およびuidが必要になります。

さらに

def attribute_statements
    result = {}
    statements =
      "name:fullName,name|email:email,mail|first_name:first_name,firstname,firstName|last_name:last_name,lastname,lastName|nickname:screenName"
    custom_statements = setting(:attribute_statements)

    statements = "#{statements}|#{custom_statements}" if custom_statements.present?

    statements
      .split("|")
      .map do |statement|
        attrs = statement.split(":", 2)
        next if attrs.count != 2
        (result[attrs[0]] ||= []) << attrs[1].split(",")
        result[attrs[0]].flatten!
      end

    result
  end

このコードの部分は(私はRubyプログラマーではありませんが)、システムが機能するために、すべての属性をあなたの属性にマッピングする必要があることを示唆しています… SAMLプラグインで問題が発生しており、問題を調査しようとしています。