Merge branch 'v2.0'
This commit is contained in:
commit
8ac93e034d
|
@ -134,15 +134,15 @@ sub parseMod {
|
|||
if ( @mods == 1 ) {
|
||||
my ($m) = @mods;
|
||||
return sub {
|
||||
my ( $sub, $req ) = @_;
|
||||
return ( $m->$sub($req), $expr );
|
||||
my $sub = shift;
|
||||
return ( $m->$sub(@_), $expr );
|
||||
};
|
||||
}
|
||||
return sub {
|
||||
my ( $sub, $req ) = @_;
|
||||
my $sub = shift;
|
||||
my %str;
|
||||
for ( my $i = 0 ; $i < @list ; $i++ ) {
|
||||
my $res = $mods[$i]->$sub($req);
|
||||
my $res = $mods[$i]->$sub(@_);
|
||||
|
||||
# Case "string" (form type)
|
||||
if ( $res & ~$res ) {
|
||||
|
|
|
@ -26,9 +26,6 @@ ok( $res = &client->_get( '/confs/2/sfExtra', 'application/json' ),
|
|||
'Get combModules' );
|
||||
ok( $resBody = from_json( $res->[2]->[0] ), "Result body contains JSON text" );
|
||||
|
||||
use Data::Dumper;
|
||||
print Dumper($resBody);
|
||||
|
||||
count(6);
|
||||
|
||||
done_testing( count() );
|
||||
|
|
|
@ -102,20 +102,23 @@ sub init {
|
|||
## Auth steps
|
||||
#############
|
||||
sub extractFormInfo {
|
||||
my ( $self, $req ) = @_;
|
||||
return $self->try( 0, 'extractFormInfo', $req );
|
||||
my $self = shift;
|
||||
return $self->try( 0, 'extractFormInfo', @_ );
|
||||
}
|
||||
|
||||
sub authenticate {
|
||||
return $_[0]->try( 0, 'authenticate', $_[1] );
|
||||
my $self = shift;
|
||||
return $self->try( 0, 'authenticate', @_ );
|
||||
}
|
||||
|
||||
sub setAuthSessionInfo {
|
||||
return $_[0]->try( 0, 'setAuthSessionInfo', $_[1] );
|
||||
my $self = shift;
|
||||
return $self->try( 0, 'setAuthSessionInfo', @_ );
|
||||
}
|
||||
|
||||
sub getForm {
|
||||
my ( $self, $req ) = @_;
|
||||
my $self = shift;
|
||||
my ($req) = @_;
|
||||
return [ split /[, ]\s*/, $self->conf->{combinationForms} ]
|
||||
if ( $self->conf->{combinationForms} );
|
||||
|
||||
|
@ -123,19 +126,20 @@ sub getForm {
|
|||
$req->data->{dataKeep}->{combinationTry},
|
||||
$req->data->{combinationStack}
|
||||
);
|
||||
my ( $res, $name ) = $stack->[$nb]->[0]->( 'getForm', $req );
|
||||
my ( $res, $name ) = $stack->[$nb]->[0]->( 'getForm', @_ );
|
||||
return $res;
|
||||
}
|
||||
|
||||
sub authLogout {
|
||||
my ( $self, $req ) = @_;
|
||||
my $self = shift;
|
||||
my ($req) = @_;
|
||||
$self->getStack( $req, 'extractFormInfo' ) or return PE_ERROR;
|
||||
|
||||
# Avoid warning msg at first access
|
||||
$req->userData->{_combinationTry} ||= 0;
|
||||
my ( $res, $name ) =
|
||||
$req->data->{combinationStack}->[ $req->userData->{_combinationTry} ]
|
||||
->[0]->( 'authLogout', $req );
|
||||
->[0]->( 'authLogout', @_ );
|
||||
$self->logger->debug(qq'User disconnected using scheme "$name"');
|
||||
return $res;
|
||||
}
|
||||
|
@ -152,15 +156,18 @@ sub authForce {
|
|||
###############
|
||||
# Note that UserDB::Combination uses the same object.
|
||||
sub getUser {
|
||||
return $_[0]->try( 1, 'getUser', $_[1] );
|
||||
my $self = shift;
|
||||
return $self->try( 1, 'getUser', @_ );
|
||||
}
|
||||
|
||||
sub setSessionInfo {
|
||||
return $_[0]->try( 1, 'setSessionInfo', $_[1] );
|
||||
my $self = shift;
|
||||
return $self->try( 1, 'setSessionInfo', @_ );
|
||||
}
|
||||
|
||||
sub setGroups {
|
||||
return $_[0]->try( 1, 'setGroups', $_[1] );
|
||||
my $self = shift;
|
||||
return $self->try( 1, 'setGroups', @_ );
|
||||
}
|
||||
|
||||
sub getStack {
|
||||
|
@ -178,7 +185,7 @@ sub getStack {
|
|||
|
||||
# Main running method: launch the next scheme if the current fails
|
||||
sub try {
|
||||
my ( $self, $type, $subname, $req ) = @_;
|
||||
my ( $self, $type, $subname, $req, @args ) = @_;
|
||||
|
||||
# Get available authentication schemes for this user if not done
|
||||
unless ( defined $req->data->{combinationStack} ) {
|
||||
|
@ -195,7 +202,7 @@ sub try {
|
|||
if ( $nb < @$stack - 1 ) {
|
||||
|
||||
# TODO: change logLevel for userLog()
|
||||
( $res, $name ) = $stack->[$nb]->[$type]->( $subname, $req );
|
||||
( $res, $name ) = $stack->[$nb]->[$type]->( $subname, $req, @args );
|
||||
|
||||
# On error, restart authentication with next scheme
|
||||
if ( $res > PE_OK ) {
|
||||
|
@ -207,7 +214,7 @@ sub try {
|
|||
}
|
||||
}
|
||||
else {
|
||||
( $res, $name ) = $stack->[$nb]->[$type]->( $subname, $req );
|
||||
( $res, $name ) = $stack->[$nb]->[$type]->( $subname, $req, @args );
|
||||
}
|
||||
$req->sessionInfo->{ [ '_auth', '_userDB' ]->[$type] } = $name;
|
||||
$req->sessionInfo->{_combinationTry} =
|
||||
|
|
|
@ -61,7 +61,8 @@ sub handler {
|
|||
if ( $url64
|
||||
and !$req->pdata->{keepPdata}
|
||||
and $req->userData->{_session_id}
|
||||
and ( $req->{env}->{HTTP_COOKIE} =~ /$url64/ ) )
|
||||
and $req->{env}->{HTTP_COOKIE}
|
||||
and $req->{env}->{HTTP_COOKIE} =~ /$url64/ )
|
||||
{
|
||||
$self->logger->debug("Force cleaning pdata");
|
||||
$self->logger->warn("pdata cookie domain must be set")
|
||||
|
|
|
@ -54,7 +54,7 @@ my $client = LLNG::Manager::Test->new( {
|
|||
notificationWildcard => 'everyone',
|
||||
notificationStorage => 'File',
|
||||
notificationStorageOptions => {
|
||||
dirName => $main::tmpDir
|
||||
dirName => $main::tmpDir,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue