From 41d950a83b1b453e5599e51b076368b70d723544 Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Tue, 16 Nov 2010 14:33:05 +0000
Subject: [PATCH] saml:IdP: Use $state['AuthnInstant'] instead of
 ->getAuthnInstant().

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2653 44740490-163a-0410-bde0-09ae8108e29a
---
 modules/saml/lib/IdP/SAML2.php | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/modules/saml/lib/IdP/SAML2.php b/modules/saml/lib/IdP/SAML2.php
index 68b285fb0..2eb5e2fee 100644
--- a/modules/saml/lib/IdP/SAML2.php
+++ b/modules/saml/lib/IdP/SAML2.php
@@ -565,9 +565,13 @@ class sspmod_saml_IdP_SAML2 {
 
 		$a->setAuthnContext(SAML2_Const::AC_PASSWORD);
 
-		$session = SimpleSAML_Session::getInstance();
-
-		$a->setAuthnInstant($session->getAuthnInstant());
+		if (isset($state['AuthnInstant'])) {
+			$a->setAuthnInstant($state['AuthnInstant']);
+		} else {
+			/* For backwards compatibility. Remove in version 1.8. */
+			$session = SimpleSAML_Session::getInstance();
+			$a->setAuthnInstant($session->getAuthnInstant());
+		}
 
 		$sessionLifetime = $config->getInteger('session.duration', 8*60*60);
 		$a->setSessionNotOnOrAfter(time() + $sessionLifetime);
-- 
GitLab