Revision: 2135
Author: olavmrk
Date: Tue Jan 26 02:07:17 2010
Log: SAML2_Assertion: Support AuthnInstant.
http://code.google.com/p/simplesamlphp/source/detail?r=2135

Modified:
 /trunk/lib/SAML2/Assertion.php

=======================================
--- /trunk/lib/SAML2/Assertion.php      Thu Oct  1 04:44:56 2009
+++ /trunk/lib/SAML2/Assertion.php      Tue Jan 26 02:07:17 2010
@@ -116,6 +116,14 @@
        private $sessionIndex;


+       /**
+        * The timestamp the user was authenticated, as an UNIX timestamp.
+        *
+        * @var int
+        */
+       private $authnInstant;
+
+
        /**
         * The authentication context for this assertion.
         *
@@ -180,6 +188,7 @@
                $this->id = SimpleSAML_Utilities::generateID();
                $this->issueInstant = time();
                $this->issuer = '';
+               $this->authnInstant = time();
                $this->attributes = array();
                $this->nameFormat = SAML2_Const::NAMEFORMAT_UNSPECIFIED;
                $this->certificates = array();
@@ -378,6 +387,7 @@
                if (!$as->hasAttribute('AuthnInstant')) {
throw new Exception('Missing required AuthnInstant attribute on <saml:AuthnStatement>.');
                }
+ $this->authnInstant = SimpleSAML_Utilities::parseSAML2Time($as->getAttribute('AuthnInstant'));

                if ($as->hasAttribute('SessionNotOnOrAfter')) {
$this->sessionNotOnOrAfter = SimpleSAML_Utilities::parseSAML2Time($as->getAttribute('SessionNotOnOrAfter'));
@@ -759,6 +769,29 @@

                $this->validAudiences = $validAudiences;
        }
+
+
+       /**
+        * Retrieve the AuthnInstant of the assertion.
+        *
+        * @return int  The timestamp the user was authenticated.
+        */
+       public function getAuthnInstant() {
+
+               return $this->authnInstant;
+       }
+
+
+       /**
+        * Set the AuthnInstant of the assertion.
+        *
+        * @param int $authnInstant  The timestamp the user was authenticated.
+        */
+       public function setAuthnInstant($authnInstant) {
+               assert('is_int($authnInstant)');
+
+               $this->authnInstant = $authnInstant;
+       }


        /**
@@ -1069,7 +1102,7 @@
$as = $document->createElementNS(SAML2_Const::NS_SAML, 'saml:AuthnStatement');
                $root->appendChild($as);

- $as->setAttribute('AuthnInstant', gmdate('Y-m-d\TH:i:s\Z', $this->issueInstant)); + $as->setAttribute('AuthnInstant', gmdate('Y-m-d\TH:i:s\Z', $this->authnInstant));

                if ($this->sessionNotOnOrAfter !== NULL) {
$as->setAttribute('SessionNotOnOrAfter', gmdate('Y-m-d\TH:i:s\Z', $this->sessionNotOnOrAfter));

--
You received this message because you are subscribed to the Google Groups 
"simpleSAMLphp commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/simplesamlphp-commits?hl=en.

Reply via email to