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 # 2.3 Authentication by Lemonldap::NG::Portal using SOAP request
my $soap = my $soap =
SOAP::Lite->proxy($portal) SOAP::Lite->proxy( $class->portal() )
->uri('urn:Lemonldap::NG::Common::CGI::SOAPService'); ->uri('urn:Lemonldap::NG::Common::CGI::SOAPService');
$user = decode_base64($user); $user = decode_base64($user);
( $user, $pass ) = split /:/, $user; ( $user, $pass ) = split /:/, $user;

View File

@ -141,8 +141,9 @@ sub group {
# Redirects the user to the portal and exit. # Redirects the user to the portal and exit.
sub goToPortal { sub goToPortal {
my $self = shift; my $self = shift;
my $tmp = encode_base64( $self->_uri, '' ); my $tmp = encode_base64( $self->_uri, '' );
print CGI::redirect( -uri => "$portal?url=$tmp" ); print CGI::redirect(
-uri => Lemonldap::NG::Handler::_CGI->portal() . "?url=$tmp" );
exit; exit;
} }

View File

@ -35,14 +35,13 @@ our @EXPORT;
# Shared variables # Shared variables
our ( our (
$locationRegexp, $locationCondition, $defaultCondition, $locationRegexp, $locationCondition, $defaultCondition,
$forgeHeaders, $apacheRequest, $locationCount, $forgeHeaders, $apacheRequest, $locationCount,
$cookieName, $portal, $datas, $cookieName, $datas, $globalStorage,
$globalStorage, $globalStorageOptions, $localStorage, $globalStorageOptions, $localStorage, $localStorageOptions,
$localStorageOptions, $whatToTrace, $https, $whatToTrace, $https, $refLocalStorage,
$refLocalStorage, $safe, $port, $safe, $port, $statusPipe,
$statusPipe, $statusOut, $customFunctions, $statusOut, $customFunctions, $transform,
$transform,
); );
########################################## ##########################################
@ -57,8 +56,7 @@ BEGIN {
locationRules => [ locationRules => [
qw( qw(
$locationCondition $defaultCondition $locationCount $locationCondition $defaultCondition $locationCount
$locationRegexp $apacheRequest $datas $safe $portal $locationRegexp $apacheRequest $datas $safe safe $customFunctions
safe $customFunctions
) )
], ],
import => [qw( import @EXPORT_OK @EXPORT %EXPORT_TAGS )], import => [qw( import @EXPORT_OK @EXPORT %EXPORT_TAGS )],
@ -118,7 +116,6 @@ BEGIN {
threads::shared::share($forgeHeaders); threads::shared::share($forgeHeaders);
threads::shared::share($locationCount); threads::shared::share($locationCount);
threads::shared::share($cookieName); threads::shared::share($cookieName);
threads::shared::share($portal);
threads::shared::share($globalStorage); threads::shared::share($globalStorage);
threads::shared::share($globalStorageOptions); threads::shared::share($globalStorageOptions);
threads::shared::share($localStorage); threads::shared::share($localStorage);
@ -316,7 +313,7 @@ sub statusProcess {
$statusOut->writer(); $statusOut->writer();
my $fdin = $statusPipe->fileno; my $fdin = $statusPipe->fileno;
my $fdout = $statusOut->fileno; my $fdout = $statusOut->fileno;
open STDIN, "<&$fdin"; open STDIN, "<&$fdin";
open STDOUT, ">&$fdout"; open STDOUT, ">&$fdout";
my @tmp = (); my @tmp = ();
push @tmp, "-I$_" foreach (@INC); push @tmp, "-I$_" foreach (@INC);
@ -530,7 +527,7 @@ sub conditionSub {
$apacheRequest->add_output_filter( $apacheRequest->add_output_filter(
sub { sub {
return $class->redirectFilter( return $class->redirectFilter(
"$portal?url=" $class->portal() . "?url="
. $class->encodeUrl($u) . $class->encodeUrl($u)
. "&logout=1", . "&logout=1",
@_ @_
@ -571,7 +568,15 @@ sub defaultValuesInit {
# @param $args reference to the configuration hash # @param $args reference to the configuration hash
sub portalInit { sub portalInit {
my ( $class, $args ) = @_; 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) ## @imethod protected void globalStorageInit(hashRef args)
@ -709,7 +714,7 @@ qq{<html><body onload="document.getElementById('f').submit()"><form id="f" metho
sub updateStatus { sub updateStatus {
my ( $class, $user, $url, $action ) = @_; my ( $class, $user, $url, $action ) = @_;
eval { eval {
print $statusPipe "$user => " print $statusPipe "$user => "
. $apacheRequest->hostname . $apacheRequest->hostname
. "$url $action\n" . "$url $action\n"
if ($statusPipe); if ($statusPipe);
@ -820,7 +825,9 @@ sub goToPortal {
); );
my $urlc_init = $class->encodeUrl($url); my $urlc_init = $class->encodeUrl($url);
lmSetHeaderOut( $apacheRequest, lmSetHeaderOut( $apacheRequest,
'Location' => "$portal?url=$urlc_init" . ( $arg ? "&$arg" : "" ) ); 'Location' => $class->portal()
. "?url=$urlc_init"
. ( $arg ? "&$arg" : "" ) );
return REDIRECT; return REDIRECT;
} }