From 9061a75353d64a58a77517415d87c86bd64b89e1 Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Tue, 16 Nov 2010 14:31:28 +0000
Subject: [PATCH] www/shib13/sp: Use the new interface in Session.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2643 44740490-163a-0410-bde0-09ae8108e29a
---
 www/example-simple/shib13-example.php      |  5 ++---
 www/shib13/sp/AssertionConsumerService.php | 15 ++++++++-------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/www/example-simple/shib13-example.php b/www/example-simple/shib13-example.php
index 94f1b7ae4..dbec3bc41 100644
--- a/www/example-simple/shib13-example.php
+++ b/www/example-simple/shib13-example.php
@@ -50,7 +50,7 @@ if (!$session->isValid('shib13') ) {
 /* Prepare attributes for presentation 
 * and call a hook function for organizing the attribute array
 */
-$attributes = $session->getAttributes();
+$attributes = $session->getAuthData('shib13', 'Attributes');
 $para = array(
 	'attributes' => &$attributes
 );
@@ -69,10 +69,9 @@ SimpleSAML_Module::callHooks('attributepresentation', $para);
 $t = new SimpleSAML_XHTML_Template($config, 'status.php', 'attributes');
 
 $t->data['header'] = '{status:header_shib}';
-$t->data['remaining'] = $session->remainingTime();
+$t->data['remaining'] = $session->getAuthData('shib13', 'Expire') - time();
 $t->data['sessionsize'] = $session->getSize();
 $t->data['attributes'] = $attributes;
-$t->data['attributes'] = $session->getAttributes();
 $t->data['logout'] = null;
 $t->show();
 
diff --git a/www/shib13/sp/AssertionConsumerService.php b/www/shib13/sp/AssertionConsumerService.php
index 90ef7618e..c392cebc6 100644
--- a/www/shib13/sp/AssertionConsumerService.php
+++ b/www/shib13/sp/AssertionConsumerService.php
@@ -24,14 +24,15 @@ function finishLogin($authProcState) {
 	assert('array_key_exists("Source", $authProcState)');
 	assert('array_key_exists("entityid", $authProcState["Source"])');
 
-	global $session;
+	$authData = array(
+		'Attributes' => $authProcState['Attributes'],
+		'saml:sp:NameID' => $authProcState['core:shib13-sp:NameID'],
+		'saml:sp:SessionIndex' => $authProcState['core:shib13-sp:SessionIndex'],
+		'saml:sp:IdP' => $authProcState['Source']['entityid'],
+	);
 
-	/* Update the session information */
-	$session->doLogin('shib13');
-	$session->setAttributes($authProcState['Attributes']);
-	$session->setNameID($authProcState['core:shib13-sp:NameID']);
-	$session->setSessionIndex($authProcState['core:shib13-sp:SessionIndex']);
-	$session->setIdP($authProcState['Source']['entityid']);
+	global $session;
+	$session->doLogin('shib13', $authData);
 
 	SimpleSAML_Utilities::redirect($authProcState['core:shib13-sp:TargetURL']);
 }
-- 
GitLab