34 parent::__construct($tagName,
$xml);
40 $this->parseSubject(
$xml);
52 $subject = Utils::xpQuery($xml,
'./saml_assertion:Subject');
53 if (empty($subject)) {
55 throw new \Exception(
'Missing subject in subject query.');
56 } elseif (count($subject) > 1) {
57 throw new \Exception(
'More than one <saml:Subject> in <saml:Assertion>.');
59 $subject = $subject[0];
61 $nameId = Utils::xpQuery($subject,
'./saml_assertion:NameID');
63 throw new \Exception(
'Missing <saml:NameID> in <saml:Subject>.');
65 throw new \Exception(
'More than one <saml:NameID> in <saml:Subject>.');
106 $root = parent::toUnsignedXML();
108 $subject = $root->ownerDocument->createElementNS(Constants::NS_SAML,
'saml:Subject');
109 $root->appendChild($subject);
111 $this->nameId->toXML($subject);
parseSubject(\DOMElement $xml)
Parse subject in query.
setNameId($nameId)
Set the NameId of the subject in the query.
toUnsignedXML()
Convert subject query message to an XML element.
getNameId()
Retrieve the NameId of the subject in the query.
__construct($tagName, \DOMElement $xml=null)
Constructor for SAML 2 subject query messages.