Method | Description | |
---|---|---|
addURLParameters ( string $url, array $parameters ) : string | Add one or more query parameters to the given URL. | |
checkSessionCookie ( string | null $retryURL = null ) : void | Check for session cookie, and show missing-cookie page if it is missing. | |
checkURLAllowed ( string $url, array $trustedSites = null ) : string | Check if a URL is valid and is in our list of allowed URLs. | |
fetch ( string $url, array $context = [], boolean $getHeaders = false ) : mixed | Helper function to retrieve a file or URL with proxy support, also supporting proxy basic authorization. | |
getAcceptLanguage ( ) : array | This function parses the Accept-Language HTTP header and returns an associative array with each language and the score for that language. If a language includes a region, then the result will include both the language with the region and the language without the region. | |
getBaseURL ( ) : string | Retrieve the base URL of the SimpleSAMLphp installation. The URL will always end with a '/'. For example: https://idp.example.org/simplesaml/ | |
getFirstPathElement ( boolean $trailingslash = true ) : string | Retrieve the first element of the URL path. | |
getPOSTRedirectURL ( string $destination, array $data ) : string | Create a link which will POST data. | |
getSelfHost ( ) : string | Retrieve our own host. | |
getSelfHostWithNonStandardPort ( ) : string | Retrieve our own host, including the port in case the it is not standard for the protocol in use. That is port 80 for HTTP and port 443 for HTTPS. | |
getSelfHostWithPath ( ) : string | 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. | |
getSelfURL ( ) : string | Retrieve the current URL using the base URL in the configuration, if possible. | |
getSelfURLHost ( ) : string | Retrieve the current URL using the base URL in the configuration, containing the protocol, the host and optionally, the port number. | |
getSelfURLNoQuery ( ) : string | Retrieve the current URL using the base URL in the configuration, without the query parameters. | |
guessBasePath ( ) : string | Try to guess the base SimpleSAMLphp path from the current request. | |
isHTTPS ( ) : boolean | This function checks if we are using HTTPS as protocol. | |
normalizeURL ( string $url ) : string | Normalizes a URL to an absolute URL and validate it. In addition to resolving the URL, this function makes sure that it is a link to an http or https site. | |
parseQueryString ( string $query_string ) : array | Parse a query string into an array. | |
redirectTrustedURL ( string $url, string[] $parameters = [] ) : void | This function redirects to the specified URL without performing any security checks. Please, do NOT use this function with user supplied URLs. | |
redirectUntrustedURL ( string $url, string[] $parameters = [] ) : void | This function redirects to the specified URL after performing the appropriate security checks on it. | |
resolveURL ( string $url, string $base = null ) : string | Resolve a (possibly relative) URL relative to a given base URL. | |
setCookie ( string $name, string | null $value, array | null $params = null, boolean $throw = true ) | Set a cookie. | |
submitPOSTData ( string $destination, array $data ) | Submit a POST form to a specific destination. |
Method | Description | |
---|---|---|
getSecurePOSTRedirectURL ( string $destination, array $data ) : string | Obtain a URL where we can redirect to securely post a form with the given data to a specific destination. | |
getServerHTTPS ( ) : boolean | Retrieve HTTPS status from $_SERVER environment variables. | |
getServerHost ( ) : string | Retrieve Host value from $_SERVER environment variables. | |
getServerPort ( ) : string | Retrieve the port number from $_SERVER environment variables. | |
redirect ( string $url, string[] $parameters = [] ) : void | This function redirects the user to the specified address. | |
savePOSTData ( SimpleSAML_Session $session, string $destination, array $data ) : string | Save the given HTTP POST data and the destination where it should be posted to a given session. |
public static checkSessionCookie ( string | null $retryURL = null ) : void | ||
$retryURL | string | null | The URL the user should access to retry the operation. Defaults to null. |
return | void | If there is a session cookie, nothing will be returned. Otherwise, the user will be redirected to a page telling about the missing cookie. |
public static checkURLAllowed ( string $url, array $trustedSites = null ) : string | ||
$url | string | The URL to check. |
$trustedSites | array | An optional white list of domains. If none specified, the 'trusted.url.domains' configuration directive will be used. |
return | string | The normalized URL itself if it is allowed. An empty string if the $url parameter is empty as defined by the empty() function. |
public static fetch ( string $url, array $context = [], boolean $getHeaders = false ) : mixed | ||
$url | string | The path or URL we should fetch. |
$context | array | Extra context options. This parameter is optional. |
$getHeaders | boolean | Whether to also return response headers. Optional. |
return | mixed | array if $getHeaders is set, string otherwise |
public static getAcceptLanguage ( ) : array | ||
return | array | An associative array with each language and the score for that language. |
public static getBaseURL ( ) : string | ||
return | string | The absolute base URL for the SimpleSAMLphp installation. |
public static getFirstPathElement ( boolean $trailingslash = true ) : string | ||
$trailingslash | boolean | Whether to add a trailing slash to the element or not. Defaults to true. |
return | string | The first element of the URL path, with an optional, trailing slash. |
public static getSelfHost ( ) : string | ||
return | string | The current host. |
public static getSelfHostWithNonStandardPort ( ) : string | ||
return | string | The current host, followed by a colon and the port number, in case the port is not standard for the protocol. |
public static getSelfHostWithPath ( ) : string | ||
return | string | The current host (with non-default ports included) plus the URL path. |
public static getSelfURL ( ) : string | ||
return | string | The current URL, including query parameters. |
public static getSelfURLHost ( ) : string | ||
return | string | The current URL without path or query parameters. |
public static getSelfURLNoQuery ( ) : string | ||
return | string | The current URL, not including query parameters. |
public static guessBasePath ( ) : string | ||
return | string | The guessed base path that should correspond to the root installation of SimpleSAMLphp. |
public static normalizeURL ( string $url ) : string | ||
$url | string | The relative URL. |
return | string | An absolute URL for the given relative URL. |
public static parseQueryString ( string $query_string ) : array | ||
$query_string | string | The query string which should be parsed. |
return | array | The query string as an associative array. |
public static redirectTrustedURL ( string $url, string[] $parameters = [] ) : void | ||
$url | string | The URL we should redirect to. This URL may include query parameters. If this URL is a relative URL (starting with '/'), then it will be turned into an absolute URL by prefixing it with the absolute URL to the root of the website. |
$parameters | string[] | An array with extra query string parameters which should be appended to the URL. The name of the parameter is the array index. The value of the parameter is the value stored in the index. Both the name and the value will be urlencoded. If the value is NULL, then the parameter will be encoded as just the name, without a value. |
return | void | This function never returns. |
public static redirectUntrustedURL ( string $url, string[] $parameters = [] ) : void | ||
$url | string | The URL we should redirect to. This URL may include query parameters. If this URL is a relative URL (starting with '/'), then it will be turned into an absolute URL by prefixing it with the absolute URL to the root of the website. |
$parameters | string[] | An array with extra query string parameters which should be appended to the URL. The name of the parameter is the array index. The value of the parameter is the value stored in the index. Both the name and the value will be urlencoded. If the value is NULL, then the parameter will be encoded as just the name, without a value. |
return | void | This function never returns. |
public static setCookie ( string $name, string | null $value, array | null $params = null, boolean $throw = true ) | ||
$name | string | The name of the cookie. |
$value | string | null | The value of the cookie. Set to NULL to delete the cookie. |
$params | array | null | Cookie parameters. |
$throw | boolean | Whether to throw exception if setcookie() fails. |
public static submitPOSTData ( string $destination, array $data ) | ||
$destination | string | The destination URL. |
$data | array | An associative array with the data to be posted to $destination. |