From bbbd633967ba4ffd7201da67ac71ba26795c4366 Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Thu, 26 Jun 2008 06:49:15 +0000
Subject: [PATCH] Change SSOService consent parts to use getValueValidate.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@716 44740490-163a-0410-bde0-09ae8108e29a
---
 www/saml2/idp/SSOService.php  | 5 +----
 www/shib13/idp/SSOService.php | 5 +----
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/www/saml2/idp/SSOService.php b/www/saml2/idp/SSOService.php
index 08583925d..c96c35317 100644
--- a/www/saml2/idp/SSOService.php
+++ b/www/saml2/idp/SSOService.php
@@ -297,7 +297,7 @@ if($needAuth && !$isPassive) {
 				}
 				$t->data['sppp'] = $privacypolicy;
 
-				switch($config->getString('consent_autofocus', NULL)) {
+				switch($config->getValueValidate('consent_autofocus', array(NULL, 'yes', 'no'), NULL)) {
 				case NULL:
 					break;
 				case 'yes':
@@ -306,9 +306,6 @@ if($needAuth && !$isPassive) {
 				case 'no':
 					$t->data['autofocus'] = 'nobutton';
 					break;
-				default:
-					throw new Exception('Invalid value for the consent_autofocus option.' .
-						' Should be one of NULL, \'yes\' or \'no\'.');
 				}
 
 				$t->show();
diff --git a/www/shib13/idp/SSOService.php b/www/shib13/idp/SSOService.php
index 7a0456fa0..34baa010e 100644
--- a/www/shib13/idp/SSOService.php
+++ b/www/shib13/idp/SSOService.php
@@ -209,7 +209,7 @@ if (!$session->isAuthenticated($authority) ) {
 				}
 				$t->data['sppp'] = $privacypolicy;
 
-				switch($config->getString('consent_autofocus', NULL)) {
+				switch($config->getValueValidate('consent_autofocus', array(NULL, 'yes', 'no'), NULL)) {
 				case NULL:
 					break;
 				case 'yes':
@@ -218,9 +218,6 @@ if (!$session->isAuthenticated($authority) ) {
 				case 'no':
 					$t->data['autofocus'] = 'nobutton';
 					break;
-				default:
-					throw new Exception('Invalid value for the consent_autofocus option.' .
-						' Should be one of NULL, \'yes\' or \'no\'.');
 				}
 
 				$t->show();
-- 
GitLab