Revision: 1783
Author: olavmrk
Date: Thu Sep 24 04:54:17 2009
Log: SimpleSAML_Auth_Default: Add handleUnsolicedAuth().
http://code.google.com/p/simplesamlphp/source/detail?r=1783

Modified:
  /trunk/lib/SimpleSAML/Auth/Default.php

=======================================
--- /trunk/lib/SimpleSAML/Auth/Default.php      Sun Jul 12 23:18:08 2009
+++ /trunk/lib/SimpleSAML/Auth/Default.php      Thu Sep 24 04:54:17 2009
@@ -177,6 +177,44 @@

                $session->doLogout();
        }
+
+
+       /**
+        * Handle a unsoliced login operations.
+        *
+        * This function creates a session from the received information. It
+        * will then redirect to the given URL.
+        *
+        * This is used to handle IdP initiated SSO.
+        *
+        * @param string $authId  The id of the authentication source that  
received the request.
+        * @param array $state  A state array.
+        * @param string $redirectTo  The URL we should redirect the user to 
after
+        *                            updating the session.
+        */
+       public static function handleUnsolicedAuth($authId, array $state,  
$redirectTo) {
+               assert('is_string($authId)');
+               assert('is_string($redirectTo)');
+
+               $session = SimpleSAML_Session::getInstance();
+               $session->doLogin($authId);
+
+               if (array_key_exists('Attributes', $state)) {
+                       $session->setAttributes($state['Attributes']);
+               } else {
+                       $session->setAttributes(array());
+               }
+
+               if(array_key_exists('Expires', $state)) {
+                       $session->setSessionDuration($state['Expires'] - 
time());
+               }
+
+               if (array_key_exists('LogoutState', $state)) {
+                       $session->setLogoutState($state['LogoutState']);
+               }
+
+               SimpleSAML_Utilities::redirect($redirectTo);
+       }

  }


--~--~---------~--~----~------------~-------~--~----~
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