/ / Zdobądź drugą wartość AttributeValue z SAML w php - php, saml, saml-2.0, simplesamlphp

Zdobądź drugą wartość AttributeValue z SAML w 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>

Chcę uzyskać drugą wartość (personel) z SAML w moim kodzie php, kod wygląda exaclty jak pokazano powyżej. Jak to osiągnąć?

Odpowiedzi:

0 dla odpowiedzi № 1

Możesz użyć API SimpleSAMLphp

$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];