Commit e7c036ef authored by Xavier Guimard's avatar Xavier Guimard

CDA in progress...

parent 4ad93eab
......@@ -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 );
}
}
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment