private function SAML2_Assertion::parseSubject in SAML SP 2.0 Single Sign On (SSO) - SAML Service Provider 8
Parse subject in assertion.
Parameters
DOMElement $xml The assertion XML element.:
Throws
Exception
1 call to SAML2_Assertion::parseSubject()
File
- src/
SAML2_Assertion.php, line 85
Class
Namespace
Drupal\miniorange_samlCode
private function parseSubject(DOMElement $xml) {
$subject = Utilities::xpQuery($xml, './saml_assertion:Subject');
if (empty($subject)) {
/* No Subject node. */
return;
}
elseif (count($subject) > 1) {
throw new \Exception('More than one <saml:Subject> in <saml:Assertion>.');
}
$subject = $subject[0];
$nameId = Utilities::xpQuery($subject, './saml_assertion:NameID | ./saml_assertion:EncryptedID/xenc:EncryptedData');
if (empty($nameId)) {
throw new \Exception('Missing <saml:NameID> or <saml:EncryptedID> in <saml:Subject>.');
}
elseif (count($nameId) > 1) {
throw new \Exception('More than one <saml:NameID> or <saml:EncryptedD> in <saml:Subject>.');
}
$nameId = $nameId[0];
if ($nameId->localName === 'EncryptedData') {
/* The NameID element is encrypted. */
$this->encryptedNameId = $nameId;
}
else {
$this->nameId = Utilities::parseNameId($nameId);
}
}