portal can be now an expression in the handler

This commit is contained in:
Xavier Guimard 2009-04-02 06:07:01 +00:00
parent 3b8b909f23
commit 2d2721308c
3 changed files with 27 additions and 19 deletions

View File

@ -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;

View File

@ -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;
}

View File

@ -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{<html><body onload="document.getElementById('f').submit()"><form id="f" metho
sub updateStatus {
my ( $class, $user, $url, $action ) = @_;
eval {
print $statusPipe "$user => "
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;
}