From 62d5c7836c267d832c0a5e40a5b68a74cb6ebe71 Mon Sep 17 00:00:00 2001 From: Xavier Guimard Date: Sun, 2 Sep 2018 17:31:58 +0200 Subject: [PATCH] make tidy --- .../Lemonldap/NG/Common/Notifications/JSON.pm | 3 +-- .../lib/Lemonldap/NG/Handler/PSGI/Main.pm | 4 +--- .../t/63-Lemonldap-NG-Handler-PSGI-Try.t | 2 +- lemonldap-ng-handler/t/test-psgi-lib.pm | 2 +- .../lib/Lemonldap/NG/Manager/2ndFA.pm | 16 ++++++++----- .../lib/Lemonldap/NG/Manager/Conf/Parser.pm | 12 +++++----- .../lib/Lemonldap/NG/Manager/Sessions.pm | 6 ++--- lemonldap-ng-manager/t/03-HTML-forms.t | 2 +- lemonldap-ng-manager/t/60-2ndfa.t | 24 ++++++++++++------- .../Lemonldap/NG/Portal/2F/Engines/Default.pm | 2 +- .../Lemonldap/NG/Portal/2F/Register/TOTP.pm | 2 +- .../lib/Lemonldap/NG/Portal/2F/TOTP.pm | 3 ++- .../lib/Lemonldap/NG/Portal/2F/U2F.pm | 11 +++++---- .../lib/Lemonldap/NG/Portal/2F/Yubikey.pm | 2 +- .../Lemonldap/NG/Portal/Auth/OpenIDConnect.pm | 2 +- .../lib/Lemonldap/NG/Portal/Auth/SAML.pm | 2 +- .../lib/Lemonldap/NG/Portal/CDC.pm | 4 ++-- .../NG/Portal/Issuer/OpenIDConnect.pm | 2 +- .../lib/Lemonldap/NG/Portal/Issuer/SAML.pm | 2 +- .../NG/Portal/Lib/Notifications/JSON.pm | 3 +-- .../NG/Portal/Lib/Notifications/XML.pm | 3 +-- .../Lemonldap/NG/Portal/Lib/OneTimeToken.pm | 2 +- .../lib/Lemonldap/NG/Portal/Lib/SMTP.pm | 2 +- .../lib/Lemonldap/NG/Portal/Main/Display.pm | 5 ++-- .../lib/Lemonldap/NG/Portal/Register/AD.pm | 2 +- .../Lemonldap/NG/Portal/Register/Custom.pm | 12 ++++++---- ...-Auth-and-issuer-OIDC-authorization_code.t | 1 + .../t/40-Notifications-JSON-DBI.t | 4 ++-- .../t/40-Notifications-JSON-Server.t | 3 +-- lemonldap-ng-portal/t/70-2F-TOTP_8.t | 15 ++++++------ lemonldap-ng-portal/t/75-2F-Registers.t | 4 ++-- lemonldap-ng-portal/t/test-lib.pm | 13 +++++----- lemonldap-ng-portal/t/test-psgi.pm | 2 +- 33 files changed, 92 insertions(+), 82 deletions(-) diff --git a/lemonldap-ng-common/lib/Lemonldap/NG/Common/Notifications/JSON.pm b/lemonldap-ng-common/lib/Lemonldap/NG/Common/Notifications/JSON.pm index 04085a145..350e77ea4 100644 --- a/lemonldap-ng-common/lib/Lemonldap/NG/Common/Notifications/JSON.pm +++ b/lemonldap-ng-common/lib/Lemonldap/NG/Common/Notifications/JSON.pm @@ -47,8 +47,7 @@ sub deleteNotification { # Check input parameters unless ( $uid and $myref ) { $self->userLogger->error( - 'REST service "delete notification" called without all parameters' - ); + 'REST service "delete notification" called without all parameters'); return 0; } diff --git a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/PSGI/Main.pm b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/PSGI/Main.pm index 55bb12c03..41dbce60c 100644 --- a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/PSGI/Main.pm +++ b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/PSGI/Main.pm @@ -89,9 +89,7 @@ sub print { sub addToHtmlHead { my $self = shift; $self->logger->error( - 'Features like form replay or logout_app can only be used with Apache' - ), - ; + 'Features like form replay or logout_app can only be used with Apache'); } sub cgiName { diff --git a/lemonldap-ng-handler/t/63-Lemonldap-NG-Handler-PSGI-Try.t b/lemonldap-ng-handler/t/63-Lemonldap-NG-Handler-PSGI-Try.t index b7affe815..6b9e8be7b 100644 --- a/lemonldap-ng-handler/t/63-Lemonldap-NG-Handler-PSGI-Try.t +++ b/lemonldap-ng-handler/t/63-Lemonldap-NG-Handler-PSGI-Try.t @@ -21,7 +21,7 @@ ok( cookieName => 'lemonldap', securedCookie => 0, https => 0, - userLogger => 'Lemonldap::NG::Common::Logger::Null', + userLogger => 'Lemonldap::NG::Common::Logger::Null', } ), 'initialization' diff --git a/lemonldap-ng-handler/t/test-psgi-lib.pm b/lemonldap-ng-handler/t/test-psgi-lib.pm index c62c3d1b1..780e4f4ea 100644 --- a/lemonldap-ng-handler/t/test-psgi-lib.pm +++ b/lemonldap-ng-handler/t/test-psgi-lib.pm @@ -29,7 +29,7 @@ sub init { cookieName => 'lemonldap', securedCookie => 0, https => 0, - logger => 'Lemonldap::NG::Common::Logger::Std', + logger => 'Lemonldap::NG::Common::Logger::Std', %$prms ); ok( diff --git a/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/2ndFA.pm b/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/2ndFA.pm index a896fb9b1..a5e0541da 100644 --- a/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/2ndFA.pm +++ b/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/2ndFA.pm @@ -76,9 +76,10 @@ sub del2F { or return $self->sendError( $req, 'Bad mode', 400 ); my $params = $req->parameters(); - my $type = $params->{type} or return $self->sendError( $req, 'Missing "type" parameter', 400 ); - my $epoch = $params->{epoch} or return $self->sendError( $req, 'Missing "epoch" parameter', 400 ); - + my $type = $params->{type} + or return $self->sendError( $req, 'Missing "type" parameter', 400 ); + my $epoch = $params->{epoch} + or return $self->sendError( $req, 'Missing "epoch" parameter', 400 ); if ( $type =~ /\b(?:U2F|TOTP|UBK)\b/ ) { $self->logger->debug( @@ -242,10 +243,13 @@ sub sfa { $self->logger->debug( "Removing sessions unless a $_ device is registered"); } + #else { - #( - #return $self->sendError( $req, "Bad or Missing " . $_ . "Check parameter", - #400 ) ); + # ( + # return $self->sendError( + # $req, "Bad or Missing " . $_ . "Check parameter", 400 + # ) + # ); #} } diff --git a/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Conf/Parser.pm b/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Conf/Parser.pm index e3dcacf08..566a1f858 100644 --- a/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Conf/Parser.pm +++ b/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Conf/Parser.pm @@ -68,7 +68,7 @@ has confChanged => ( ); # Properties required during build -has refConf => ( is => 'ro', isa => 'HashRef', required => 1 ); +has refConf => ( is => 'ro', isa => 'HashRef', required => 1 ); has req => ( is => 'ro', required => 1 ); has newConf => ( is => 'rw', isa => 'HashRef' ); has tree => ( is => 'rw', isa => 'ArrayRef' ); @@ -157,7 +157,7 @@ sub _scanNodes { hdebug("Looking to $name"); # subnode - my $subNodes = $leaf->{nodes} // $leaf->{_nodes}; + my $subNodes = $leaf->{nodes} // $leaf->{_nodes}; my $subNodesCond = $leaf->{nodes_cond} // $leaf->{_nodes_cond}; ################################## @@ -531,7 +531,7 @@ sub _scanNodes { : {} } ); - for ( my $i = 0 ; $i < @listCatNew; $i++ ) { + for ( my $i = 0 ; $i < @listCatNew ; $i++ ) { if ( not( defined $listCatRef[$i] ) or $listCatRef[$i] ne $listCatNew[$i] ) { @@ -1051,15 +1051,15 @@ sub _unitTest { or $attr->{type} =~ /Container$/ ) { my $keyMsg = $attr->{keyMsgFail} // $type->{keyMsgFail}; - my $msg = $attr->{msgFail} // $type->{msgFail}; + my $msg = $attr->{msgFail} // $type->{msgFail}; $res = 0 unless ( $self->_execTest( { - keyTest => $attr->{keyTest} // $type->{keyTest}, + keyTest => $attr->{keyTest} // $type->{keyTest}, keyMsgFail => $attr->{keyMsgFail} // $type->{keyMsgFail}, - test => $attr->{test} // $type->{test}, + test => $attr->{test} // $type->{test}, msgFail => $attr->{msgFail} // $type->{msgFail}, }, $conf->{$key}, diff --git a/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Sessions.pm b/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Sessions.pm index 3a91050bd..f08133d7d 100644 --- a/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Sessions.pm +++ b/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Sessions.pm @@ -40,14 +40,14 @@ sub addRoutes { ['DELETE'] ) - # DELETE OIDC CONSENT - ->addRoute( + # DELETE OIDC CONSENT + ->addRoute( sessions => { OIDCConsent => { ':sessionType' => { ':sessionId' => 'delOIDCConsent' } } }, ['DELETE'] - ); + ); $self->setTypes($conf); diff --git a/lemonldap-ng-manager/t/03-HTML-forms.t b/lemonldap-ng-manager/t/03-HTML-forms.t index 8aee4d466..8ac3d4490 100644 --- a/lemonldap-ng-manager/t/03-HTML-forms.t +++ b/lemonldap-ng-manager/t/03-HTML-forms.t @@ -24,7 +24,7 @@ delete $forms{restore}; my ( @types, $attr, $tree, $ctrees ); ok( $tree = Lemonldap::NG::Manager::Build::Tree::tree(), 'Get tree' ); ok( $ctrees = Lemonldap::NG::Manager::Build::CTrees::cTrees(), 'Get cTrees' ); -ok( $attr = Lemonldap::NG::Manager::Build::Attributes::attributes(), +ok( $attr = Lemonldap::NG::Manager::Build::Attributes::attributes(), 'Get attributes' ); $count += 4; diff --git a/lemonldap-ng-manager/t/60-2ndfa.t b/lemonldap-ng-manager/t/60-2ndfa.t index 0ddd83307..62ec45346 100644 --- a/lemonldap-ng-manager/t/60-2ndfa.t +++ b/lemonldap-ng-manager/t/60-2ndfa.t @@ -48,6 +48,7 @@ my $res; ## Sessions creation # SSO session $ids[0] = newSession( 'dwho', '127.10.0.1', 'SSO', $sfaDevices ); + # Peristent sesssions $ids[1] = newSession( 'msmith', '127.10.0.1', 'Persistent', $sfaDevices ); $sfaDevices = [ @@ -115,14 +116,13 @@ $sfaDevices = [ ]; $ids[5] = newSession( 'tof', '127.10.0.1', 'Persistent', $sfaDevices ); - - ## Verify sessions creation # Single SSO session access $res = &client->jsonResponse("/sessions/global/$ids[0]"); ok( ( $res->{uid} and $res->{uid} eq 'dwho' ), 'UID found' ); ok( ( $res->{ipAddr} and $res->{ipAddr} eq '127.10.0.1' ), 'IP found' ); count(2); + # Single Persistent sessions access for ( my $i = 1 ; $i < 6 ; $i++ ) { $res = &client->jsonResponse("/sessions/persistent/$ids[$i]"); @@ -132,17 +132,25 @@ for ( my $i = 1 ; $i < 6 ; $i++ ) { and $res->{uid} =~ /^(?:dwho|rtyler|msmith|davros|tof)$/ ), 'Persistent sessions with UID found' - ); + ); } count(5); ## Single Persistent sfa access $res = &client->jsonResponse("/sfa/persistent/$ids[3]"); -ok( ( $res->{uid} and $res->{uid} eq 'dwho' ), 'UID found' ) or print STDERR Dumper($res); -ok( ( $res->{ipAddr} and $res->{ipAddr} eq '127.10.0.1' ), 'IP found' ) or print STDERR Dumper($res); -ok( ( $res->{_2fDevices} and $res->{_2fDevices} =~ /"type":\s*"U2F"/s ), 'U2F found' ) or print STDERR Dumper($res); -ok( ( $res->{_2fDevices} and $res->{_2fDevices} =~ /"type":\s*"TOTP"/s ), 'TOTP found' ) or print STDERR Dumper($res); -ok( ( $res->{_2fDevices} and $res->{_2fDevices} =~ /"type":\s*"UBK"/s ), 'UBK found' ) or print STDERR Dumper($res); +ok( ( $res->{uid} and $res->{uid} eq 'dwho' ), 'UID found' ) + or print STDERR Dumper($res); +ok( ( $res->{ipAddr} and $res->{ipAddr} eq '127.10.0.1' ), 'IP found' ) + or print STDERR Dumper($res); +ok( ( $res->{_2fDevices} and $res->{_2fDevices} =~ /"type":\s*"U2F"/s ), + 'U2F found' ) + or print STDERR Dumper($res); +ok( ( $res->{_2fDevices} and $res->{_2fDevices} =~ /"type":\s*"TOTP"/s ), + 'TOTP found' ) + or print STDERR Dumper($res); +ok( ( $res->{_2fDevices} and $res->{_2fDevices} =~ /"type":\s*"UBK"/s ), + 'UBK found' ) + or print STDERR Dumper($res); count(5); ## "All" query diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Engines/Default.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Engines/Default.pm index 8cf4f063a..32ff50387 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Engines/Default.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Engines/Default.pm @@ -103,7 +103,7 @@ sub init { # Enable REST request only if more than 1 2F module is enabled if ( @{ $self->{sfModules} } > 1 ) { - $self->addUnauthRoute( '2fchoice' => '_choice', ['POST'] ); + $self->addUnauthRoute( '2fchoice' => '_choice', ['POST'] ); $self->addUnauthRoute( '2fchoice' => '_redirect', ['GET'] ); } diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Register/TOTP.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Register/TOTP.pm index 274d43c07..02c550942 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Register/TOTP.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Register/TOTP.pm @@ -67,7 +67,7 @@ sub run { my $TOTPName = $req->param('TOTPName'); my $epoch = time(); - # Set default name if empty, check characters and truncate name if too long + # Set default name if empty, check characters and truncate name if too long $TOTPName ||= $epoch; unless ( $TOTPName =~ /^[\w]+$/ ) { $self->userLogger->error('TOTP name with bad character(s)'); diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/TOTP.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/TOTP.pm index d8545ac93..0876634ed 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/TOTP.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/TOTP.pm @@ -34,7 +34,8 @@ sub init { if ( $self->conf->{totp2fSelfRegistration} and $self->conf->{totp2fActivation} eq '1' ) { - $self->conf->{totp2fActivation} = '$_2fDevices && $_2fDevices =~ /"type":\s*"TOTP"/s'; + $self->conf->{totp2fActivation} = + '$_2fDevices && $_2fDevices =~ /"type":\s*"TOTP"/s'; } return $self->SUPER::init(); } diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/U2F.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/U2F.pm index 2a5572c27..7c04eeb2c 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/U2F.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/U2F.pm @@ -37,7 +37,8 @@ sub init { if ( $self->conf->{u2fSelfRegistration} and $self->conf->{u2fActivation} eq '1' ) { - $self->conf->{u2fActivation} = '$_2fDevices && $_2fDevices =~ /"type":\s*"U2F"/s'; + $self->conf->{u2fActivation} = + '$_2fDevices && $_2fDevices =~ /"type":\s*"U2F"/s'; } return 0 unless ( $self->Lemonldap::NG::Portal::Main::SecondFactor::init() @@ -79,9 +80,9 @@ sub run { $self->ott->updateToken( $token, __ch => $data->{challenge} ); - $self->logger->debug("Prepare U2F verification"); - $self->logger->debug(" -> Send challenge: ". $data->{challenge}); - + $self->logger->debug("Prepare U2F verification"); + $self->logger->debug( " -> Send challenge: " . $data->{challenge} ); + # Serialize data $data = to_json( { @@ -208,7 +209,7 @@ sub loadUser { return PE_ERROR; } $self->logger->debug("2F Device(s) found"); - + $self->logger->debug("Looking for registered U2F key(s) ..."); foreach (@$_2fDevices) { if ( $_->{type} eq 'U2F' ) { diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Yubikey.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Yubikey.pm index adca5bdf8..809e3b6d9 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Yubikey.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Yubikey.pm @@ -34,7 +34,7 @@ sub init { $self->logger->error($@); return 0; } - + # If self registration is enabled and "activation" is just set to # "enabled", replace the rule to detect if user has registered its key if ( $self->conf->{yubikey2fSelfRegistration} diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/OpenIDConnect.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/OpenIDConnect.pm index ec9a36f14..d83f9a366 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/OpenIDConnect.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/OpenIDConnect.pm @@ -16,7 +16,7 @@ extends 'Lemonldap::NG::Portal::Main::Auth', # INTERFACE -has opList => ( is => 'rw', default => sub { [] } ); +has opList => ( is => 'rw', default => sub { [] } ); has opNumber => ( is => 'rw', default => 0 ); has path => ( is => 'rw', default => 'oauth2' ); diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/SAML.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/SAML.pm index 7e9354af4..f0234f85b 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/SAML.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/SAML.pm @@ -754,7 +754,7 @@ sub extractFormInfo { my $res = $self->p->deleteSession($req); return ( $res eq PE_LOGOUT_OK ? PE_SENDRESPONSE : $res ); - } + } ] ); diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/CDC.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/CDC.pm index 9c02b63b8..ea0bbfc88 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/CDC.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/CDC.pm @@ -41,8 +41,8 @@ sub init { "Unable to load configuration: $Lemonldap::NG::Common::Conf::msg"); return 0; } - $lconf->{$_} = $args->{$_} foreach ( keys %$args ); - $conf->{$_} = $lconf->{$_} foreach ( keys %$lconf ); + $lconf->{$_} = $args->{$_} foreach ( keys %$args ); + $conf->{$_} = $lconf->{$_} foreach ( keys %$lconf ); $self->SUPER::init($lconf) or return 0; $self->cdc_name( $conf->{samlCommonDomainCookieName} || '_saml_idp' ); $self->cdc_domain( $conf->{samlCommonDomainCookieDomain} ); diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Issuer/OpenIDConnect.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Issuer/OpenIDConnect.pm index cf47530f6..86ae2d7be 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Issuer/OpenIDConnect.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Issuer/OpenIDConnect.pm @@ -398,7 +398,7 @@ sub run { # Read existing RP @RPoidcConsent = grep { $_->{rp} eq $rp } @$_oidcConsents; - unless ( @RPoidcConsent ) { + unless (@RPoidcConsent) { $self->logger->debug("No Relying Party $rp Consent found"); # Set default value diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Issuer/SAML.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Issuer/SAML.pm index ddd43b3c1..a3d3291da 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Issuer/SAML.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Issuer/SAML.pm @@ -778,7 +778,7 @@ sub run { if ( $method == $self->getHttpMethod("post") || $method == $self->getHttpMethod("artifact-post") ) { - $artifact_method = $self->getHttpMethod("artifact-post") + $artifact_method = $self->getHttpMethod("artifact-post"); } else { diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/Notifications/JSON.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/Notifications/JSON.pm index 4baa23d6f..7497676f2 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/Notifications/JSON.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/Notifications/JSON.pm @@ -160,8 +160,7 @@ sub getNotifBack { $self->p->updatePersistentSession( $req, { "notification_$reference" => time() } ); $self->logger->debug( - "Notification $reference registered in persistent session" - ); + "Notification $reference registered in persistent session"); } # Notifications accepted for this file, delete it unless it's a wildcard diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/Notifications/XML.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/Notifications/XML.pm index abc32352d..9f3e24cf9 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/Notifications/XML.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/Notifications/XML.pm @@ -219,8 +219,7 @@ sub getNotifBack { $self->p->updatePersistentSession( $req, { "notification_$reference" => time() } ); $self->logger->debug( - "Notification $reference registered in persistent session" - ); + "Notification $reference registered in persistent session"); } # Notifications accepted for this file, delete it unless it's a wildcard diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/OneTimeToken.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/OneTimeToken.pm index 01a6a238f..183526b1c 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/OneTimeToken.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/OneTimeToken.pm @@ -110,7 +110,7 @@ sub getToken { return undef; } my %h = %{ $tsession->{data} }; - $tsession->remove unless($keep); + $tsession->remove unless ($keep); return \%h; } } diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/SMTP.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/SMTP.pm index 5b448a2b3..4ec8853e5 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/SMTP.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/SMTP.pm @@ -174,7 +174,7 @@ sub send_mail { foreach ( keys %cid ) { $message->attach( Type => "image/" . ( $cid{$_} =~ m/\.(\w+)/ )[0], - Id => $_, + Id => $_, Path => $self->p->{templateDir} . "/" . $cid{$_}, ); } diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Display.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Display.pm index e249dc417..55a5aa0a3 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Display.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Display.pm @@ -106,7 +106,7 @@ sub display { && $req->data->{login}, ASK_LOGINS => $req->param('checkLogins') || 0, CONFIRMKEY => $self->stamp(), - LIST => $req->data->{list} || [], + LIST => $req->data->{list} || [], REMEMBER => $req->data->{confirmRemember}, ( $req->data->{customScript} @@ -550,7 +550,8 @@ sub mkOidcConsent { $consents->{$rp}->{epoch} = $_->{epoch}; $consents->{$rp}->{scope} = $_->{scope}; $consents->{$rp}->{displayName} = - $self->conf->{oidcRPMetaDataOptions}->{$rp}->{oidcRPMetaDataOptionsDisplayName}; + $self->conf->{oidcRPMetaDataOptions}->{$rp} + ->{oidcRPMetaDataOptionsDisplayName}; } } 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 651dd7964..ebab90c02 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 324a74844..da678f8c4 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Register/Custom.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Register/Custom.pm @@ -7,11 +7,13 @@ sub new { unless ( $self->{conf}->{customRegister} ) { die 'Custom register module not defined'; } - + eval $self->{p}->loadModule( $self->{conf}->{customRegister} ); ($@) - ? return $self->{p}->loadModule( $self->{conf}->{customRegister ) - : die 'Unable to load register module ' . $self->{conf}->{customRegister}; -} + ? return $self->{p}->loadModule( + $self->{conf}->{ customRegister ) + : die 'Unable to load register module ' + . $self->{conf}->{customRegister}; + } -1; + 1; diff --git a/lemonldap-ng-portal/t/32-Auth-and-issuer-OIDC-authorization_code.t b/lemonldap-ng-portal/t/32-Auth-and-issuer-OIDC-authorization_code.t index 9a520d7ed..2c69e5b31 100644 --- a/lemonldap-ng-portal/t/32-Auth-and-issuer-OIDC-authorization_code.t +++ b/lemonldap-ng-portal/t/32-Auth-and-issuer-OIDC-authorization_code.t @@ -292,6 +292,7 @@ ok( ); count(1); $idpId = expectCookie($res); + #expectRedirection( $res, qr#^http://auth.rp.com/# ); #print STDERR Dumper($res); diff --git a/lemonldap-ng-portal/t/40-Notifications-JSON-DBI.t b/lemonldap-ng-portal/t/40-Notifications-JSON-DBI.t index 055327d4b..ca45d7dd8 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-Server.t b/lemonldap-ng-portal/t/40-Notifications-JSON-Server.t index c3806a40a..2a0f34c4e 100644 --- a/lemonldap-ng-portal/t/40-Notifications-JSON-Server.t +++ b/lemonldap-ng-portal/t/40-Notifications-JSON-Server.t @@ -50,8 +50,7 @@ ok( $res = $client->_post( '/', IO::String->new( - 'user=dwho&password=dwho&url=aHR0cDovL3Rlc3QxLmV4YW1wbGUuY29tLw==' - ), + 'user=dwho&password=dwho&url=aHR0cDovL3Rlc3QxLmV4YW1wbGUuY29tLw=='), accept => 'text/html', length => 64, ), diff --git a/lemonldap-ng-portal/t/70-2F-TOTP_8.t b/lemonldap-ng-portal/t/70-2F-TOTP_8.t index bcf19734e..b382eeea5 100644 --- a/lemonldap-ng-portal/t/70-2F-TOTP_8.t +++ b/lemonldap-ng-portal/t/70-2F-TOTP_8.t @@ -81,7 +81,7 @@ SKIP: { my $code; ok( $code = Lemonldap::NG::Common::TOTP::_code( undef, $key, 0, 30, 8 ), 'Code' ); - ok( $code =~ /^\d{8}$/, 'Code contains 8 digits' ); + ok( $code =~ /^\d{8}$/, 'Code contains 8 digits' ); my $s = "code=$code&token=$token"; ok( $res = $client->_post( @@ -110,19 +110,18 @@ SKIP: { ); my ( $host, $url, $query ) = expectForm( $res, undef, '/totp2fcheck', 'token' ); - + # Generate TOTP with LLNG my $totp; ok( $totp = Lemonldap::NG::Common::TOTP::_code( undef, $key, 0, 30, 8 ), 'LLNG Code' ); - + # Generate TOTP with an external application to validate LLNG TOTP formula my $oath = Authen::OATH->new( digits => 8 ); - ok( $code = $oath->totp( $key ), - 'Ext. App Code' ); - ok( $code == $totp, 'Both TOTP match') - or explain( [ $code, $totp ], 'LLNG and Ext. App TOTP mismatch'); - + ok( $code = $oath->totp($key), 'Ext. App Code' ); + ok( $code == $totp, 'Both TOTP match' ) + or explain( [ $code, $totp ], 'LLNG and Ext. App TOTP mismatch' ); + $query =~ s/code=/code=$code/; ok( $res = $client->_post( diff --git a/lemonldap-ng-portal/t/75-2F-Registers.t b/lemonldap-ng-portal/t/75-2F-Registers.t index 8ad6ee483..d365440b2 100644 --- a/lemonldap-ng-portal/t/75-2F-Registers.t +++ b/lemonldap-ng-portal/t/75-2F-Registers.t @@ -11,12 +11,12 @@ SKIP: { if ($@) { skip 'Convert::Base32 is missing', $maintests; } - + eval { require Crypt::U2F::Server; require Authen::U2F::Tester }; if ( $@ or $Crypt::U2F::Server::VERSION < 0.42 ) { skip 'Missing libraries', $maintests; } - + require Lemonldap::NG::Common::TOTP; my $client = LLNG::Manager::Test->new( diff --git a/lemonldap-ng-portal/t/test-lib.pm b/lemonldap-ng-portal/t/test-lib.pm index f933327c8..0758ca556 100644 --- a/lemonldap-ng-portal/t/test-lib.pm +++ b/lemonldap-ng-portal/t/test-lib.pm @@ -296,8 +296,7 @@ has ini => ( $ini->{$k} //= $defaultIni->{$k}; } $self->{ini} = $ini; - main::ok( $self->{p} = $self->class->new(), - 'Portal object' ); + main::ok( $self->{p} = $self->class->new(), 'Portal object' ); main::ok( $self->{p}->init($ini), 'Init' ); main::ok( $self->{app} = $self->{p}->run(), 'Portal app' ); main::count(3); @@ -370,7 +369,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', @@ -406,10 +405,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 1691b8a7d..2e8255975 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' => '',