private function parseAuthnStatement(\DOMElement $xml)
{
$authnStatements = Utils::xpQuery($xml, './saml_assertion:AuthnStatement');
if (empty($authnStatements)) {
$this->authnInstant = null;
return;
} elseif (count($authnStatements) > 1) {
throw new \Exception('More than 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 = Utils::xsDateTimeToTimestamp($authnStatement->getAttribute('AuthnInstant'));
if ($authnStatement->hasAttribute('SessionNotOnOrAfter')) {
$this->sessionNotOnOrAfter = Utils::xsDateTimeToTimestamp($authnStatement->getAttribute('SessionNotOnOrAfter'));
}
if ($authnStatement->hasAttribute('SessionIndex')) {
$this->sessionIndex = $authnStatement->getAttribute('SessionIndex');
}
$this->parseAuthnContext($authnStatement);
}