Skip to content
Snippets Groups Projects
Commit e911e267 authored by Jaime Perez Crespo's avatar Jaime Perez Crespo
Browse files

Move SimpleSAML_Utilities::getSelfHostWithPath() to...

Move SimpleSAML_Utilities::getSelfHostWithPath() to SimpleSAML\Utils\HTTP::getSelfHostWithPath() and deprecate the former.
parent 460a6a00
No related branches found
No related tags found
No related merge requests found
......@@ -187,7 +187,7 @@ class SimpleSAML_Metadata_MetaDataStorageHandler {
assert('is_string($set)');
/* First we look for the hostname/path combination. */
$currenthostwithpath = SimpleSAML_Utilities::getSelfHostWithPath(); // sp.example.org/university
$currenthostwithpath = \SimpleSAML\Utils\HTTP::getSelfHostWithPath(); // sp.example.org/university
foreach($this->sources as $source) {
$index = $source->getEntityIdFromHostPath($currenthostwithpath, $set, $type);
......
......@@ -87,18 +87,10 @@ class SimpleSAML_Utilities {
/**
* Will return sp.example.org/ssp/sp1
*
* Please note this function will return the base URL for the current
* SP, as defined in the global configuration.
* @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\HTTP::getSelfHostWithPath() instead.
*/
public static function getSelfHostWithPath() {
$baseurl = explode("/", self::getBaseURL());
$elements = array_slice($baseurl, 3 - count($baseurl), count($baseurl) - 4);
$path = implode("/", $elements);
$selfhostwithpath = self::getSelfHost();
return $selfhostwithpath . "/" . $path;
return \SimpleSAML\Utils\HTTP::getSelfHostWithPath();
}
/**
......
......@@ -319,7 +319,7 @@ class HTTP
/**
* Retrieve our own host.
*
* @return string The current host.
* @return string The current host (with non-default ports included).
*
* @author Andreas Solberg, UNINETT AS <andreas.solberg@uninett.no>
* @author Olav Morken, UNINETT AS <olav.morken@uninett.no>
......@@ -335,6 +335,24 @@ class HTTP
}
/**
* Retrieve our own host together with the URL path. Please note this function will return the base URL for the
* current SP, as defined in the global configuration.
*
* @return string The current host (with non-default ports included) plus the URL path.
*
* @author Andreas Solberg, UNINETT AS <andreas.solberg@uninett.no>
* @author Olav Morken, UNINETT AS <olav.morken@uninett.no>
*/
public static function getSelfHostWithPath()
{
$baseurl = explode("/", self::getBaseURL());
$elements = array_slice($baseurl, 3 - count($baseurl), count($baseurl) - 4);
$path = implode("/", $elements);
return self::getSelfHost()."/".$path;
}
/**
* Parse a query string into an array.
*
......
......@@ -20,7 +20,7 @@ $attributes['Utilities_getBaseURL()'] = array(\SimpleSAML\Utils\HTTP::getBaseURL
$attributes['Utilities_getSelfHost()'] = array(\SimpleSAML\Utils\HTTP::getSelfHost());
$attributes['Utilities_selfURLhost()'] = array(SimpleSAML_Utilities::selfURLhost());
$attributes['Utilities_selfURLNoQuery()'] = array(SimpleSAML_Utilities::selfURLNoQuery());
$attributes['Utilities_getSelfHostWithPath()'] = array(SimpleSAML_Utilities::getSelfHostWithPath());
$attributes['Utilities_getSelfHostWithPath()'] = array(\SimpleSAML\Utils\HTTP::getSelfHostWithPath());
$attributes['Utilities_getFirstPathElement()'] = array(SimpleSAML_Utilities::getFirstPathElement());
$attributes['Utilities_selfURL()'] = array(SimpleSAML_Utilities::selfURL());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment