Auth CAS: keep URL parameters in CAS callback URL
This commit is contained in:
parent
c71109124c
commit
fbd24ff1b9
2 changed files with 15 additions and 17 deletions
|
@ -103,12 +103,11 @@ class Cas extends Method {
|
|||
* @return string
|
||||
*/
|
||||
private static function get_cas_callback_url() {
|
||||
return Url :: get_absolute_url(
|
||||
'login/cas_callback?next='.(
|
||||
isset($_REQUEST['next'])?
|
||||
$_REQUEST['next']:
|
||||
urlencode(Url :: get_current_url())
|
||||
)
|
||||
return Url :: add_url_parameter(
|
||||
Url :: get_absolute_url('login/cas_callback'),
|
||||
'next',
|
||||
isset($_REQUEST['next'])?$_REQUEST['next']:urlencode(Url :: get_current_url(true)),
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
|
|
21
src/Url.php
21
src/Url.php
|
@ -332,9 +332,11 @@ class Url {
|
|||
/**
|
||||
* Retreive current requested URL and return it
|
||||
*
|
||||
* @param bool $with_parameters Set to true to retreive current URL with GET parameters
|
||||
*
|
||||
* @return string|false The current request URL or false if fail
|
||||
**/
|
||||
public static function get_current_url() {
|
||||
public static function get_current_url($with_parameters=false) {
|
||||
Log :: trace("URL : request URI = '".$_SERVER['REQUEST_URI']."'");
|
||||
|
||||
$base = self :: get_rewrite_base();
|
||||
|
@ -351,16 +353,13 @@ class Url {
|
|||
|
||||
$current_url = substr($_SERVER['REQUEST_URI'], strlen($base));
|
||||
|
||||
// URL contain params ?
|
||||
$params_start = strpos($current_url, '?');
|
||||
if ($params_start !== false)
|
||||
// Params detected, remove it
|
||||
|
||||
// No url / currrent url start by '?' ?
|
||||
if ($params_start == 0)
|
||||
return '';
|
||||
else
|
||||
return substr($current_url, 0, $params_start);
|
||||
if (!$with_parameters) {
|
||||
// URL contain params ?
|
||||
$params_start = strpos($current_url, '?');
|
||||
if ($params_start !== false)
|
||||
// Params detected, remove it
|
||||
$current_url = substr($current_url, 0, $params_start);
|
||||
}
|
||||
|
||||
return $current_url;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue