private function SAML2_Assertion::addConditions in SAML SP 2.0 Single Sign On (SSO) - SAML Service Provider 8
Add a Conditions-node to the assertion.
Parameters
DOMElement $root The assertion element we should add the conditions to.:
1 call to SAML2_Assertion::addConditions()
- SAML2_Assertion::toXML in src/
SAML2_Assertion.php - Convert this assertion to an XML element.
File
- src/
SAML2_Assertion.php, line 667
Class
Namespace
Drupal\miniorange_samlCode
private function addConditions(DOMElement $root) {
$document = $root->ownerDocument;
$conditions = $document
->createElementNS('urn:oasis:names:tc:SAML:2.0:assertion', 'saml:Conditions');
$root
->appendChild($conditions);
if ($this->notBefore !== NULL) {
$conditions
->setAttribute('NotBefore', gmdate('Y-m-d\\TH:i:s\\Z', $this->notBefore));
}
if ($this->notOnOrAfter !== NULL) {
$conditions
->setAttribute('NotOnOrAfter', gmdate('Y-m-d\\TH:i:s\\Z', $this->notOnOrAfter));
}
if ($this->validAudiences !== NULL) {
$ar = $document
->createElementNS('urn:oasis:names:tc:SAML:2.0:assertion', 'saml:AudienceRestriction');
$conditions
->appendChild($ar);
Utilities::addStrings($ar, 'urn:oasis:names:tc:SAML:2.0:assertion', 'saml:Audience', FALSE, $this->validAudiences);
}
}