|
|
|
@ -104,6 +104,122 @@ sub controlUrl { |
|
|
|
|
PE_OK; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
sub checkLogout { |
|
|
|
|
my ( $self, $req ) = @_; |
|
|
|
|
if ( $req->param('logout') ) { |
|
|
|
|
my $apacheSession = $self->getApacheSession($req->id); |
|
|
|
|
unless ( $self->_deleteSession( $req, $apacheSession ) ) { |
|
|
|
|
$self->lmLog( "Unable to delete session ".$req->id, 'error' ); |
|
|
|
|
$self->lmLog( $apacheSession->error, 'error' ); |
|
|
|
|
return PE_ERROR; |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
$self->lmLog( "Session $req->{id} deleted from global storage", 'debug' ); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# TODO |
|
|
|
|
# Call issuerDB logout on each used issuerDBmodule |
|
|
|
|
#my $issuerDBList = $req->{sessionInfo}->{_issuerDB}; |
|
|
|
|
#if ( defined $issuerDBList ) { |
|
|
|
|
# foreach my $issuerDBtype ( |
|
|
|
|
# split( /\Q$self->{conf}->{multiValuesSeparator}\E/o, $issuerDBList ) ) |
|
|
|
|
# { |
|
|
|
|
# my $module_name = "Lemonldap::NG::Portal::IssuerDB/$issuerDBtype"; |
|
|
|
|
# $self->lmLog( |
|
|
|
|
# "Process logout for issuerDB module $issuerDBtype", |
|
|
|
|
# 'debug' ); |
|
|
|
|
|
|
|
|
|
# $self->{error} = $self->_subProcess( |
|
|
|
|
# $module_name . "::issuerDBInit", |
|
|
|
|
# $module_name . '::issuerLogout' |
|
|
|
|
# ); |
|
|
|
|
|
|
|
|
|
# } |
|
|
|
|
#} |
|
|
|
|
|
|
|
|
|
# Call logout for the module used to authenticate |
|
|
|
|
#$self->lmLog( |
|
|
|
|
# "Process logout for authentication module " |
|
|
|
|
# . $self->{sessionInfo}->{_auth}, |
|
|
|
|
# 'debug' |
|
|
|
|
#); |
|
|
|
|
|
|
|
|
|
#if ( $self->{sessionInfo}->{'_auth'} ne $self->get_module('auth') ) { |
|
|
|
|
# my $module_name = |
|
|
|
|
# 'Lemonldap::NG::Portal::Auth' . $self->{sessionInfo}->{_auth}; |
|
|
|
|
|
|
|
|
|
# unless ( $self->loadModule($module_name) ) { |
|
|
|
|
# $self->lmLog( "Unable to load $module_name", 'error' ); |
|
|
|
|
# } |
|
|
|
|
# else { |
|
|
|
|
# eval { |
|
|
|
|
# $self->{error} = $self->_subProcess( |
|
|
|
|
# $module_name . "::authInit", |
|
|
|
|
# $module_name . "::authLogout" |
|
|
|
|
# ); |
|
|
|
|
# }; |
|
|
|
|
# } |
|
|
|
|
#} |
|
|
|
|
#else { |
|
|
|
|
# eval { |
|
|
|
|
# $self->{error} = $self->_subProcess( 'authInit', 'authLogout' ); |
|
|
|
|
# }; |
|
|
|
|
#} |
|
|
|
|
#if ($@) { |
|
|
|
|
# $self->lmLog( "Error when calling authentication logout: $@", |
|
|
|
|
# 'debug' ); |
|
|
|
|
#} |
|
|
|
|
#return $self->{error} if $self->{error} > 0; |
|
|
|
|
|
|
|
|
|
# Collect logout services and build hidden iFrames |
|
|
|
|
#if ( $self->{logoutServices} and %{ $self->{logoutServices} } ) { |
|
|
|
|
|
|
|
|
|
# $self->lmLog( "Create iFrames to forward logout to services", |
|
|
|
|
# 'debug' ); |
|
|
|
|
|
|
|
|
|
# $self->info( "<h3>" . $self->msg(PM_LOGOUT) . "</h3>" ); |
|
|
|
|
|
|
|
|
|
# foreach ( keys %{ $self->{logoutServices} } ) { |
|
|
|
|
# my $logoutServiceName = $_; |
|
|
|
|
# my $logoutServiceUrl = |
|
|
|
|
# $self->{logoutServices}->{$logoutServiceName}; |
|
|
|
|
|
|
|
|
|
# $self->lmLog( |
|
|
|
|
#"Find lo#gout service $logoutServiceName ($logoutServiceUrl)", |
|
|
|
|
|
|
|
|
|
# 'debug' |
|
|
|
|
# ); |
|
|
|
|
|
|
|
|
|
# my $iframe = |
|
|
|
|
# "<iframe src=\"$logoutServiceUrl\"" |
|
|
|
|
# . " alt=\"$logoutServiceName\" marginwidth=\"0\"" |
|
|
|
|
# . " marginheight=\"0\" scrolling=\"no\" style=\"border: none;display: hidden;margin: 0\"" |
|
|
|
|
# . " width=\"0\" height=\"0\" frameborder=\"0\">" |
|
|
|
|
# . "</iframe>"; |
|
|
|
|
|
|
|
|
|
# $self->info($iframe); |
|
|
|
|
# } |
|
|
|
|
|
|
|
|
|
# # Redirect on logout page if no other target defined |
|
|
|
|
# if ( !$self->{urldc} and !$self->{postUrl} ) { |
|
|
|
|
# $self->{urldc} = $ENV{SCRIPT_NAME} . "?logout=1"; |
|
|
|
|
# } |
|
|
|
|
#} |
|
|
|
|
|
|
|
|
|
# Redirect or Post if asked by authLogout |
|
|
|
|
#return $self->_subProcess(qw(autoRedirect)) |
|
|
|
|
# if ( $self->{urldc} |
|
|
|
|
# and $self->{urldc} ne $self->{portal} ); |
|
|
|
|
|
|
|
|
|
#return $self->_subProcess(qw(autoPost)) |
|
|
|
|
# if ( $self->{postUrl} ); |
|
|
|
|
|
|
|
|
|
# Display logout message |
|
|
|
|
return PE_LOGOUT_OK; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# Check value to detect XSS attack |
|
|
|
|
# @param name Parameter name |
|
|
|
|
# @param value Parameter value |
|
|
|
|