public function SAML2_Assertion::__construct in SAML SP 2.0 Single Sign On (SSO) - SAML Service Provider 8
File
- src/
SAML2_Assertion.php, line 34
Class
Namespace
Drupal\miniorange_samlCode
public function __construct(DOMElement $xml = NULL) {
$this->id = Utilities::generateId();
$this->issueInstant = Utilities::generateTimestamp();
$this->issuer = '';
$this->authnInstant = Utilities::generateTimestamp();
$this->attributes = array();
$this->nameFormat = 'urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified';
$this->certificates = array();
$this->AuthenticatingAuthority = array();
$this->SubjectConfirmation = array();
if ($xml === NULL) {
return;
}
if ($xml->localName === 'EncryptedAssertion') {
/* This condition is invoked only in premium and standard Plugins where Asserion is be encrypted. */
Utilities::ShowErrorMessage('Encrypted Assertion received.', 'Encrypted Assertion Feature is available in Premium and Enterprise Plugins only, please upgrade to use this Feature.', 'You could have enabled "Encrypted Assertion" at the Identity Provider Application setup. ');
}
if (!$xml
->hasAttribute('ID')) {
throw new \Exception('Missing ID attribute on SAML assertion.');
}
$this->id = $xml
->getAttribute('ID');
if ($xml
->getAttribute('Version') !== '2.0') {
/* Currently a very strict check. */
throw new \Exception('Unsupported version: ' . $xml
->getAttribute('Version'));
}
$this->issueInstant = Utilities::xsDateTimeToTimestamp($xml
->getAttribute('IssueInstant'));
$issuer = Utilities::xpQuery($xml, './saml_assertion:Issuer');
if (empty($issuer)) {
throw new \Exception('Missing <saml:Issuer> in assertion.');
}
$this->issuer = trim($issuer[0]->textContent);
$this
->parseConditions($xml);
$this
->parseAuthnStatement($xml);
$this
->parseAttributes($xml);
$this
->parseEncryptedAttributes($xml);
$this
->parseSignature($xml);
$this
->parseSubject($xml);
//echo "Signature parsed";
}