* syslog facility was not taken in account * Missing HTTP::Headers dependency * lmConfigEditor must not display reVHosts and cipher which are calculated by Conf.pm * bad Apache security in Debian configuration filesenvironments/ppa-mbqj77/deployments/1
parent
38d5fabc90
commit
48ac5bd591
@ -0,0 +1,72 @@ |
||||
## @file |
||||
# Relay authentication module |
||||
|
||||
## @class |
||||
# Relay authentication module: It simply call another Lemonldap::NG portal by |
||||
# SOAP using credentials |
||||
package Lemonldap::NG::Portal::AuthRelay; |
||||
|
||||
use strict; |
||||
use Lemonldap::NG::Portal::_Relay; |
||||
use Lemonldap::NG::Portal::_WebForm; |
||||
use Lemonldap::NG::Portal::Simple; |
||||
use base qw(Lemonldap::NG::Portal::_WebForm Lemonldap::NG::Portal::_Relay); |
||||
|
||||
our $VERSION = '0.1'; |
||||
|
||||
## @apmethod int authInit() |
||||
# Call Lemonldap::NG::Portal::_Relay::relayInit(); |
||||
# @return Lemonldap::NG::Portal constant |
||||
*authInit = *Lemonldap::NG::Portal::_Relay::relayInit; |
||||
|
||||
## @apmethod int authenticate() |
||||
# Call Lemonldap::NG::Portal::_Relay::relayQuery() |
||||
# @return Lemonldap::NG::Portal constant |
||||
*authenticate = *Lemonldap::NG::Portal::_Relay::relayQuery; |
||||
|
||||
## @apmethod int setAuthSessionInfo() |
||||
# Call Lemonldap::NG::Portal::_Relay::setSessionInfo() |
||||
# @return Lemonldap::NG::Portal constant |
||||
*setAuthSessionInfo = *Lemonldap::NG::Portal::_Relay::setSessionInfo; |
||||
|
||||
1; |
||||
|
||||
__END__ |
||||
|
||||
=head1 NAME |
||||
|
||||
Lemonldap::NG::Portal::AuthRelay - Authentication module for Lemonldap::NG |
||||
that delegates authentication to a remote Lemonldap::NG portal. |
||||
|
||||
=head1 SYNOPSIS |
||||
|
||||
use Lemonldap::NG::Portal::Simple; |
||||
my $portal = new Lemonldap::NG::Portal::Simple( |
||||
|
||||
# AUTHENTICATION PART |
||||
authentication => 'Relay', |
||||
); |
||||
|
||||
=head1 DESCRIPTION |
||||
|
||||
Authentication module for Lemonldap::NG portal that forward credentials to a |
||||
remote portal using SOAP. |
||||
|
||||
=head1 SEE ALSO |
||||
|
||||
L<http://lemonldap.objectweb.org/> |
||||
L<http://wiki.lemonldap.objectweb.org/xwiki/bin/view/NG/AuthRelay> |
||||
|
||||
=head1 AUTHOR |
||||
|
||||
Xavier Guimard, E<lt>x.guimard@free.frE<gt> |
||||
|
||||
=head1 COPYRIGHT AND LICENSE |
||||
|
||||
Copyright (C) 2009 by Xavier Guimard |
||||
|
||||
This library is free software; you can redistribute it and/or modify |
||||
it under the same terms as Perl itself, either Perl version 5.10.0 or, |
||||
at your option, any later version of Perl 5 you may have available. |
||||
|
||||
=cut |
@ -0,0 +1,29 @@ |
||||
## @file |
||||
# Relay userDB mechanism |
||||
|
||||
## @class |
||||
# Relay userDB mechanism class |
||||
package Lemonldap::NG::Portal::UserDBRelay; |
||||
|
||||
use strict; |
||||
use Lemonldap::NG::Portal::_Relay; |
||||
use Lemonldap::NG::Portal::Simple; |
||||
use base qw(Lemonldap::NG::Portal::_Relay); |
||||
|
||||
our $VERSION = '0.1'; |
||||
|
||||
## @apmethod int userDBInit() |
||||
# Call Lemonldap::NG::Portal::_Relay::relayInit(); |
||||
# @return Lemonldap::NG::Portal constant |
||||
*userDBInit = *Lemonldap::NG::Portal::_Relay::relayInit; |
||||
|
||||
## @apmethod int getUser() |
||||
# Call Lemonldap::NG::Portal::_Relay::relayQuery() |
||||
# @return Lemonldap::NG::Portal constant |
||||
*getUser = *Lemonldap::NG::Portal::_Relay::relayQuery; |
||||
|
||||
sub setGroups { |
||||
PE_OK; |
||||
} |
||||
1; |
||||
|
@ -0,0 +1,91 @@ |
||||
## @file |
||||
# Relay authentication and userDB base. |
||||
|
||||
## @class |
||||
# Relay authentication and userDB base class. |
||||
package Lemonldap::NG::Portal::_Relay; |
||||
|
||||
use strict; |
||||
use Lemonldap::NG::Portal::Simple; |
||||
use MIME::Base64; |
||||
use SOAP::Lite; |
||||
|
||||
our $VERSION = '0.1'; |
||||
|
||||
## @apmethod int relayInit() |
||||
# Checks if remote portal parameters are set. |
||||
# @return Lemonldap::NG::Portal constant |
||||
sub relayInit { |
||||
my $self = shift; |
||||
return PE_OK if ( $self->{_relayInitDone} ); |
||||
my @missing = (); |
||||
foreach (qw(soapAuthService)) { |
||||
push @missing, $_ unless ( defined( $self->{$_} ) ); |
||||
} |
||||
$self->{soapSessionService} ||= |
||||
$self->{soapAuthService} . 'index.pl/sessions'; |
||||
$self->{soapSessionService} =~ s/\.plindex.pl/\.pl/; |
||||
$self->{remoteCookieName} ||= $self->{cookieName}; |
||||
$self->abort( "Missing parameters", |
||||
"Required parameters: " . join( ', ', @missing ) ) |
||||
if (@missing); |
||||
$self->{_relayInitDone}++; |
||||
PE_OK; |
||||
} |
||||
|
||||
## @apmethod int relayQuery() |
||||
# Queries the remote portal to authenticate users using given credentials |
||||
sub relayQuery { |
||||
my $self = shift; |
||||
return PE_OK if ( $self->{_relayQueryDone} ); |
||||
my $soap = |
||||
SOAP::Lite->proxy( $self->{soapAuthService} ) |
||||
->uri('urn:Lemonldap::NG::Common::CGI::SOAPService'); |
||||
my $r = $soap->getCookies( $self->{user}, $self->{password} ); |
||||
if ( $r->fault ) { |
||||
$self->abort( "Unable to query authentication service", |
||||
$r->fault->{faultstring} ); |
||||
} |
||||
my $res = $r->result(); |
||||
|
||||
# If authentication failed, display error |
||||
if ( $res->{error} ) { |
||||
$self->_sub( 'userError', |
||||
"Authentication failed for $self->{user} " |
||||
. $soap->error( 'fr', $res->{error} )->result() ); |
||||
return PE_BADCREDENTIALS; |
||||
} |
||||
$self->{remoteId} = $res->{cookies}->{ $self->{remoteCookieName} } |
||||
or $self->abort("No cookie named $self->{remoteCookieName}"); |
||||
$self->{_relayQueryDone}++; |
||||
PE_OK; |
||||
} |
||||
|
||||
## @apmethod int setSessionInfo() |
||||
# Queries the remote portal to get users attributes and |
||||
# store them in local session |
||||
sub setSessionInfo { |
||||
my $self = shift; |
||||
return PE_OK if ( $self->{_setSessionInfoDone} ); |
||||
my $soap = |
||||
SOAP::Lite->proxy( $self->{soapSessionService} ) |
||||
->uri('urn:Lemonldap::NG::Common::CGI::SOAPService'); |
||||
my $r = $soap->getAttributes( $self->{remoteId} ); |
||||
if ( $r->fault ) { |
||||
$self->abort( "Unable to query authentication service", |
||||
$r->fault->{faultstring} ); |
||||
} |
||||
my $res = $r->result(); |
||||
if ( $res->{error} ) { |
||||
$self->_sub( 'userError', |
||||
"Unable to get attributes for $self->{user} " ); |
||||
return PE_ERROR; |
||||
} |
||||
$self->{sessionInfo}->{$_} ||= $res->{attributes}->{$_} |
||||
foreach ( keys %{ $res->{attributes} } ); |
||||
$self->{_setSessionInfoDone}++; |
||||
PE_OK; |
||||
} |
||||
|
||||
1; |
||||
|
Loading…
Reference in new issue