Allow getCookies webservice to be used with Multi backend (#519)

This commit is contained in:
Clément Oudot 2012-09-08 17:20:08 +00:00
parent 52814914de
commit 2d7c4fd864
4 changed files with 25 additions and 7 deletions

View File

@ -9,9 +9,11 @@ use strict;
use Lemonldap::NG::Portal::Simple;
use Lemonldap::NG::Portal::AuthNull;
our $VERSION = '1.2.0';
our $VERSION = '1.2.2';
our @ISA = qw(Lemonldap::NG::Portal::AuthNull);
*authenticate = *extractFormInfo;
## @apmethod int authInit()
# Check if SSL environment variables are set.
# @return Lemonldap::NG::Portal constant

View File

@ -1931,6 +1931,7 @@ sub existingSession {
#@return Lemonldap::NG::Portal constant
sub extractFormInfo {
my $self = shift;
return PE_OK if $self->{skipExtractFormInfo};
$self->{checkLogins} = $self->param('checkLogins');
return $self->SUPER::extractFormInfo;
}

View File

@ -12,7 +12,7 @@ package Lemonldap::NG::Portal::_Multi;
use Lemonldap::NG::Portal::Simple;
our $VERSION = '1.0.6';
our $VERSION = '1.2.2';
## @cmethod Lemonldap::NG::Portal::_Multi new(Lemonldap::NG::Portal::Simple portal)
# Constructor
@ -71,7 +71,8 @@ sub try {
if ( $ci = $self->{p}->safe->reval( $self->{stack}->[$type]->[0]->{c} ) ) {
# Log used module
$self->{p}->lmLog( "Multi (type $type): trying module $old", 'debug' );
$self->{p}
->lmLog( "Multi (type $type): trying $sub for module $old", 'debug' );
# Run subroutine
$res = $self->{p}->$s();
@ -104,6 +105,7 @@ sub try {
# return true if an other module is available
sub next {
my ( $self, $type ) = splice @_;
if ( $self->{stack}->[$type]->[0]->{n} eq
$self->{stack}->[ 1 - $type ]->[0]->{n}
and $self->{stack}->[ 1 - $type ]->[1] )
@ -126,9 +128,11 @@ sub next {
sub replay {
my ( $self, $sub ) = splice @_;
my @subs = ();
$self->{p}->lmLog( "Replay all methods until sub $sub", 'debug' );
foreach (
qw(authInit extractFormInfo userDBInit getUser setAuthSessionInfo
setSessionInfo setGroups authFinish)
setSessionInfo setGroups authenticate authFinish)
)
{
push @subs, $_;

View File

@ -11,7 +11,7 @@ use Lemonldap::NG::Portal::_LibAccess;
require SOAP::Lite;
use base qw(Lemonldap::NG::Portal::_LibAccess);
our $VERSION = '1.2.0';
our $VERSION = '1.2.2';
## @method void startSoapServices()
# Check the URI requested (PATH_INFO environment variable) and launch the
@ -76,21 +76,32 @@ _RETURN $getCookiesResponse Response
#@return session => { error => code , cookies => { cookieName1 => value ,... } }
sub getCookies {
my ( $self, $user, $password, $sessionid ) = splice @_;
$self->{user} = $user;
$self->{password} = $password;
$self->{id} = $sessionid if ( defined($sessionid) && $sessionid );
$self->{error} = PE_OK;
$self->lmLog( "SOAP authentication request for $self->{user}", 'debug' );
$self->lmLog( "SOAP authentication request for $user", 'debug' );
# Skip extractFormInfo step, as we already get input data
$self->{skipExtractFormInfo} = 1;
# User and password are required
unless ( $self->{user} && $self->{password} ) {
$self->{error} = PE_FORMEMPTY;
}
# Launch process
else {
$self->{error} = $self->_subProcess(
qw(authInit userDBInit getUser setAuthSessionInfo
qw(authInit userDBInit extractFormInfo getUser setAuthSessionInfo
setSessionInfo setMacros setGroups setPersistentSessionInfo
setLocalGroups authenticate grantSession removeOther
store authFinish buildCookie)
);
$self->lmLog(
"SOAP authentication result for $user: code $self->{error}",
'debug' );
$self->updateSession();
}
my @tmp = ();