staticPrefix
- . '/common/backgrounds/'
- . $self->conf->{portalSkinBackground}
- . '") no-repeat center fixed;'
- . 'background-size:cover;}';
+ my $s =
+ 'html,body{background:url("'
+ . $self->staticPrefix
+ . '/common/backgrounds/'
+ . $self->conf->{portalSkinBackground}
+ . '") no-repeat center fixed;'
+ . 'background-size:cover;}';
return [
200,
- [ 'Content-Type' => 'text/css',
+ [
+ 'Content-Type' => 'text/css',
'Content-Length' => length($s),
'Cache-Control' => 'public,max-age=3600',
],
@@ -799,16 +812,16 @@ sub lmError {
# Error code
$templateParams{"ERROR$_"} = ( $httpError == $_ ? 1 : 0 )
- foreach ( 403, 404, 500, 502, 503 );
+ foreach ( 403, 404, 500, 502, 503 );
return $self->sendHtml( $req, 'error', params => \%templateParams );
}
sub rebuildCookies {
my ( $self, $req ) = @_;
my @tmp;
- for ( my $i = 0; $i < @{ $req->{respHeaders} }; $i += 2 ) {
+ for ( my $i = 0 ; $i < @{ $req->{respHeaders} } ; $i += 2 ) {
push @tmp, $req->respHeaders->[0], $req->respHeaders->[1]
- unless ( $req->respHeaders->[0] eq 'Set-Cookie' );
+ unless ( $req->respHeaders->[0] eq 'Set-Cookie' );
}
$req->{respHeaders} = \@tmp;
$self->buildCookie($req);
@@ -831,7 +844,7 @@ sub tplParams {
sub registerLogin {
my ( $self, $req ) = @_;
return
- unless ( $self->conf->{loginHistoryEnabled}
+ unless ( $self->conf->{loginHistoryEnabled}
and defined $req->authResult );
my $history = $req->sessionInfo->{_loginHistory} ||= {};
my $type = ( $req->authResult > 0 ? 'failed' : 'success' ) . 'Login';
@@ -841,17 +854,17 @@ sub registerLogin {
# Gather current login's parameters
my $login = $self->_sumUpSession( $req->{sessionInfo}, 1 );
$login->{error} = $self->error( $req->authResult )
- if ( $req->authResult );
+ if ( $req->authResult );
- $self->logger->debug(" Current login -> " . $login->{error}) if ( $login->{error} );
+ $self->logger->debug( " Current login -> " . $login->{error} )
+ if ( $login->{error} );
# Add current login into history
unshift @{ $history->{$type} }, $login;
# Forget oldest logins
splice @{ $history->{$type} }, $self->conf->{ $type . "Number" }
- if (
- scalar @{ $history->{$type} } > $self->conf->{ $type . "Number" } );
+ if ( scalar @{ $history->{$type} } > $self->conf->{ $type . "Number" } );
# Save into persistent session
$self->updatePersistentSession( $req, { _loginHistory => $history, } );
@@ -862,12 +875,12 @@ sub registerLogin {
# @return hashref
sub _sumUpSession {
my ( $self, $session, $withoutUser ) = @_;
- my $res
- = $withoutUser
- ? {}
- : { user => $session->{ $self->conf->{whatToTrace} } };
+ my $res =
+ $withoutUser
+ ? {}
+ : { user => $session->{ $self->conf->{whatToTrace} } };
$res->{$_} = $session->{$_}
- foreach ( "_utime", "ipAddr",
+ foreach ( "_utime", "ipAddr",
keys %{ $self->conf->{sessionDataToRemember} } );
return $res;
}
@@ -876,12 +889,12 @@ sub _sumUpSession {
sub loadTemplate {
my ( $self, $name, %prm ) = @_;
$name .= '.tpl';
- my $file
- = $self->conf->{templateDir} . '/'
- . $self->conf->{portalSkin} . '/'
- . $name;
+ my $file =
+ $self->conf->{templateDir} . '/'
+ . $self->conf->{portalSkin} . '/'
+ . $name;
$file = $self->conf->{templateDir} . '/common/' . $name
- unless ( -e $file );
+ unless ( -e $file );
unless ( -e $file ) {
die "Unable to find $name in $self->conf->{templateDir}";
}
diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/SecondFactor.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/SecondFactor.pm
index 17aae63a6..0162a7e6f 100644
--- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/SecondFactor.pm
+++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/SecondFactor.pm
@@ -3,11 +3,11 @@ package Lemonldap::NG::Portal::Main::SecondFactor;
use strict;
use Mouse;
use Lemonldap::NG::Portal::Main::Constants qw(
- PE_SENDRESPONSE
- PE_OK
- PE_NOTOKEN
- PE_TOKENEXPIRED
- PE_BADCREDENTIALS
+ PE_SENDRESPONSE
+ PE_OK
+ PE_NOTOKEN
+ PE_TOKENEXPIRED
+ PE_BADCREDENTIALS
);
our $VERSION = '2.0.0';
@@ -19,8 +19,8 @@ extends 'Lemonldap::NG::Portal::Main::Plugin';
has ott => (
is => 'rw',
default => sub {
- my $ott = $_[0]->{p}
- ->loadModule('Lemonldap::NG::Portal::Lib::OneTimeToken');
+ my $ott =
+ $_[0]->{p}->loadModule('Lemonldap::NG::Portal::Lib::OneTimeToken');
$ott->timeout( $_[0]->{conf}->{formTimeout} );
return $ott;
}
@@ -52,8 +52,7 @@ sub _redirect {
my ( $self, $req ) = @_;
my $arg = $req->env->{QUERY_STRING};
return [
- 302, [ Location => $self->conf->{portal} . ( $arg ? "?$arg" : '' ) ],
- []
+ 302, [ Location => $self->conf->{portal} . ( $arg ? "?$arg" : '' ) ], []
];
}
@@ -66,16 +65,15 @@ sub _verify {
# Check token
my $token;
unless ( $token = $req->param('token') ) {
- $self->userLogger->error(
- $self->prefix . ' 2F access without token' );
+ $self->userLogger->error( $self->prefix . ' 2F access without token' );
$req->mustRedirect(1);
- return $self->p->do( $req, [ sub {PE_NOTOKEN} ] );
+ return $self->p->do( $req, [ sub { PE_NOTOKEN } ] );
}
my $session;
unless ( $session = $self->ott->getToken($token) ) {
$self->userLogger->info('Token expired');
- return $self->p->do( $req, [ sub {PE_TOKENEXPIRED} ] );
+ return $self->p->do( $req, [ sub { PE_TOKENEXPIRED } ] );
}
# Launch second factor verification
@@ -90,7 +88,7 @@ sub _verify {
$req->{sessionInfo}->{_utime} = delete $req->{sessionInfo}->{_2fUtime};
$req->authResult(PE_BADCREDENTIALS);
return $self->p->do( $req,
- [ $self->p->storeHistory($req), sub {$res} ] );
+ [ $self->p->storeHistory($req), sub { $res } ] );
}
# Else restore session
@@ -101,15 +99,22 @@ sub _verify {
$self->p->rebuildCookies($req);
$req->mustRedirect(1);
$self->userLogger->notice( $self->prefix
- . '2F verification for '
- . $req->sessionInfo->{ $self->conf->{whatToTrace} } );
+ . '2F verification for '
+ . $req->sessionInfo->{ $self->conf->{whatToTrace} } );
if ( my $l = $self->conf->{ $self->prefix . '2fAuthnLevel' } ) {
$self->p->updateSession( $req, { authenticationLevel => $l } );
}
$req->authResult(PE_SENDRESPONSE);
- return $self->p->do( $req,
- [ @{ $self->p->afterData }, $self->p->validSession, @{ $self->p->endAuth }, sub {PE_OK} ] );
+ return $self->p->do(
+ $req,
+ [
+ @{ $self->p->afterData },
+ $self->p->validSession,
+ @{ $self->p->endAuth },
+ sub { PE_OK }
+ ]
+ );
}
1;
diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/BruteForceProtection.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/BruteForceProtection.pm
index 9ddb8525f..5152ba3be 100644
--- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/BruteForceProtection.pm
+++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/BruteForceProtection.pm
@@ -40,11 +40,9 @@ sub run {
return PE_OK if ( $countFailed < 3 );
foreach ( 0 .. 2 ) {
- if ( defined $req->sessionInfo->{_loginHistory}->{failedLogin}->[$_] )
- {
+ if ( defined $req->sessionInfo->{_loginHistory}->{failedLogin}->[$_] ) {
push @lastFailedLoginEpoch,
- $req->sessionInfo->{_loginHistory}->{failedLogin}->[$_]
- ->{_utime};
+ $req->sessionInfo->{_loginHistory}->{failedLogin}->[$_]->{_utime};
}
}
$self->logger->debug("BruteForceProtection enabled");
@@ -53,7 +51,7 @@ sub run {
$MaxAge = $lastFailedLoginEpoch[0] - $lastFailedLoginEpoch[2];
$self->logger->debug(" -> MaxAge = $MaxAge");
return PE_OK
- if ( $MaxAge > $self->conf->{bruteForceProtectionMaxAge} );
+ if ( $MaxAge > $self->conf->{bruteForceProtectionMaxAge} );
# Delta between the two last failed logins -> Auth_N - Auth_N-1
my $delta = time - $lastFailedLoginEpoch[1];
@@ -61,7 +59,7 @@ sub run {
# Delta between the two last failed logins < 30s => wait
return PE_OK
- unless ( $delta <= $self->conf->{bruteForceProtectionTempo} );
+ unless ( $delta <= $self->conf->{bruteForceProtectionTempo} );
# Account locked
#shift @{ $req->sessionInfo->{_loginHistory}->{failedLogin} };
diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/ForceAuthn.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/ForceAuthn.pm
index 21cdfc23e..8c8b3f041 100644
--- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/ForceAuthn.pm
+++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/ForceAuthn.pm
@@ -12,7 +12,7 @@ extends 'Lemonldap::NG::Portal::Main::Plugin';
use constant forAuthUser => 'run';
-sub init {1}
+sub init { 1 }
# RUNNING METHOD
@@ -25,8 +25,8 @@ sub run {
$self->logger->debug( "Delta with last Authn -> " . $delta );
$delta <= $self->conf->{portalForceAuthnInterval}
- ? return PE_OK
- : return PE_MUSTAUTHN;
+ ? return PE_OK
+ : return PE_MUSTAUTHN;
}
}
diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/GrantSession.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/GrantSession.pm
index 7db296385..730d53fe4 100644
--- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/GrantSession.pm
+++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/GrantSession.pm
@@ -3,8 +3,8 @@ package Lemonldap::NG::Portal::Plugins::GrantSession;
use strict;
use Mouse;
use Lemonldap::NG::Portal::Main::Constants qw(
- PE_OK
- PE_SESSIONNOTGRANTED
+ PE_OK
+ PE_SESSIONNOTGRANTED
);
our $VERSION = '2.0.0';
@@ -22,11 +22,11 @@ sub init {
$self->logger->debug("GrantRule key -> $_");
$self->logger->debug(
"GrantRule value -> " . $self->conf->{grantSessionRules}->{$_} );
- my $rule = $hd->buildSub(
+ my $rule =
+ $hd->buildSub(
$hd->substitute( $self->conf->{grantSessionRules}->{$_} ) );
unless ($rule) {
- $self->error(
- "Bad grantSession rule " . $hd->tsv->{jail}->error );
+ $self->error( "Bad grantSession rule " . $hd->tsv->{jail}->error );
return 0;
}
$self->rules->{$_} = $rule;
@@ -45,7 +45,7 @@ sub run {
foreach ( sort sortByComment keys %{ $self->rules } ) {
$self->logger->debug( "Grant session condition -> "
- . $self->conf->{grantSessionRules}->{$_} );
+ . $self->conf->{grantSessionRules}->{$_} );
unless ( $self->rules->{$_}->( $req, $req->sessionInfo ) ) {
$req->userData( {} );
@@ -54,7 +54,7 @@ sub run {
if ($1) {
$self->logger->debug("Message -> $1");
- # Message can contain session data as user attributes or macros
+ # Message can contain session data as user attributes or macros
my $hd = $self->p->HANDLER;
my $msg = $hd->substitute($1);
unless ( $msg = $hd->buildSub($msg) ) {
@@ -68,17 +68,17 @@ sub run {
)
);
$self->userLogger->error( 'User '
- . $req->sessionInfo->{uid}
- . " was not granted to open session (rule -> $msg)" );
+ . $req->sessionInfo->{uid}
+ . " was not granted to open session (rule -> $msg)" );
$req->urldc( $self->conf->{portal} );
return $req->authResult(PE_SESSIONNOTGRANTED);
}
else {
$self->userLogger->error( 'User '
- . $req->sessionInfo->{uid}
- . " was not granted to open session (rule -> "
- . $self->conf->{grantSessionRules}->{$_}
- . ")" );
+ . $req->sessionInfo->{uid}
+ . " was not granted to open session (rule -> "
+ . $self->conf->{grantSessionRules}->{$_}
+ . ")" );
$req->urldc( $self->conf->{portal} );
return $req->authResult(PE_SESSIONNOTGRANTED);
}
diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/History.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/History.pm
index 5f862b89c..6252ae3a8 100644
--- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/History.pm
+++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/History.pm
@@ -28,15 +28,15 @@ sub run {
$req->sessionInfo->{_loginHistory}->{successLogin},
'lastLogins', 0, 0 )
: ""
- )
- . ("
") .
- (
+ )
+ . ("
")
+ . (
$req->sessionInfo->{_loginHistory}->{failedLogin}
? $self->p->mkSessionArray(
$req->sessionInfo->{_loginHistory}->{failedLogin},
'lastFailedLogins', 0, 1 )
: ""
- )
+ )
);
unless ( $req->info ) {
$req->info( $self->loadTemplate('noHistory') );
diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Register/AD.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Register/AD.pm
index ebab90c02..651dd7964 100644
--- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Register/AD.pm
+++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Register/AD.pm
@@ -32,7 +32,7 @@ sub createUser {
givenName => $gn,
unicodePwd => utf8(
chr(34) . $req->data->{registerInfo}->{password} . chr(34)
- )->utf16le(),
+ )->utf16le(),
mail => $req->data->{registerInfo}->{mail},
]
);
diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Register/Custom.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Register/Custom.pm
index 537c6b5c8..36602793b 100644
--- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Register/Custom.pm
+++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Register/Custom.pm
@@ -9,7 +9,7 @@ sub new {
}
my $res = $self->{p}->loadModule( $self->{conf}->{customRegister} );
- unless($res) {
+ unless ($res) {
die 'Unable to load register module ' . $self->{conf}->{customRegister};
}
return $res;
diff --git a/lemonldap-ng-portal/t/40-Notifications-JSON-DBI.t b/lemonldap-ng-portal/t/40-Notifications-JSON-DBI.t
index ca45d7dd8..055327d4b 100644
--- a/lemonldap-ng-portal/t/40-Notifications-JSON-DBI.t
+++ b/lemonldap-ng-portal/t/40-Notifications-JSON-DBI.t
@@ -20,7 +20,7 @@ SKIP: {
);
$dbh->prepare(
q{INSERT INTO notifications VALUES ('dwho','testref','2016-05-30 00:00:00',?,null,null)}
- )->execute(
+ )->execute(
'[
{
"uid": "dwho",
@@ -32,7 +32,7 @@ q{INSERT INTO notifications VALUES ('dwho','testref','2016-05-30 00:00:00',?,nul
"check": ["Accept test"]
}
]'
- );
+ );
my $client = LLNG::Manager::Test->new(
{
diff --git a/lemonldap-ng-portal/t/40-Notifications-JSON-File.t b/lemonldap-ng-portal/t/40-Notifications-JSON-File.t
index 65f76f428..fa4b7c87d 100644
--- a/lemonldap-ng-portal/t/40-Notifications-JSON-File.t
+++ b/lemonldap-ng-portal/t/40-Notifications-JSON-File.t
@@ -111,8 +111,8 @@ ok(
),
'New auth query'
);
-expectAuthenticatedAs($res,'dwho');
-ok($res->[2]->[0] =~ /yourApp/s, 'Menu displayed');
+expectAuthenticatedAs( $res, 'dwho' );
+ok( $res->[2]->[0] =~ /yourApp/s, 'Menu displayed' );
count(2);
clean_sessions();
diff --git a/lemonldap-ng-portal/t/43-MailReset-DBI.t b/lemonldap-ng-portal/t/43-MailReset-DBI.t
index 651f921e6..15c1f3b5f 100644
--- a/lemonldap-ng-portal/t/43-MailReset-DBI.t
+++ b/lemonldap-ng-portal/t/43-MailReset-DBI.t
@@ -16,7 +16,6 @@ my $mailSend = 0;
my $mail2 = 0;
-
SKIP: {
eval
'require Email::Sender::Simple;use GD::SecurityImage;use Image::Magick;';
diff --git a/lemonldap-ng-portal/t/61-BruteForceProtection.t b/lemonldap-ng-portal/t/61-BruteForceProtection.t
index f47bd6dbe..8de0d8f4e 100644
--- a/lemonldap-ng-portal/t/61-BruteForceProtection.t
+++ b/lemonldap-ng-portal/t/61-BruteForceProtection.t
@@ -10,7 +10,8 @@ BEGIN {
my $res;
my $client = LLNG::Manager::Test->new(
- { ini => {
+ {
+ ini => {
logLevel => 'error',
authentication => 'Demo',
userDB => 'Same',
@@ -22,7 +23,8 @@ my $client = LLNG::Manager::Test->new(
);
## First successful connection
-ok( $res = $client->_post(
+ok(
+ $res = $client->_post(
'/',
IO::String->new('user=dwho&password=dwho'),
length => 23,
@@ -37,7 +39,8 @@ expectRedirection( $res, 'http://auth.example.com/' );
$client->logout($id1);
## Second successful connection
-ok( $res = $client->_post(
+ok(
+ $res = $client->_post(
'/',
IO::String->new('user=dwho&password=dwho'),
length => 23,
@@ -52,7 +55,8 @@ expectRedirection( $res, 'http://auth.example.com/' );
$client->logout($id1);
## First failed connection
-ok( $res = $client->_post(
+ok(
+ $res = $client->_post(
'/',
IO::String->new('user=dwho&password=ohwd'),
length => 23
@@ -63,7 +67,8 @@ count(1);
expectReject($res);
## Second failed connection
-ok( $res = $client->_post(
+ok(
+ $res = $client->_post(
'/',
IO::String->new('user=dwho&password=ohwd'),
length => 23
@@ -74,7 +79,8 @@ count(1);
expectReject($res);
## Third failed connection -> rejected
-ok( $res = $client->_post(
+ok(
+ $res = $client->_post(
'/',
IO::String->new('user=dwho&password=ohwd'),
length => 23,
@@ -89,7 +95,8 @@ count(1);
sleep 1;
## Fourth failed connection -> Rejected
-ok( $res = $client->_post(
+ok(
+ $res = $client->_post(
'/',
IO::String->new('user=dwho&password=ohwd'),
length => 23,
@@ -104,7 +111,8 @@ count(1);
sleep 2;
## Third successful connection -> Rejected
-ok( $res = $client->_post(
+ok(
+ $res = $client->_post(
'/',
IO::String->new('user=dwho&password=dwho'),
length => 23,
@@ -119,7 +127,8 @@ count(1);
sleep 3;
## Fourth successful connection -> Accepted
-ok( $res = $client->_post(
+ok(
+ $res = $client->_post(
'/',
IO::String->new('user=dwho&password=dwho&checkLogins=1'),
length => 37,
@@ -131,7 +140,7 @@ count(1);
$id1 = expectCookie($res);
ok( $res->[2]->[0] =~ /trspan="lastLogins"/, 'History found' )
- or print STDERR Dumper( $res->[2]->[0] );
+ or print STDERR Dumper( $res->[2]->[0] );
my @c = ( $res->[2]->[0] =~ /127.0.0.1/gs );
my @cf = ( $res->[2]->[0] =~ /PE5<\/td>/gs );
diff --git a/lemonldap-ng-portal/t/61-ForceAuthn.t b/lemonldap-ng-portal/t/61-ForceAuthn.t
index adaf0e93a..ca6d7a68c 100644
--- a/lemonldap-ng-portal/t/61-ForceAuthn.t
+++ b/lemonldap-ng-portal/t/61-ForceAuthn.t
@@ -10,7 +10,8 @@ BEGIN {
my $res;
my $client = LLNG::Manager::Test->new(
- { ini => {
+ {
+ ini => {
authentication => 'Demo',
userdb => 'Same',
portalForceAuthn => 1,
@@ -19,7 +20,8 @@ my $client = LLNG::Manager::Test->new(
}
);
-ok( $res = $client->_post(
+ok(
+ $res = $client->_post(
'/',
IO::String->new('user=dwho&password=dwho'),
length => 23
@@ -33,7 +35,8 @@ count(1);
sleep 3;
-ok( $res = $client->_get(
+ok(
+ $res = $client->_get(
'/',
cookie => "lemonldap=$id1",
accept => 'text/html',
@@ -41,10 +44,11 @@ ok( $res = $client->_get(
'Form ReAuthentification'
);
ok( $res->[2]->[0] =~ qr%%, 'Found PE87 code' )
- or print STDERR Dumper( $res->[2]->[0] );
+ or print STDERR Dumper( $res->[2]->[0] );
count(1);
-ok( $res = $client->_post(
+ok(
+ $res = $client->_post(
'/',
IO::String->new('user=dwho&password=dwho'),
length => 23,
@@ -56,7 +60,8 @@ expectOK($res);
$id1 = expectCookie($res);
count(1);
-ok( $res = $client->_get(
+ok(
+ $res = $client->_get(
'/',
cookie => "lemonldap=$id1",
accept => 'text/html',
@@ -65,7 +70,7 @@ ok( $res = $client->_get(
);
ok( $res->[2]->[0] =~ qr%Your applications%,
'Found applications list' )
- or print STDERR Dumper( $res->[2]->[0] );
+ or print STDERR Dumper( $res->[2]->[0] );
count(1);
$client->logout($id1);
diff --git a/lemonldap-ng-portal/t/61-GrantSession.t b/lemonldap-ng-portal/t/61-GrantSession.t
index 0e082eb05..eac56ef59 100644
--- a/lemonldap-ng-portal/t/61-GrantSession.t
+++ b/lemonldap-ng-portal/t/61-GrantSession.t
@@ -10,7 +10,8 @@ BEGIN {
my $res;
my $client = LLNG::Manager::Test->new(
- { ini => {
+ {
+ ini => {
logLevel => 'error',
authentication => 'Demo',
userdb => 'Same',
@@ -23,7 +24,8 @@ my $client = LLNG::Manager::Test->new(
}
);
-ok( $res = $client->_post(
+ok(
+ $res = $client->_post(
'/',
IO::String->new('user=dwho&password=dwho'),
accept => 'text/html',
@@ -33,15 +35,16 @@ ok( $res = $client->_post(
);
count(1);
ok( $res->[2]->[0] =~ /dwho not allowed<\/h3>/,
- 'dwho rejected with custom message and session data'
-) or print STDERR Dumper( $res->[2]->[0] );
+ 'dwho rejected with custom message and session data' )
+ or print STDERR Dumper( $res->[2]->[0] );
count(1);
ok( $res->[2]->[0] =~ qr%src="/static/common/js/info.(?:min\.)?js">%,
- 'Found INFO js'
-) or print STDERR Dumper( $res->[2]->[0] );
+ 'Found INFO js' )
+ or print STDERR Dumper( $res->[2]->[0] );
count(1);
-ok( $res = $client->_post(
+ok(
+ $res = $client->_post(
'/',
IO::String->new('user=rtyler&password=rtyler'),
length => 27
@@ -52,7 +55,8 @@ count(1);
expectOK($res);
expectCookie($res);
-ok( $res = $client->_post(
+ok(
+ $res = $client->_post(
'/',
IO::String->new('user=mrsmith&password=mrsmith'),
accept => 'text/html',
@@ -61,7 +65,8 @@ ok( $res = $client->_post(
'Auth query'
);
count(1);
-ok( $res->[2]->[0] =~ /<\/span><\/div>/,
+ok(
+ $res->[2]->[0] =~ /<\/span><\/div>/,
'rtyler rejected with PE_SESSIONNOTGRANTED'
) or print STDERR Dumper( $res->[2]->[0] );
count(1);
@@ -72,7 +77,8 @@ count(1);
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
$client = LLNG::Manager::Test->new(
- { ini => {
+ {
+ ini => {
authentication => 'Demo',
userdb => 'Same',
grantSessionRules => { '' => '$uid eq "dwho"', }
@@ -80,7 +86,8 @@ $client = LLNG::Manager::Test->new(
}
);
-ok( $res = $client->_post(
+ok(
+ $res = $client->_post(
'/',
IO::String->new('user=dwho&password=dwho'),
length => 23
diff --git a/lemonldap-ng-portal/t/63-History.t b/lemonldap-ng-portal/t/63-History.t
index 4bce96cb7..d7e9fbe40 100644
--- a/lemonldap-ng-portal/t/63-History.t
+++ b/lemonldap-ng-portal/t/63-History.t
@@ -9,7 +9,8 @@ BEGIN {
my $res;
my $client = LLNG::Manager::Test->new(
- { ini => {
+ {
+ ini => {
logLevel => 'error',
authentication => 'Demo',
userDB => 'Same',
@@ -20,7 +21,8 @@ my $client = LLNG::Manager::Test->new(
);
## First successful connection
-ok( $res = $client->_post(
+ok(
+ $res = $client->_post(
'/',
IO::String->new('user=dwho&password=dwho&checkLogins=1'),
length => 37,
@@ -32,7 +34,7 @@ count(1);
expectOK($res);
my $id1 = expectCookie($res);
ok( $res->[2]->[0] =~ /trspan="lastLogins"/, 'History found' )
- or explain( $res->[2]->[0], 'trspan="noHistory"' );
+ or explain( $res->[2]->[0], 'trspan="noHistory"' );
my @c = ( $res->[2]->[0] =~ /127.0.0.1/gs );
# History with 1 successLogin
@@ -47,7 +49,8 @@ expectOK($res);
$client->logout($id1);
## Second successful connection
-ok( $res = $client->_post(
+ok(
+ $res = $client->_post(
'/',
IO::String->new('user=dwho&password=dwho&checkLogins=1'),
length => 37,
@@ -69,7 +72,8 @@ count(2);
$client->logout($id1);
## First failed connection
-ok( $res = $client->_post(
+ok(
+ $res = $client->_post(
'/',
IO::String->new('user=dwho&password=ohwd'),
length => 23
@@ -80,7 +84,8 @@ count(1);
expectReject($res);
## Second failed connection
-ok( $res = $client->_post(
+ok(
+ $res = $client->_post(
'/',
IO::String->new('user=dwho&password=ohwd'),
length => 23
@@ -91,7 +96,8 @@ count(1);
expectReject($res);
## Third successful connection
-ok( $res = $client->_post(
+ok(
+ $res = $client->_post(
'/',
IO::String->new('user=dwho&password=dwho&checkLogins=1'),
length => 37,
diff --git a/lemonldap-ng-portal/t/72-2F-REST-with-HISTORY.t b/lemonldap-ng-portal/t/72-2F-REST-with-HISTORY.t
index e3b2b0698..480631204 100644
--- a/lemonldap-ng-portal/t/72-2F-REST-with-HISTORY.t
+++ b/lemonldap-ng-portal/t/72-2F-REST-with-HISTORY.t
@@ -34,13 +34,13 @@ LWP::Protocol::PSGI->register(
my $client = LLNG::Manager::Test->new(
{
ini => {
- logLevel => 'error',
- rest2fActivation => 1,
- rest2fInitUrl => 'http://auth.example.com/init',
- rest2fInitArgs => { name => 'uid' },
- rest2fVerifyUrl => 'http://auth.example.com/vrfy',
- rest2fVerifyArgs => { code => 'code' },
- loginHistoryEnabled => 1,
+ logLevel => 'error',
+ rest2fActivation => 1,
+ rest2fInitUrl => 'http://auth.example.com/init',
+ rest2fInitArgs => { name => 'uid' },
+ rest2fVerifyUrl => 'http://auth.example.com/vrfy',
+ rest2fVerifyArgs => { code => 'code' },
+ loginHistoryEnabled => 1,
authentication => 'Demo',
userDB => 'Same',
}
@@ -74,9 +74,8 @@ ok(
);
my $id = expectCookie($res);
-
ok( $res->[2]->[0] =~ /trspan="lastLogins"/, 'History found' )
- or print STDERR Dumper( $res->[2]->[0] );
+ or print STDERR Dumper( $res->[2]->[0] );
my @c = ( $res->[2]->[0] =~ / | 127.0.0.1/gs );
ok( @c == 1, 'One entry found' );
diff --git a/lemonldap-ng-portal/t/76-2F-Ext-with-BruteForce.t b/lemonldap-ng-portal/t/76-2F-Ext-with-BruteForce.t
index 53d9c588b..acd724eba 100644
--- a/lemonldap-ng-portal/t/76-2F-Ext-with-BruteForce.t
+++ b/lemonldap-ng-portal/t/76-2F-Ext-with-BruteForce.t
@@ -9,7 +9,8 @@ use_ok('Lemonldap::NG::Common::FormEncode');
count(1);
my $client = LLNG::Manager::Test->new(
- { ini => {
+ {
+ ini => {
logLevel => 'error',
ext2fActivation => 1,
ext2FSendCommand => 't/sendOTP.pl -uid $uid',
@@ -26,7 +27,8 @@ my $client = LLNG::Manager::Test->new(
my $res;
## First failed connection
-ok( $res = $client->_post(
+ok(
+ $res = $client->_post(
'/',
IO::String->new('user=dwho&password=ohwd'),
length => 23
@@ -37,7 +39,8 @@ count(1);
expectReject($res);
## Second failed connection
-ok( $res = $client->_post(
+ok(
+ $res = $client->_post(
'/',
IO::String->new('user=dwho&password=ohwd'),
length => 23
@@ -48,7 +51,8 @@ count(1);
expectReject($res);
## Third failed connection -> rejected
-ok( $res = $client->_post(
+ok(
+ $res = $client->_post(
'/',
IO::String->new('user=dwho&password=ohwd'),
length => 23,
@@ -64,7 +68,8 @@ sleep 2;
# Try to authenticate
# -------------------
-ok( $res = $client->_post(
+ok(
+ $res = $client->_post(
'/',
IO::String->new('user=dwho&password=dwho&checkLogins=1'),
length => 37,
@@ -74,18 +79,19 @@ ok( $res = $client->_post(
);
count(1);
-my ( $host, $url, $query )
- = expectForm( $res, undef, '/ext2fcheck', 'token', 'code',
- 'checkLogins' );
+my ( $host, $url, $query ) =
+ expectForm( $res, undef, '/ext2fcheck', 'token', 'code', 'checkLogins' );
-ok( $res->[2]->[0]
- =~ qr%%,
+ok(
+ $res->[2]->[0] =~
+qr%%,
'Found EXTCODE input'
) or print STDERR Dumper( $res->[2]->[0] );
count(1);
$query =~ s/code=/code=123456/;
-ok( $res = $client->_post(
+ok(
+ $res = $client->_post(
'/ext2fcheck',
IO::String->new($query),
length => length($query),
@@ -102,7 +108,8 @@ sleep 4;
# Try to authenticate again
# -------------------------
-ok( $res = $client->_post(
+ok(
+ $res = $client->_post(
'/',
IO::String->new('user=dwho&password=dwho&checkLogins=1'),
length => 37,
@@ -112,18 +119,19 @@ ok( $res = $client->_post(
);
count(1);
-( $host, $url, $query )
- = expectForm( $res, undef, '/ext2fcheck', 'token', 'code',
- 'checkLogins' );
+( $host, $url, $query ) =
+ expectForm( $res, undef, '/ext2fcheck', 'token', 'code', 'checkLogins' );
-ok( $res->[2]->[0]
- =~ qr%%,
+ok(
+ $res->[2]->[0] =~
+qr%%,
'Found EXTCODE input'
) or print STDERR Dumper( $res->[2]->[0] );
count(1);
$query =~ s/code=/code=123456/;
-ok( $res = $client->_post(
+ok(
+ $res = $client->_post(
'/ext2fcheck',
IO::String->new($query),
length => length($query),
@@ -136,11 +144,11 @@ count(1);
my $id = expectCookie($res);
ok( $res->[2]->[0] =~ /trspan="lastLogins"/, 'History found' )
- or print STDERR Dumper( $res->[2]->[0] );
+ or print STDERR Dumper( $res->[2]->[0] );
count(1);
my @c = ( $res->[2]->[0] =~ / | 127.0.0.1/gs );
ok( @c == 4, 'Four entries found' )
- or print STDERR Dumper( $res->[2]->[0] );
+ or print STDERR Dumper( $res->[2]->[0] );
count(1);
$client->logout($id);
diff --git a/lemonldap-ng-portal/t/76-2F-Ext-with-GrantSession.t b/lemonldap-ng-portal/t/76-2F-Ext-with-GrantSession.t
index 48020befb..444d20495 100644
--- a/lemonldap-ng-portal/t/76-2F-Ext-with-GrantSession.t
+++ b/lemonldap-ng-portal/t/76-2F-Ext-with-GrantSession.t
@@ -9,15 +9,15 @@ use_ok('Lemonldap::NG::Common::FormEncode');
count(1);
my $client = LLNG::Manager::Test->new(
- { ini => {
+ {
+ ini => {
logLevel => 'error',
ext2fActivation => 1,
ext2FSendCommand => 't/sendOTP.pl -uid $uid',
ext2FValidateCommand => 't/vrfyOTP.pl -uid $uid -code $code',
authentication => 'Demo',
userDB => 'Same',
- grantSessionRules =>
- { 'Dwho_notAllowed##Test' => '$uid ne "dwho"' }
+ grantSessionRules => { 'Dwho_notAllowed##Test' => '$uid ne "dwho"' }
}
}
);
@@ -26,7 +26,8 @@ my $res;
# Try to authenticate
# -------------------
-ok( $res = $client->_post(
+ok(
+ $res = $client->_post(
'/',
IO::String->new('user=dwho&password=dwho'),
length => 23,
@@ -36,17 +37,19 @@ ok( $res = $client->_post(
);
count(1);
-my ( $host, $url, $query )
- = expectForm( $res, undef, '/ext2fcheck', 'token', 'code' );
+my ( $host, $url, $query ) =
+ expectForm( $res, undef, '/ext2fcheck', 'token', 'code' );
-ok( $res->[2]->[0]
- =~ qr%%,
+ok(
+ $res->[2]->[0] =~
+qr%%,
'Found EXTCODE input'
) or print STDERR Dumper( $res->[2]->[0] );
count(1);
$query =~ s/code=/code=123456/;
-ok( $res = $client->_post(
+ok(
+ $res = $client->_post(
'/ext2fcheck',
IO::String->new($query),
length => length($query),
@@ -58,12 +61,12 @@ count(1);
ok( $res->[2]->[0] =~ /Dwho_notAllowed<\/h3>/,
'dwho rejected with custom message' )
- or print STDERR Dumper( $res->[2]->[0] );
+ or print STDERR Dumper( $res->[2]->[0] );
count(1);
ok( $res->[2]->[0] =~ qr%src="/static/common/js/info.(?:min\.)?js">%,
- 'Found INFO js'
-) or print STDERR Dumper( $res->[2]->[0] );
+ 'Found INFO js' )
+ or print STDERR Dumper( $res->[2]->[0] );
count(1);
clean_sessions();
diff --git a/lemonldap-ng-portal/t/sendOTP.pl b/lemonldap-ng-portal/t/sendOTP.pl
index 8138cd796..635ddd128 100755
--- a/lemonldap-ng-portal/t/sendOTP.pl
+++ b/lemonldap-ng-portal/t/sendOTP.pl
@@ -2,6 +2,6 @@
use strict;
use warnings;
-my ($swt, $user) = @ARGV;
+my ( $swt, $user ) = @ARGV;
exit !( $swt eq '-uid' && $user eq 'dwho' );
diff --git a/lemonldap-ng-portal/t/test-lib.pm b/lemonldap-ng-portal/t/test-lib.pm
index eb1951b6f..42eaa6041 100644
--- a/lemonldap-ng-portal/t/test-lib.pm
+++ b/lemonldap-ng-portal/t/test-lib.pm
@@ -58,6 +58,7 @@ use Data::Dumper;
use LWP::UserAgent;
use URI::Escape;
use Lemonldap::NG::Common::FormEncode;
+
#use 5.10.0;
no warnings 'redefine';
@@ -625,7 +626,7 @@ sub _get {
: ()
),
'REQUEST_METHOD' => $args{method} || 'GET',
- 'REQUEST_URI' => $path . ( $args{query} ? "?$args{query}" : '' ),
+ 'REQUEST_URI' => $path . ( $args{query} ? "?$args{query}" : '' ),
( $args{query} ? ( QUERY_STRING => $args{query} ) : () ),
'SCRIPT_NAME' => '',
'SERVER_NAME' => 'auth.example.com',
@@ -677,10 +678,10 @@ sub _post {
: ()
),
'REQUEST_METHOD' => $args{method} || 'POST',
- 'REQUEST_URI' => $path . ( $args{query} ? "?$args{query}" : '' ),
- 'SCRIPT_NAME' => '',
- 'SERVER_NAME' => 'auth.example.com',
- 'SERVER_PORT' => '80',
+ 'REQUEST_URI' => $path . ( $args{query} ? "?$args{query}" : '' ),
+ 'SCRIPT_NAME' => '',
+ 'SERVER_NAME' => 'auth.example.com',
+ 'SERVER_PORT' => '80',
'SERVER_PROTOCOL' => 'HTTP/1.1',
( $args{custom} ? %{ $args{custom} } : () ),
'psgix.input.buffered' => 0,
diff --git a/lemonldap-ng-portal/t/test-psgi.pm b/lemonldap-ng-portal/t/test-psgi.pm
index 2e8255975..1691b8a7d 100644
--- a/lemonldap-ng-portal/t/test-psgi.pm
+++ b/lemonldap-ng-portal/t/test-psgi.pm
@@ -53,7 +53,7 @@ sub mirror {
: ()
),
'REQUEST_METHOD' => $args{method} || 'GET',
- 'REQUEST_URI' => ( $args{path} || '/' )
+ 'REQUEST_URI' => ( $args{path} || '/' )
. ( $args{query} ? "?$args{query}" : '' ),
( $args{query} ? ( QUERY_STRING => $args{query} ) : () ),
'SCRIPT_NAME' => '',
diff --git a/lemonldap-ng-portal/t/vrfyOTP.pl b/lemonldap-ng-portal/t/vrfyOTP.pl
index 6c01fb5ec..69966dfa5 100755
--- a/lemonldap-ng-portal/t/vrfyOTP.pl
+++ b/lemonldap-ng-portal/t/vrfyOTP.pl
@@ -2,6 +2,9 @@
use strict;
use warnings;
-my ($swt1, $user, $swt2, $code) = @ARGV;
+my ( $swt1, $user, $swt2, $code ) = @ARGV;
-exit !( $swt1 eq '-uid' && $user eq 'dwho' && $swt2 eq '-code' && $code eq '123456' );
+exit !($swt1 eq '-uid'
+ && $user eq 'dwho'
+ && $swt2 eq '-code'
+ && $code eq '123456' );
| |