CDA in progress...

This commit is contained in:
Xavier Guimard 2007-02-23 06:34:29 +00:00
parent 4ad93eab3e
commit e7c036efe3
2 changed files with 20 additions and 9 deletions

View File

@ -14,21 +14,29 @@ our @ISA = qw(Lemonldap::NG::Handler::SharedConf);
sub run ($$) {
my $class;
( $class, $apacheRequest ) = @_;
#my $uri = $apacheRequest->uri . ( $apacheRequest->args ? "?" . $apacheRequest->args : "" );
my $args = $apacheRequest->args;
if ($args =~ /\?($cookieName=\w+)$/o) {
if ($args =~ s/\?($cookieName=\w+)$//o) {
my $str = $1;
$class->lmLog(
"Found a CDA id. Redirecting "
. $apacheRequest->connection->remote_ip
. " to myself with new cookie",
'debug'
. $apacheRequest->connection->remote_ip
. " to myself with new cookie",
'debug'
);
# TODO: https ?
$apacheRequest->headers_out->set( 'Location' => "http://".$apacheRequest->hostname );
$apacheRequest->args ( $args );
$apacheRequest->headers_out->set(
'Location' => "http"
. ($https ? 's' : '')
. "://" . $apacheRequest->get_server_name() . "/"
. $apacheRequest->uri
. ( $apacheRequest->args ? "?" . $apacheRequest->args : "" )
);
# TODO: cookie secured ?
$apacheRequest->headers_out->set( 'Set-Cookie' => "$str" );
return REDIRECT;
return REDIRECT;
}
else {
return $class->SUPER::run( $apacheRequest );
}
}

View File

@ -28,6 +28,8 @@ our %EXPORT_TAGS = (
lmSetHeaderOut
lmSetErrHeaderOut
$cookieName
$cookieSecured
$https
)
],
traces => [ qw( $whatToTrace ) ],
@ -51,7 +53,7 @@ our (
$cookieName, $portal, $datas,
$globalStorage, $globalStorageOptions, $localStorage,
$localStorageOptions, $whatToTrace, $https,
$refLocalStorage, $safe,
$refLocalStorage, $safe, $cookieSecured,
);
##########################################
@ -323,6 +325,7 @@ sub defaultValuesInit {
# Other values
$cookieName = $args->{cookieName} || 'lemon';
$cookieSecured = $args->{cookieSecured} || 0;
$whatToTrace = $args->{whatToTrace} || '$uid';
$whatToTrace =~ s/\$//g;
$https = $args->{https} unless defined($https);