/ / Holen Sie sich den zweiten AttributeValue von SAML in php - php, saml, saml-2.0, simplesamlphp

Holen Sie sich den zweiten AttributeValue von SAML in php - php, saml, saml-2.0, simplesamlphp

<saml:Attribute
xmlns:x500="urn:oasis:names:tc:SAML:2.0:profiles:attribute:X500"
x500:Encoding="LDAP"
NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
Name="urn:oid:1.3.6.1.4.1.5923.1.1.1.1"
FriendlyName="eduPersonAffiliation">
<saml:AttributeValue
xsi:type="xs:string">member</saml:AttributeValue>
<saml:AttributeValue
xsi:type="xs:string">staff</saml:AttributeValue>
</saml:Attribute>

Ich möchte den zweiten Wert (staff) von SAML in meinem PHP-Code abrufen. Der Code sieht genau wie oben gezeigt aus. Wie kann das erreicht werden?

Antworten:

0 für die Antwort № 1

Sie können verwenden SimpleSAMLphps API

$as = new SimpleSAML_Auth_Simple("default-sp");
$as->requireAuth();
$attributes = $as->getAttributes();
// The attribute Name is the key
$secondValue = $attributes["urn:oid:1.3.6.1.4.1.5923.1.1.1.1"][1];