Skip to content
Snippets Groups Projects
Commit da93d7c4 authored by Olav Morken's avatar Olav Morken
Browse files

SimpleSAML_Utilities: Add getBaseURL function.

This function returns the absolute URL to the base of the simpleSAMLphp
installation, and should be used instead of:

SimpleSAML_Utilities::selfURLhost() . '/' . $config->getBaseURL()

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1723 44740490-163a-0410-bde0-09ae8108e29a
parent f6c9ca25
Branches
Tags
No related merge requests found
...@@ -152,6 +152,29 @@ class SimpleSAML_Utilities { ...@@ -152,6 +152,29 @@ class SimpleSAML_Utilities {
} }
/**
* Retrieve the absolute base URL for the simpleSAMLphp installation.
*
* This function will return the absolute base URL for the simpleSAMLphp
* installation. For example: https://idp.example.org/simplesaml/
*
* The URL will always end with a '/'.
*
* @return string The absolute base URL for the simpleSAMLphp installation.
*/
public static function getBaseURL() {
$globalConfig = SimpleSAML_Configuration::getInstance();
$ret = SimpleSAML_Utilities::selfURLhost() . '/' . $globalConfig->getBaseURL();
if (substr($ret, -1) !== '/') {
throw new SimpleSAML_Error_Exception('Invalid value of \'baseurl\' in ' .
'config.php. It must end with a \'/\'.');
}
return $ret;
}
/** /**
* Add one or more query parameters to the given URL. * Add one or more query parameters to the given URL.
* *
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment