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

Add / fix assertions for the redirect*() functions in SimpleSAML_Utilities.

parent b6b6bfcd
No related branches found
No related tags found
No related merge requests found
...@@ -562,6 +562,10 @@ class SimpleSAML_Utilities { ...@@ -562,6 +562,10 @@ class SimpleSAML_Utilities {
* meanwhile we are deprecating the it. * meanwhile we are deprecating the it.
*/ */
private static function _doRedirect($url, $parameters = array()) { private static function _doRedirect($url, $parameters = array()) {
assert('is_string($url)');
assert('!empty($url)');
assert('is_array($parameters)');
if (!empty($parameters)) { if (!empty($parameters)) {
$url = self::addURLparameter($url, $parameters); $url = self::addURLparameter($url, $parameters);
} }
...@@ -643,12 +647,10 @@ class SimpleSAML_Utilities { ...@@ -643,12 +647,10 @@ class SimpleSAML_Utilities {
* use the redirectTrustedURL or redirectUntrustedURL functions * use the redirectTrustedURL or redirectUntrustedURL functions
* accordingly. * accordingly.
*/ */
public static function redirect($url, $parameters = array(), public static function redirect($url, $parameters = array(), $allowed_redirect_hosts = NULL) {
$allowed_redirect_hosts = NULL) { assert('is_string($url)');
assert('strlen($url) > 0');
assert(is_string($url)); assert('is_array($parameters)');
assert(strlen($url) > 0);
assert(is_array($parameters));
if ($allowed_redirect_hosts !== NULL) { if ($allowed_redirect_hosts !== NULL) {
$url = self::checkURLAllowed($url, $allowed_redirect_hosts); $url = self::checkURLAllowed($url, $allowed_redirect_hosts);
...@@ -683,6 +685,9 @@ class SimpleSAML_Utilities { ...@@ -683,6 +685,9 @@ class SimpleSAML_Utilities {
* @return void This function never returns. * @return void This function never returns.
*/ */
public static function redirectTrustedURL($url, $parameters = array()) { public static function redirectTrustedURL($url, $parameters = array()) {
assert('is_string($url)');
assert('is_array($parameters)');
$url = self::normalizeURL($url); $url = self::normalizeURL($url);
self::_doRedirect($url, $parameters); self::_doRedirect($url, $parameters);
} }
...@@ -702,6 +707,9 @@ class SimpleSAML_Utilities { ...@@ -702,6 +707,9 @@ class SimpleSAML_Utilities {
* @return void This function never returns. * @return void This function never returns.
*/ */
public static function redirectUntrustedURL($url, $parameters = array()) { public static function redirectUntrustedURL($url, $parameters = array()) {
assert('is_string($url)');
assert('is_array($parameters)');
$url = self::checkURLAllowed($url); $url = self::checkURLAllowed($url);
self::_doRedirect($url, $parameters); self::_doRedirect($url, $parameters);
} }
......
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