/** * Add this RoleDescriptor to an EntityDescriptor. * * @param DOMElement $parent The EntityDescriptor we should append this RoleDescriptor to. */ public function toXML(DOMElement $parent) { $this->xml->toXML($parent); }
/** * Add a AuthnStatement-node to the assertion. * * @param DOMElement $root The assertion element we should add the authentication statement to. */ private function addAuthnStatement(DOMElement $root) { if ($this->authnInstant === NULL || $this->authnContextClassRef === NULL && $this->authnContextDecl === NULL && $this->authnContextDeclRef === NULL) { /* No authentication context or AuthnInstant => no authentication statement. */ return; } $document = $root->ownerDocument; $authnStatementEl = $document->createElementNS(SAML2_Const::NS_SAML, 'saml:AuthnStatement'); $root->appendChild($authnStatementEl); $authnStatementEl->setAttribute('AuthnInstant', gmdate('Y-m-d\\TH:i:s\\Z', $this->authnInstant)); if ($this->sessionNotOnOrAfter !== NULL) { $authnStatementEl->setAttribute('SessionNotOnOrAfter', gmdate('Y-m-d\\TH:i:s\\Z', $this->sessionNotOnOrAfter)); } if ($this->sessionIndex !== NULL) { $authnStatementEl->setAttribute('SessionIndex', $this->sessionIndex); } $authnContextEl = $document->createElementNS(SAML2_Const::NS_SAML, 'saml:AuthnContext'); $authnStatementEl->appendChild($authnContextEl); if (!empty($this->authnContextClassRef)) { SAML2_Utils::addString($authnContextEl, SAML2_Const::NS_SAML, 'saml:AuthnContextClassRef', $this->authnContextClassRef); } if (!empty($this->authnContextDecl)) { $this->authnContextDecl->toXML($authnContextEl); } if (!empty($this->authnContextDeclRef)) { SAML2_Utils::addString($authnContextEl, SAML2_Const::NS_SAML, 'saml:AuthnContextDeclRef', $this->authnContextDeclRef); } SAML2_Utils::addStrings($authnContextEl, SAML2_Const::NS_SAML, 'saml:AuthenticatingAuthority', FALSE, $this->AuthenticatingAuthority); }