parent
827f9a1154
commit
b239dc286f
|
@ -76,7 +76,7 @@ sub run ($$) {
|
||||||
# Add client IP as X-Forwarded-For IP in SOAP request
|
# Add client IP as X-Forwarded-For IP in SOAP request
|
||||||
my $xheader = lmHeaderIn( $apacheRequest, 'X-Forwarded-For' );
|
my $xheader = lmHeaderIn( $apacheRequest, 'X-Forwarded-For' );
|
||||||
$xheader .= ", " if ($xheader);
|
$xheader .= ", " if ($xheader);
|
||||||
$xheader .= $apacheRequest->connection->remote_ip;
|
$xheader .= $class->ip();
|
||||||
my $soapHeaders =
|
my $soapHeaders =
|
||||||
HTTP::Headers->new( "X-Forwarded-For" => $xheader );
|
HTTP::Headers->new( "X-Forwarded-For" => $xheader );
|
||||||
|
|
||||||
|
@ -121,8 +121,8 @@ sub run ($$) {
|
||||||
# The cookie isn't yet available
|
# The cookie isn't yet available
|
||||||
$class->lmLog( "The cookie $cv isn't yet available: $@",
|
$class->lmLog( "The cookie $cv isn't yet available: $@",
|
||||||
'info' );
|
'info' );
|
||||||
$class->updateStatus( $apacheRequest->connection->remote_ip,
|
$class->updateStatus( $class->ip(), $apacheRequest->uri,
|
||||||
$apacheRequest->uri, 'EXPIRED' );
|
'EXPIRED' );
|
||||||
return $class->goToPortal($uri);
|
return $class->goToPortal($uri);
|
||||||
}
|
}
|
||||||
$datas->{$_} = $h{$_} foreach ( keys %h );
|
$datas->{$_} = $h{$_} foreach ( keys %h );
|
||||||
|
|
|
@ -445,7 +445,8 @@ sub safe {
|
||||||
# Share objets with Safe jail
|
# Share objets with Safe jail
|
||||||
$safe->share_from( 'Lemonldap::NG::Common::Safelib',
|
$safe->share_from( 'Lemonldap::NG::Common::Safelib',
|
||||||
$Lemonldap::NG::Common::Safelib::functions );
|
$Lemonldap::NG::Common::Safelib::functions );
|
||||||
$safe->share( '&encode_base64', '$datas', '&portal', '$apacheRequest', @t );
|
$safe->share( '&encode_base64', '&ip', '$datas', '&portal',
|
||||||
|
'$apacheRequest', @t );
|
||||||
|
|
||||||
return $safe;
|
return $safe;
|
||||||
}
|
}
|
||||||
|
@ -852,12 +853,8 @@ sub encodeUrl {
|
||||||
# @return Apache2::Const::REDIRECT
|
# @return Apache2::Const::REDIRECT
|
||||||
sub goToPortal {
|
sub goToPortal {
|
||||||
my ( $class, $url, $arg ) = splice @_;
|
my ( $class, $url, $arg ) = splice @_;
|
||||||
$class->lmLog(
|
$class->lmLog( "Redirect " . $class->ip() . " to portal (url was $url)",
|
||||||
"Redirect "
|
'debug' );
|
||||||
. $apacheRequest->connection->remote_ip
|
|
||||||
. " to portal (url was $url)",
|
|
||||||
'debug'
|
|
||||||
);
|
|
||||||
my $urlc_init = $class->encodeUrl($url);
|
my $urlc_init = $class->encodeUrl($url);
|
||||||
lmSetHeaderOut( $apacheRequest,
|
lmSetHeaderOut( $apacheRequest,
|
||||||
'Location' => $class->portal()
|
'Location' => $class->portal()
|
||||||
|
@ -923,6 +920,12 @@ sub retrieveSession {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub ip {
|
||||||
|
my $ip = 'unknownIP';
|
||||||
|
eval { $ip = $apacheRequest->connection->remote_ip };
|
||||||
|
return $ip;
|
||||||
|
}
|
||||||
|
|
||||||
# MAIN SUBROUTINE called by Apache (using PerlHeaderParserHandler option)
|
# MAIN SUBROUTINE called by Apache (using PerlHeaderParserHandler option)
|
||||||
|
|
||||||
## @rmethod int run(Apache2::RequestRec apacheRequest)
|
## @rmethod int run(Apache2::RequestRec apacheRequest)
|
||||||
|
@ -988,8 +991,7 @@ sub run ($$) {
|
||||||
|
|
||||||
if ( $protection == SKIP ) {
|
if ( $protection == SKIP ) {
|
||||||
$class->lmLog( "Access control skipped", "debug" );
|
$class->lmLog( "Access control skipped", "debug" );
|
||||||
$class->updateStatus( $apacheRequest->connection->remote_ip,
|
$class->updateStatus( $class->ip(), $apacheRequest->uri, 'SKIP' );
|
||||||
$apacheRequest->uri, 'SKIP' );
|
|
||||||
$class->hideCookie;
|
$class->hideCookie;
|
||||||
$class->cleanHeaders;
|
$class->cleanHeaders;
|
||||||
return OK;
|
return OK;
|
||||||
|
@ -1039,8 +1041,7 @@ sub run ($$) {
|
||||||
|
|
||||||
# Ignore unprotected URIs
|
# Ignore unprotected URIs
|
||||||
$class->lmLog( "No valid session but unprotected access", "debug" );
|
$class->lmLog( "No valid session but unprotected access", "debug" );
|
||||||
$class->updateStatus( $apacheRequest->connection->remote_ip,
|
$class->updateStatus( $class->ip(), $apacheRequest->uri, 'UNPROTECT' );
|
||||||
$apacheRequest->uri, 'UNPROTECT' );
|
|
||||||
$class->hideCookie;
|
$class->hideCookie;
|
||||||
$class->cleanHeaders;
|
$class->cleanHeaders;
|
||||||
return OK;
|
return OK;
|
||||||
|
@ -1053,8 +1054,8 @@ sub run ($$) {
|
||||||
unless ($id);
|
unless ($id);
|
||||||
|
|
||||||
# if the cookie was fetched, a log is sent by retrieveSession()
|
# if the cookie was fetched, a log is sent by retrieveSession()
|
||||||
$class->updateStatus( $apacheRequest->connection->remote_ip,
|
$class->updateStatus( $class->ip(), $apacheRequest->uri,
|
||||||
$apacheRequest->uri, $id ? 'EXPIRED' : 'REDIRECT' );
|
$id ? 'EXPIRED' : 'REDIRECT' );
|
||||||
return $class->goToPortal($uri_orig);
|
return $class->goToPortal($uri_orig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1716,8 +1717,7 @@ sub unlog ($$) {
|
||||||
my $class;
|
my $class;
|
||||||
( $class, $apacheRequest ) = splice @_;
|
( $class, $apacheRequest ) = splice @_;
|
||||||
$class->localUnlog;
|
$class->localUnlog;
|
||||||
$class->updateStatus( $apacheRequest->connection->remote_ip,
|
$class->updateStatus( $class->ip(), $apacheRequest->uri, 'LOGOUT' );
|
||||||
$apacheRequest->uri, 'LOGOUT' );
|
|
||||||
return $class->goToPortal( '/', 'logout=1' );
|
return $class->goToPortal( '/', 'logout=1' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user