From a5ca1aa33a441c0304cfc2a71655f4d72c7b2135 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jaime=20Pe=CC=81rez?= <jaime.perez@uninett.no>
Date: Tue, 26 Jul 2016 17:11:56 +0200
Subject: [PATCH] Stop using SimpleSAML_Configuration::getBaseURL().

Use the recently added SimpleSAML_Configuration::getBasePath() instead. It guarantees the path prepended with a slash, so no need to do that every time when calling the method. As a side effect, we get rid of buggy invocations (calling getBaseUrl() instead of getBaseURL()), and also of old-style convention for the 'baseurlpath' configuration option, allowing a star at the beginning.
---
 lib/SimpleSAML/XHTML/IdPDisco.php               | 2 +-
 modules/core/www/cleardiscochoices.php          | 2 +-
 modules/multiauth/lib/Auth/Source/MultiAuth.php | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/SimpleSAML/XHTML/IdPDisco.php b/lib/SimpleSAML/XHTML/IdPDisco.php
index a71193e86..ddb928572 100644
--- a/lib/SimpleSAML/XHTML/IdPDisco.php
+++ b/lib/SimpleSAML/XHTML/IdPDisco.php
@@ -217,7 +217,7 @@ class SimpleSAML_XHTML_IdPDisco
             // we save the cookies for 90 days
             'lifetime' => (60 * 60 * 24 * 90),
             // the base path for cookies. This should be the installation directory for SimpleSAMLphp
-            'path'     => ('/'.$this->config->getBaseUrl()),
+            'path'     => $this->config->getBasePath(),
             'httponly' => false,
         );
 
diff --git a/modules/core/www/cleardiscochoices.php b/modules/core/www/cleardiscochoices.php
index a5616d84e..3628a4531 100644
--- a/modules/core/www/cleardiscochoices.php
+++ b/modules/core/www/cleardiscochoices.php
@@ -8,7 +8,7 @@ require_once('_include.php');
 
 // The base path for cookies. This should be the installation directory for SimpleSAMLphp.
 $config = SimpleSAML_Configuration::getInstance();
-$cookiePath = '/' . $config->getBaseUrl();
+$cookiePath = $config->getBasePath();
 
 // We delete all cookies which starts with 'idpdisco_'
 foreach($_COOKIE as $cookieName => $value) {
diff --git a/modules/multiauth/lib/Auth/Source/MultiAuth.php b/modules/multiauth/lib/Auth/Source/MultiAuth.php
index dc0a95e3c..f3acc9016 100644
--- a/modules/multiauth/lib/Auth/Source/MultiAuth.php
+++ b/modules/multiauth/lib/Auth/Source/MultiAuth.php
@@ -204,7 +204,7 @@ class sspmod_multiauth_Auth_Source_MultiAuth extends SimpleSAML_Auth_Source {
 			'lifetime' => (60*60*24*90),
 			/* The base path for cookies.
 			This should be the installation directory for SimpleSAMLphp. */
-			'path' => ('/' . $config->getBaseUrl()),
+			'path' => $config->getBasePath(),
 			'httponly' => FALSE,
 		);
 
-- 
GitLab