diff --git a/core/lib/Foswiki.pm b/core/lib/Foswiki.pm index 5e2c503120..e70668c291 100644 --- a/core/lib/Foswiki.pm +++ b/core/lib/Foswiki.pm @@ -987,7 +987,11 @@ sub cacheQuery { $query->save( \*F ); close(F); - return '/foswiki_redirect_cache/' . $uid; + if ($Foswiki::cfg{UsePathForRedirectCache}) { + return '/foswiki_redirect_cache/' . $uid; + } else { + return '?foswiki_redirect_cache=' . $uid; + } } =begin TML diff --git a/core/lib/Foswiki.spec b/core/lib/Foswiki.spec index b55f3768a0..4b7eb149bd 100644 --- a/core/lib/Foswiki.spec +++ b/core/lib/Foswiki.spec @@ -616,6 +616,14 @@ $Foswiki::cfg{RemovePortNumber} = $FALSE; # disabled and set the {PermittedRedirectHostUrls}. $Foswiki::cfg{AllowRedirectUrl} = $FALSE; +# **BOOLEAN EXPERT** +# Some authentication systems do not allow parameters to be passed in +# the target URL to be redirected to after authentication. In this case, +# Foswiki can be configured to encode the address of the parameter cache +# in the path information of the URL. Note that if you are using Apache +# rewriting rules, this may not work. +$Foswiki::cfg{UsePathForRedirectCache} = $FALSE; + # **REGEX EXPERT** # Defines the filter-in regexp that must match the names of environment # variables that can be seen using the %ENV{}% Foswiki variable. Set it to diff --git a/core/lib/Foswiki/UI.pm b/core/lib/Foswiki/UI.pm index 751dc17c9a..8d88d2df84 100644 --- a/core/lib/Foswiki/UI.pm +++ b/core/lib/Foswiki/UI.pm @@ -211,14 +211,19 @@ sub handleRequest { $sub .= $dispatcher->{function}; # Get the params cache from the path - my $cache; + my $cache = $req->param('foswiki_redirect_cache'); + + # If the path specifies a cache path, use that. It's arbitrary + # as to which takes precedence (param or path) because we should + # never have both at once. my $path_info = $req->path_info(); - if ($path_info =~ s#/foswiki_redirect_cache/([a-f0-9]{32})$##) { + if ($path_info =~ s#/foswiki_redirect_cache/([a-f0-9]{32})##) { $cache = $1; $req->path_info( $path_info ); } - if ( $cache ) { + if ( defined $cache && $cache =~ /^([a-f0-9]{32})$/ ) { + $cache = $1; # untaint; # Read cached post parameters my $passthruFilename =