Commit baf74b2c authored by Xavier Guimard's avatar Xavier Guimard

LEMONLDAP::NG :

              stable : bug correction: existingSessions was never called in Portal/Simple.pm
              trunk  : new feature: logout
parent 4cbae575
Revision history for Perl extension Lemonldap::NG::Handler.
0.77 Wed Mar 14 7:18:48 2007
- logout system
0.76 Fri Mar 9 7:14:42 2007
- Little bug correction
- Delete of DBI.pm which is not more in use
0.75 Sat Feb 24 16:36:56
0.75 Sat Feb 24 16:36:56 2007
- Adding cross-domain-authentication support
- local configuration overrides global configuration
......
......@@ -9,6 +9,9 @@
Allow from 127.0.0.0/8
PerlHeaderParserHandler My::Package->refresh
</Location>
<Location /logout>
PerlHeaderParserHandler My::Package->logout
</Location>
# Just to make example running (index.pl display authenticated user)
DocumentRoot __DIR__
......
......@@ -10,6 +10,9 @@ PerlOptions +GlobalRequest
Allow from 127.0.0.0/8
PerlHeaderParserHandler My::Package->refresh
</Location>
<Location /logout>
PerlHeaderParserHandler My::Package->logout
</Location>
# Just to make example running (index.pl display authenticated user)
DocumentRoot __DIR__
......
......@@ -67,6 +67,17 @@ sub run($$) {
return $class->SUPER::run($r);
}
sub logout($$) {
my ( $class, $r ) = @_;
if ( time() - $lastReload > $reloadTime ) {
unless ( $class->localConfUpdate($r) == OK ) {
$class->lmLog( "$class: No configuration found", 'error' );
return SERVER_ERROR;
}
}
return $class->SUPER::logout($r);
}
sub confTest($$) {
my ( $class, $args ) = @_;
if ( $args->{_n_conf} ) {
......
......@@ -418,7 +418,7 @@ sub hideCookie {
# Redirect non-authenticated users to the portal
sub goToPortal() {
my ( $class, $url ) = @_;
my ( $class, $url, $arg ) = @_;
my $urlc_init =
encode_base64( "http"
. ( $https ? "s" : "" ) . "://"
......@@ -431,7 +431,9 @@ sub goToPortal() {
. " to portal (url was $url)",
'debug'
);
$apacheRequest->headers_out->set( 'Location' => "$portal?url=$urlc_init" );
$apacheRequest->headers_out->set(
'Location' => "$portal?url=$urlc_init" . ( $arg ? "&$arg" : "" )
);
return REDIRECT;
}
......@@ -527,6 +529,13 @@ sub unprotect {
DONE;
}
sub logout ($$) {
my $class;
($class, $apacheRequest ) = @_;
my $uri = $apacheRequest->uri . ( $apacheRequest->args ? "?" . $apacheRequest->args : "" );
return $class->goToPortal( $uri, 'logout=1' );
}
1;
__END__
......
Revision history for Perl extension Lemonldap::NG::Portal.
0.65 Wed Mar 14 7:10:40 2007
- New feature: single logout
- bug correction: existingSessions was never called
0.64 Fri Mar 9 17:49:44
- Delete of DBI.pm which is no more in use
0.63 Thu Feb 2 20:44:43
0.63 Thu Feb 2 20:44:43 2007
- Adding CAS authentication compatibility system
- New i18n system for errors
0.62 Wed Feb 28 23:22:14
0.62 Wed Feb 28 23:22:14 2007
- Adding cross-domain-authentication mechanism
- local configuration overrides global configuration
0.61 Sun Feb 11 9:10:12
0.61 Sun Feb 11 9:10:12 2007
- Existing sessions are now checked
0.6 Sat Jan 6 20:17:15
0.6 Sat Jan 6 20:17:15 2007
- Use Safe->reval instead of eval
- Perl expressions in 'groups' has not to be enclosed in {} if no LDAP
filter is used
- Corrections in documentation
0.5 Tue Dec 19 19:11:15
0.5 Tue Dec 19 19:11:15 2006
- config is now shared with Lemonldap::NG::Manager::Conf
0.42 Thu Dec 7 12:23:52 2006
......
......@@ -140,9 +140,9 @@ sub process {
my ($self) = @_;
$self->{error} = PE_OK;
foreach my $sub
qw(controlUrlOrigin extractFormInfo formateParams formateFilter
connectLDAP bind search setSessionInfo setMacros setGroups authenticate
store unbind buildCookie log autoRedirect) {
qw(controlUrlOrigin controlExistingSession extractFormInfo formateParams
formateFilter connectLDAP bind search setSessionInfo setMacros setGroups
authenticate store unbind buildCookie log autoRedirect) {
if ( $self->{$sub} )
{
last if ( $self->{error} = &{ $self->{$sub} }($self) );
......@@ -173,24 +173,32 @@ sub controlExistingSession {
my $self = shift;
my %cookies = fetch CGI::Cookie;
# Test if Lemonldap::NG cookie is available
if ( my $id = $cookies{$self->{cookieName}}) {
my $h;
if ( my $id = $cookies{$self->{cookieName}}->value ) {
my %h;
# Trying to recover session from global session storage
eval {
tie $h, $self->{globalStorage}, $id, $self->{globalStorageOptions};
tie %h, $self->{globalStorage}, $id, $self->{globalStorageOptions};
};
if ( $@ or not tied($h) ) {
if ( $@ or not tied(%h) ) {
# Session not available (expired ?)
print STDERR "Session $id isn't yet available ($ENV{REMOTE_ADDR})";
print STDERR "Session $id isn't yet available ($ENV{REMOTE_ADDR})\n";
return PE_OK;
}
# Logout if required
if($self->param('logout')) {
tied(%h)->delete;
return PE_FIRSTACCESS;
}
# A session has been find => calling &existingSession
my $r;
my($r, $datas);
%$datas = %h;
untie(%h);
if ( $self->{existingSession} ) {
$r = &{ $self->{existingSession} }($self, $id, \$h)
$r = &{ $self->{existingSession} }($self, $id, $datas)
}
else {
$r = $self->existingSession($id, \$h);
$r = $self->existingSession($id, $datas);
}
if ( $r == PE_DONE) {
for my $sub qw(log autoRedirect) {
......
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