You are here

private function SAML2_Assertion::parseAuthnStatement in SAML SP 2.0 Single Sign On (SSO) - SAML Service Provider 8

Parse AuthnStatement in assertion.

Parameters

DOMElement $xml The assertion XML element.:

Throws

Exception

1 call to SAML2_Assertion::parseAuthnStatement()
SAML2_Assertion::__construct in src/SAML2_Assertion.php

File

src/SAML2_Assertion.php, line 187

Class

SAML2_Assertion

Namespace

Drupal\miniorange_saml

Code

private function parseAuthnStatement(DOMElement $xml) {
  $authnStatements = Utilities::xpQuery($xml, './saml_assertion:AuthnStatement');
  if (empty($authnStatements)) {
    $this->authnInstant = NULL;
    return;
  }
  elseif (count($authnStatements) > 1) {
    throw new \Exception('More that one <saml:AuthnStatement> in <saml:Assertion> not supported.');
  }
  $authnStatement = $authnStatements[0];
  if (!$authnStatement
    ->hasAttribute('AuthnInstant')) {
    throw new \Exception('Missing required AuthnInstant attribute on <saml:AuthnStatement>.');
  }
  $this->authnInstant = Utilities::xsDateTimeToTimestamp($authnStatement
    ->getAttribute('AuthnInstant'));
  if ($authnStatement
    ->hasAttribute('SessionNotOnOrAfter')) {
    $this->sessionNotOnOrAfter = Utilities::xsDateTimeToTimestamp($authnStatement
      ->getAttribute('SessionNotOnOrAfter'));
  }
  if ($authnStatement
    ->hasAttribute('SessionIndex')) {
    $this->sessionIndex = $authnStatement
      ->getAttribute('SessionIndex');
  }
  $this
    ->parseAuthnContext($authnStatement);
}