Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Why doesn't the package support multiple NameFormat attributes for the <saml:Attribute> element?

オープン
#286 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
42/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
php

調査の方向性

SAML2\Assertion クラスから始め、setAttributeNameFormat と、issue に示されている連想配列による attribute statement の処理を調べてください。生成された XML を要求された 3 つの Attribute 要素と比較し、各 statement が独自の NameFormat を保持できることを completion でどのように検証するかを検討してください。

索引モデルが issue の本文から書いたものです。

説明

Description of the problem

I came across this situation today where I need to be able allow users to add multiple Attribute Statements to their custom SAML integration with our IDP. For each additional attribute statement, I need to allow the user to be able to set the following:

  • Name (that will be the Name attribute)
  • NameFormat (That will be the NameFormat attribute)
  • Value (That will be the value that goes in to the <saml:AttributeValue> element)

When I took a look at how I could construct the SAMLResponse message for the user's custom SAML integration, I could see no (at least apparent) way to be able to set the NameFormat INDIVIDUALLY on each user defined Attribute Statement.
I see a setter method on the SAML2\Assertion class that looks like this

$this->assertion->setAttributeNameFormat('');

But that method clearly says that it will set the NameFormat for ALL attribute statements. (Those that are all set via an associative array at once). This is not the desired functionality. I dug out the following code block from the SAML2\Assertion class which confirms it. Take a look at this screenshot.

Screenshot 2021-09-12 at 10 46 05 PM

It clearly sets the same NameFormat inside the foreach loop for all statements.

Desired result (solution)

Take a look at the following XML that was generated via a tool which shows the output that I also want.

    <saml2:AttributeStatement>
        <saml2:Attribute Name="first" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified">
            <saml2:AttributeValue
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">value1
            </saml2:AttributeValue>
        </saml2:Attribute>
        <saml2:Attribute Name="second" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri">
            <saml2:AttributeValue
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">value2
            </saml2:AttributeValue>
        </saml2:Attribute>
        <saml2:Attribute Name="third" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
            <saml2:AttributeValue
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">value3
            </saml2:AttributeValue>
        </saml2:Attribute>
    </saml2:AttributeStatement>

As you can see, the NameFormats for all 3 statements are different. How could I achieve this desired XML output (SAMLResponse message) ? Any help will be greatly appreciated.

主要言語
PHP
スター
306
フォーク
138
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

simplesamlphp/saml2 のほかの issue

simplesamlphp/saml2 の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。