Combination in progress (#1151)

environments/ppa-mbqj77/deployments/1
Xavier Guimard 8 years ago
parent 6cc7190df5
commit 193ac7c260
  1. 2
      lemonldap-ng-common/lib/Lemonldap/NG/Common/Combination/Parser.pm
  2. 1
      lemonldap-ng-portal/MANIFEST
  3. 6
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/Combination.pm
  4. 57
      lemonldap-ng-portal/t/36-Combination.t

@ -116,7 +116,7 @@ sub parseBlock {
sub parseMod {
my ( $self, $moduleList, $type, $expr ) = @_;
my @mods = map {
die "Unknown module $_"
die "Undeclared module $_"
unless ( $moduleList->{$_}->[$type] );
$moduleList->{$_}->[$type]
} split( /\s+and\s+/, $expr );

@ -372,6 +372,7 @@ t/34-Auth-Proxy-and-REST-Server.t
t/34-Auth-Proxy-and-SOAP-Server.t
t/35-REST-sessions-with-REST-server.t
t/35-SOAP-sessions-with-SOAP-server.t
t/36-Combination.t
t/40-Notifications-JSON-DBI.t
t/40-Notifications-JSON-File-with-token.t
t/40-Notifications-JSON-File.t

@ -1,4 +1,4 @@
package Lemonldap::NG::Portal::Auth::Choice;
package Lemonldap::NG::Portal::Auth::Combination;
use strict;
use Mouse;
@ -16,7 +16,7 @@ has stackSub => ( is => 'rw' );
sub init {
my ($self) = @_;
unless ( $self->conf->combination ) {
unless ( $self->conf->{combination} ) {
$self->error('No combination found');
return 0;
}
@ -44,7 +44,7 @@ sub init {
eval {
$self->stackSub(
Lemonldap::NG::Common::Combination::Parser->parse(
\%mods, $self->conf->combination
\%mods, $self->conf->{combination}
)
);
};

@ -0,0 +1,57 @@
use Test::More;
use strict;
use IO::String;
require 't/test-lib.pm';
my $res;
my $mainTests = 0;
eval { unlink 't/userdb.db' };
SKIP: {
eval { require DBI; require DBD::SQLite; };
if ($@) {
skip 'DBD::SQLite not found', $mainTests;
}
my $dbh = DBI->connect("dbi:SQLite:dbname=t/userdb.db");
$dbh->do('CREATE TABLE users (user text,password text,name text)');
$dbh->do("INSERT INTO users VALUES ('test','test','Test user')");
my $client = LLNG::Manager::Test->new(
{
ini => {
logLevel => 'debug',
useSafeJail => 1,
authentication => 'Combination',
userDB => 'Same',
combination => '[DBI] or [Demo]',
combModules => [
{
for => 0,
name => 'DBI',
type => 'DBI',
},
{
for => 0,
name => 'Demo',
type => 'Demo',
},
],
dbiAuthChain => 'dbi:SQLite:dbname=t/userdb.db',
dbiAuthUser => '',
dbiAuthPassword => '',
dbiAuthTable => 'users',
dbiAuthLoginCol => 'user',
dbiAuthPasswordCol => 'password',
dbiAuthPasswordHash => '',
dbiExportedVars => {},
}
}
);
}
count($mainTests);
eval { unlink 't/userdb.db' };
done_testing( count() );
Loading…
Cancel
Save