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

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2644 44740490-163a-0410-bde0-09ae8108e29a
---
 www/example-simple/wsfed-example.php |  4 ++--
 www/wsfed/sp/initSLO.php             |  4 ++--
 www/wsfed/sp/prp.php                 | 10 ++++++----
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/www/example-simple/wsfed-example.php b/www/example-simple/wsfed-example.php
index a7c5610c2..6962ab884 100644
--- a/www/example-simple/wsfed-example.php
+++ b/www/example-simple/wsfed-example.php
@@ -12,12 +12,12 @@ if (!$session->isValid('wsfed') ) {
 	);
 }
 
-$attributes = $session->getAttributes();
+$attributes = $session->getAuthData('wsfed', 'Attributes');
 
 $t = new SimpleSAML_XHTML_Template($config, 'status.php', 'attributes');
 
 $t->data['header'] = '{status:header_wsfed}';
-$t->data['remaining'] = $session->remainingTime();
+$t->data['remaining'] = $session->getAuthData('wsfed', 'Expire') - time();
 $t->data['sessionsize'] = $session->getSize();
 $t->data['attributes'] = $attributes;
 $t->data['logouturl'] = '/' . $config->getBaseURL() . 'wsfed/sp/initSLO.php?RelayState=/' . $config->getBaseURL() . 'logout.php';
diff --git a/www/wsfed/sp/initSLO.php b/www/wsfed/sp/initSLO.php
index 13b39d1a7..9aef7fc26 100644
--- a/www/wsfed/sp/initSLO.php
+++ b/www/wsfed/sp/initSLO.php
@@ -25,14 +25,14 @@ if (isset($session) ) {
 	
 		$metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler();
 	
-		$idpentityid = $session->getIdP();
+		$idpentityid = $session->getAuthData('wsfed', 'saml:sp:IdP');
 		$spentityid = isset($_GET['spentityid']) ? $_GET['spentityid'] : $metadata->getMetaDataCurrentEntityID();
 	
 		/**
 		 * Create a logout request
 		 */		
 		
-		$session->doLogout();
+		$session->doLogout('wsfed');
 		
 		SimpleSAML_Logger::info('WS-Fed - SP.initSLO: SP (' . $spentityid . ') is sending logout request to IdP (' . $idpentityid . ')');
 			
diff --git a/www/wsfed/sp/prp.php b/www/wsfed/sp/prp.php
index 3100fd290..d2fea79ca 100644
--- a/www/wsfed/sp/prp.php
+++ b/www/wsfed/sp/prp.php
@@ -134,10 +134,12 @@ try {
 
 
 	/* Mark the user as logged in. */
-	$session->doLogin('wsfed');
-	$session->setAttributes($attributes);
-	$session->setNameID($nameid);
-	$session->setIdP($idpEntityId);
+	$authData = array(
+		'Attributes' => $attributes,
+		'saml:sp:NameID' => $nameid,
+		'saml:sp:IdP' => $idpEntityId,
+	);
+	$session->doLogin('wsfed', $authData);
 
 	/* Redirect the user back to the page which requested the login. */
 	SimpleSAML_Utilities::redirect($wctx);
-- 
GitLab