From a07b0cdf9158e3e71e31d1c6f0ef7ce2177f2948 Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Mon, 25 Oct 2010 12:28:57 +0000
Subject: [PATCH] casserver: Change to use SimpleSAML_Auth_Simple.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2604 44740490-163a-0410-bde0-09ae8108e29a
---
 modules/casserver/www/login.php | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/modules/casserver/www/login.php b/modules/casserver/www/login.php
index b8f25162c..be417d336 100644
--- a/modules/casserver/www/login.php
+++ b/modules/casserver/www/login.php
@@ -19,7 +19,6 @@ $isPassive = isset($_GET['gateway']) && $_GET['gateway'];
 
 $config = SimpleSAML_Configuration::getInstance();
 $casconfig = SimpleSAML_Configuration::getConfig('module_casserver.php');
-$session = SimpleSAML_Session::getInstance();
 
 $legal_service_urls = $casconfig->getValue('legal_service_urls');
 if (!checkServiceURL($service, $legal_service_urls))
@@ -29,18 +28,16 @@ $auth = $casconfig->getValue('auth', 'saml2');
 if (!in_array($auth, array('saml2', 'shib13')))
  	throw new Exception('CAS Service configured to use [auth] = ' . $auth . ' only [saml2,shib13] is legal.');
  
-
-if (!$session->isValid($auth)) {
-	$url = SimpleSAML_Utilities::selfURL();
-	$hints = array(
-		SimpleSAML_Auth_State::RESTART => $url,
-	    'ForceAuthn' => $forceAuthn,
-        'isPassive' => $isPassive,
+$as = new SimpleSAML_Auth_Simple($auth);
+if (!$as->isAuthenticated()) {
+	$params = array(
+		'ForceAuthn' => $forceAuthn,
+		'isPassive' => $isPassive,
 	);
-	SimpleSAML_Auth_Default::initLogin($auth, $url, $url, $hints);
+	$as->login($params);
 }
 
-$attributes = $session->getAttributes();
+$attributes = $as->getAttributes();
 
 $path = $casconfig->resolvePath($casconfig->getValue('ticketcache', '/tmp'));
 
-- 
GitLab