diff --git a/modules/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/AuthBasic.pm b/modules/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/AuthBasic.pm index 923e15cd1..a68c14bad 100644 --- a/modules/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/AuthBasic.pm +++ b/modules/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/AuthBasic.pm @@ -73,7 +73,7 @@ sub run ($$) { # 2.3 Authentication by Lemonldap::NG::Portal using SOAP request my $soap = - SOAP::Lite->proxy($portal) + SOAP::Lite->proxy( $class->portal() ) ->uri('urn:Lemonldap::NG::Common::CGI::SOAPService'); $user = decode_base64($user); ( $user, $pass ) = split /:/, $user; diff --git a/modules/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/CGI.pm b/modules/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/CGI.pm index 17f3765fb..de3843a1c 100644 --- a/modules/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/CGI.pm +++ b/modules/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/CGI.pm @@ -141,8 +141,9 @@ sub group { # Redirects the user to the portal and exit. sub goToPortal { my $self = shift; - my $tmp = encode_base64( $self->_uri, '' ); - print CGI::redirect( -uri => "$portal?url=$tmp" ); + my $tmp = encode_base64( $self->_uri, '' ); + print CGI::redirect( + -uri => Lemonldap::NG::Handler::_CGI->portal() . "?url=$tmp" ); exit; } diff --git a/modules/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Simple.pm b/modules/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Simple.pm index c9fd44774..b0359f470 100644 --- a/modules/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Simple.pm +++ b/modules/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Simple.pm @@ -35,14 +35,13 @@ our @EXPORT; # Shared variables our ( - $locationRegexp, $locationCondition, $defaultCondition, - $forgeHeaders, $apacheRequest, $locationCount, - $cookieName, $portal, $datas, - $globalStorage, $globalStorageOptions, $localStorage, - $localStorageOptions, $whatToTrace, $https, - $refLocalStorage, $safe, $port, - $statusPipe, $statusOut, $customFunctions, - $transform, + $locationRegexp, $locationCondition, $defaultCondition, + $forgeHeaders, $apacheRequest, $locationCount, + $cookieName, $datas, $globalStorage, + $globalStorageOptions, $localStorage, $localStorageOptions, + $whatToTrace, $https, $refLocalStorage, + $safe, $port, $statusPipe, + $statusOut, $customFunctions, $transform, ); ########################################## @@ -57,8 +56,7 @@ BEGIN { locationRules => [ qw( $locationCondition $defaultCondition $locationCount - $locationRegexp $apacheRequest $datas $safe $portal - safe $customFunctions + $locationRegexp $apacheRequest $datas $safe safe $customFunctions ) ], import => [qw( import @EXPORT_OK @EXPORT %EXPORT_TAGS )], @@ -118,7 +116,6 @@ BEGIN { threads::shared::share($forgeHeaders); threads::shared::share($locationCount); threads::shared::share($cookieName); - threads::shared::share($portal); threads::shared::share($globalStorage); threads::shared::share($globalStorageOptions); threads::shared::share($localStorage); @@ -316,7 +313,7 @@ sub statusProcess { $statusOut->writer(); my $fdin = $statusPipe->fileno; my $fdout = $statusOut->fileno; - open STDIN, "<&$fdin"; + open STDIN, "<&$fdin"; open STDOUT, ">&$fdout"; my @tmp = (); push @tmp, "-I$_" foreach (@INC); @@ -530,7 +527,7 @@ sub conditionSub { $apacheRequest->add_output_filter( sub { return $class->redirectFilter( - "$portal?url=" + $class->portal() . "?url=" . $class->encodeUrl($u) . "&logout=1", @_ @@ -571,7 +568,15 @@ sub defaultValuesInit { # @param $args reference to the configuration hash sub portalInit { my ( $class, $args ) = @_; - $portal = $args->{portal} or die("portal parameter required"); + die("portal parameter required") unless ( $args->{portal} ); + if ( $args->{portal} =~ /[\$\(&\|"']/ ) { + my $portal = $class->conditionSub( $args->{portal} ); + eval "sub portal {return &\$portal}"; + die("Unable to read portal parameter ($@)") if ($@); + } + else { + eval "sub portal {return '$args->{portal}'}"; + } } ## @imethod protected void globalStorageInit(hashRef args) @@ -709,7 +714,7 @@ qq{
" + print $statusPipe "$user => " . $apacheRequest->hostname . "$url $action\n" if ($statusPipe); @@ -820,7 +825,9 @@ sub goToPortal { ); my $urlc_init = $class->encodeUrl($url); lmSetHeaderOut( $apacheRequest, - 'Location' => "$portal?url=$urlc_init" . ( $arg ? "&$arg" : "" ) ); + 'Location' => $class->portal() + . "?url=$urlc_init" + . ( $arg ? "&$arg" : "" ) ); return REDIRECT; }