Perl critic

This commit is contained in:
Christophe Maudoux 2021-02-01 22:30:37 +01:00
parent d21747cea1
commit 635e75c1b6
26 changed files with 129 additions and 120 deletions

View File

@ -1,6 +1,5 @@
LemonLDAP::NG Core team:
* Maxime BESSON
* David COUTADEUR
* Xavier GUIMARD
* Christophe MAUDOUX
* Clément OUDOT
@ -10,9 +9,10 @@ Past and present contributors:
* Casimir ANTUNES
* Sébastien BAHLOUL
* Oliver BOIREAU
* Jean-Thomas CHECCO
* Sandro CAZZANIGA
* Jean-Thomas CHECCO
* Thomas CHEMINEAU
* David COUTADEUR
* François-Xavier DELTOMBE
* Sebastien DIAZ
* Soisik FROGIER

View File

@ -4,14 +4,14 @@ use strict;
use Mouse;
use Lemonldap::NG::Portal::Main::Constants qw(PE_ERROR PE_OK);
our $VERSION = '2.0.0';
our $VERSION = '2.0.12';
extends 'Lemonldap::NG::Portal::Main::Auth';
# INITIALIZATION
sub init {
1;
return 1;
}
# RUNNING METHODS
@ -25,22 +25,22 @@ sub extractFormInfo {
# This is needed for Kerberos authentication
$req->{user} =~ s/^(.*)@.*$/$1/g;
PE_OK;
return PE_OK;
}
sub authenticate {
PE_OK;
return PE_OK;
}
sub setAuthSessionInfo {
my ( $self, $req ) = @_;
$req->{sessionInfo}->{authenticationLevel} =
$self->conf->{apacheAuthnLevel};
PE_OK;
return PE_OK;
}
sub authLogout {
PE_OK;
return PE_OK;
}
sub getDisplayType {

View File

@ -12,7 +12,7 @@ use Lemonldap::NG::Portal::Main::Constants qw(
PE_SENDRESPONSE
);
our $VERSION = '2.0.6';
our $VERSION = '2.0.12';
extends 'Lemonldap::NG::Portal::Main::Auth', 'Lemonldap::NG::Portal::Lib::CAS';
@ -72,6 +72,7 @@ sub init {
or $a->{val} cmp $b->{val}
} @list;
$self->srvList( \@list );
return 1;
}
@ -247,15 +248,16 @@ sub extractFormInfo {
}
sub authenticate {
PE_OK;
return PE_OK;
}
# Set authenticationLevel.
sub setAuthSessionInfo {
my ( $self, $req ) = @_;
$req->{sessionInfo}->{authenticationLevel} = $self->conf->{casAuthnLevel};
$req->{sessionInfo}->{_casSrv} = $req->data->{_casSrvCurrent};
PE_OK;
$req->{sessionInfo}->{_casSrv}
= $req->data->{_casSrvCurrent};
return PE_OK;
}
sub authLogout {
@ -271,7 +273,7 @@ sub authLogout {
# Register CAS logout URL in logoutServices
$req->data->{logoutServices}->{CASserver} = $logout_url;
PE_OK;
return PE_OK;
}
sub getDisplayType {

View File

@ -6,7 +6,7 @@ use Lemonldap::NG::Common::Combination::Parser;
use Lemonldap::NG::Portal::Main::Constants qw(PE_OK PE_ERROR PE_FIRSTACCESS);
use Scalar::Util 'weaken';
our $VERSION = '2.0.8';
our $VERSION = '2.0.12';
# TODO: See Lib::Wrapper
extends 'Lemonldap::NG::Portal::Main::Auth';
@ -153,7 +153,7 @@ sub authLogout {
}
sub authFinish {
PE_OK;
return PE_OK;
}
sub authForce {

View File

@ -4,7 +4,7 @@ use strict;
use Mouse;
use Lemonldap::NG::Portal::Main::Constants qw(PE_OK PE_BADCREDENTIALS);
our $VERSION = '2.0.0';
our $VERSION = '2.0.12';
extends 'Lemonldap::NG::Portal::Auth::_WebForm',
'Lemonldap::NG::Portal::Lib::DBI';
@ -43,7 +43,7 @@ sub authenticate {
}
sub authLogout {
PE_OK;
return PE_OK;
}
1;

View File

@ -11,7 +11,7 @@ use Lemonldap::NG::Portal::Main::Constants qw(PE_OK PE_BADCREDENTIALS);
extends qw(Lemonldap::NG::Portal::Auth::_WebForm);
our $VERSION = '2.0.9';
our $VERSION = '2.0.12';
# INITIALIZATION
@ -38,11 +38,11 @@ sub authenticate {
return PE_BADCREDENTIALS;
}
PE_OK;
return PE_OK;
}
sub authLogout {
PE_OK;
return PE_OK;
}
1;

View File

@ -7,7 +7,7 @@ use Lemonldap::NG::Common::FormEncode;
use Lemonldap::NG::Portal::Main::Constants qw(PE_OK PE_ERROR PE_BADCREDENTIALS);
use utf8;
our $VERSION = '2.0.3';
our $VERSION = '2.0.12';
extends 'Lemonldap::NG::Portal::Main::Auth';
@ -129,26 +129,27 @@ sub extractFormInfo {
$self->logger->debug( "Redirect user to " . $req->{urldc} );
$req->continue(1);
$req->steps( [] );
PE_OK;
return PE_OK;
}
sub authenticate {
PE_OK;
return PE_OK;
}
sub setAuthSessionInfo {
my ( $self, $req ) = @_;
$req->{sessionInfo}->{authenticationLevel} =
$self->conf->{facebookAuthnLevel};
PE_OK;
return PE_OK;
}
sub authFinish {
PE_OK;
return PE_OK;
}
sub authLogout {
PE_OK;
return PE_OK;
}
sub getDisplayType {
@ -170,6 +171,7 @@ sub fb {
);
};
$self->logger->error($@) if ($@);
return $fb;
}

View File

@ -12,7 +12,7 @@ use Lemonldap::NG::Portal::Main::Constants qw(
PE_OK
);
our $VERSION = '2.0.3';
our $VERSION = '2.0.12';
extends 'Lemonldap::NG::Portal::Auth::_WebForm';
@ -137,18 +137,18 @@ sub extractFormInfo {
}
sub authenticate {
PE_OK;
return PE_OK;
}
sub setAuthSessionInfo {
my ( $self, $req ) = @_;
$req->sessionInfo->{gpgMail} = $req->data->{gpgMail};
$req->sessionInfo->{authenticationLevel} = $self->conf->{gpgAuthnLevel};
PE_OK;
return PE_OK;
}
sub authLogout {
PE_OK;
return PE_OK;
}
sub getDisplayType {

View File

@ -8,7 +8,7 @@ use Lemonldap::NG::Common::FormEncode;
use Lemonldap::NG::Common::UserAgent;
use Lemonldap::NG::Portal::Main::Constants qw(PE_OK PE_ERROR PE_REDIRECT);
our $VERSION = '2.0.9';
our $VERSION = '2.0.12';
extends 'Lemonldap::NG::Portal::Main::Auth';
@ -296,19 +296,19 @@ sub setAuthSessionInfo {
$req->data->{githubData}->{$_};
}
PE_OK;
return PE_OK;
}
sub authenticate {
PE_OK;
return PE_OK;
}
sub authFinish {
PE_OK;
return PE_OK;
}
sub authLogout {
PE_OK;
return PE_OK;
}
sub authForce {

View File

@ -12,7 +12,7 @@ use Lemonldap::NG::Portal::Main::Constants qw(
PE_SENDRESPONSE
);
our $VERSION = '2.0.9';
our $VERSION = '2.0.12';
extends 'Lemonldap::NG::Portal::Main::Auth';
@ -216,18 +216,18 @@ sub _checkDomains {
}
sub authenticate {
PE_OK;
return PE_OK;
}
sub authLogout {
PE_OK;
return PE_OK;
}
sub setAuthSessionInfo {
my ( $self, $req ) = @_;
$req->{sessionInfo}->{authenticationLevel} = $self->conf->{krbAuthnLevel};
$req->{sessionInfo}->{_krbUser} = $req->data->{_krbUser};
PE_OK;
return PE_OK;
}
sub getDisplayType {

View File

@ -8,7 +8,7 @@ use Lemonldap::NG::Common::FormEncode;
use Lemonldap::NG::Common::UserAgent;
use Lemonldap::NG::Portal::Main::Constants qw(PE_OK PE_ERROR PE_REDIRECT);
our $VERSION = '2.0.6';
our $VERSION = '2.0.12';
extends 'Lemonldap::NG::Portal::Main::Auth';
@ -261,19 +261,19 @@ sub setAuthSessionInfo {
$req->data->{linkedInData}->{$_};
}
PE_OK;
return PE_OK;
}
sub authenticate {
PE_OK;
return PE_OK;
}
sub authFinish {
PE_OK;
return PE_OK;
}
sub authLogout {
PE_OK;
return PE_OK;
}
sub authForce {

View File

@ -4,14 +4,14 @@ use strict;
use Mouse;
use Lemonldap::NG::Portal::Main::Constants;
our $VERSION = '2.0.0';
our $VERSION = '2.0.12';
extends 'Lemonldap::NG::Portal::Main::Auth';
# INITIALIZATION
sub init {
1;
return 1;
}
# RUNNING METHODS
@ -19,22 +19,22 @@ sub init {
sub extractFormInfo {
my ( $self, $req ) = @_;
$req->user('anonymous');
PE_OK;
return PE_OK;
}
sub authenticate {
PE_OK;
return PE_OK;
}
sub setAuthSessionInfo {
my ( $self, $req ) = @_;
$req->{sessionInfo}->{'_user'} = 'anonymous';
$req->{sessionInfo}->{authenticationLevel} = $self->conf->{nullAuthnLevel};
PE_OK;
return PE_OK;
}
sub authLogout {
PE_OK;
return PE_OK;
}
sub getDisplayType {

View File

@ -15,7 +15,7 @@ use Lemonldap::NG::Portal::Main::Constants qw(
PE_REDIRECT
);
our $VERSION = '2.0.3';
our $VERSION = '2.0.12';
extends 'Lemonldap::NG::Portal::Main::Auth';
@ -191,18 +191,18 @@ qq'Unknown "OpenID Simple Registration Extension" field name: $k'
}
sub authenticate {
PE_OK;
return PE_OK;
}
sub setAuthSessionInfo {
my ( $self, $req ) = @_;
$req->{sessionInfo}->{authenticationLevel} =
$self->conf->{openIdAuthnLevel};
PE_OK;
return PE_OK;
}
sub authLogout {
PE_OK;
return PE_OK;
}
sub getDisplayType {

View File

@ -5,15 +5,17 @@ use Mouse;
use MIME::Base64 qw/encode_base64 decode_base64/;
use Lemonldap::NG::Common::JWT qw(getJWTPayload);
use Lemonldap::NG::Portal::Main::Constants qw(
PE_OK
PE_ERROR
PE_IDPCHOICE
PE_OK
);
our $VERSION = '2.0.7';
our $VERSION = '2.0.12';
extends 'Lemonldap::NG::Portal::Main::Auth',
'Lemonldap::NG::Portal::Lib::OpenIDConnect';
extends qw(
Lemonldap::NG::Portal::Main::Auth
Lemonldap::NG::Portal::Lib::OpenIDConnect
);
# INTERFACE
@ -276,7 +278,7 @@ sub extractFormInfo {
}
sub authenticate {
PE_OK;
return PE_OK;
}
sub setAuthSessionInfo {
@ -300,7 +302,7 @@ sub setAuthSessionInfo {
$self->logger->debug("ID Token will not be stored in session");
}
PE_OK;
return PE_OK;
}
sub authLogout {
@ -327,7 +329,7 @@ sub authLogout {
else {
$self->logger->debug("No end session endpoint found for $op");
}
PE_OK;
return PE_OK;
}
sub getDisplayType {

View File

@ -11,7 +11,7 @@ use Lemonldap::NG::Portal::Main::Constants qw(
extends qw(Lemonldap::NG::Portal::Auth::_WebForm);
our $VERSION = '2.0.3';
our $VERSION = '2.0.12';
# INITIALIZATION
@ -71,17 +71,17 @@ sub authenticate {
}
}
$self->userLogger->notice("Good PAM authentication for $req->{user}");
PE_OK;
return PE_OK;
}
sub setAuthSessionInfo {
my ( $self, $req ) = @_;
$req->sessionInfo->{authenticationLevel} = $self->conf->{pamAuthnLevel};
PE_OK;
return PE_OK;
}
sub authLogout {
PE_OK;
return PE_OK;
}
1;

View File

@ -4,7 +4,7 @@ use strict;
use Mouse;
use Lemonldap::NG::Portal::Main::Constants qw(PE_OK);
our $VERSION = '2.0.3';
our $VERSION = '2.0.12';
extends 'Lemonldap::NG::Portal::Auth::_WebForm';
@ -29,7 +29,7 @@ sub init {
sub setAuthSessionInfo {
my ( $self, $req ) = @_;
$req->{sessionInfo}->{authenticationLevel} = $self->conf->{proxyAuthnLevel};
PE_OK;
return PE_OK;
}
sub getDisplayType {

View File

@ -3,15 +3,17 @@ package Lemonldap::NG::Portal::Auth::REST;
use strict;
use Mouse;
use Lemonldap::NG::Portal::Main::Constants qw(
PE_OK
PE_ERROR
PE_BADCREDENTIALS
PE_OK
);
our $VERSION = '2.0.6';
our $VERSION = '2.0.12';
extends 'Lemonldap::NG::Portal::Auth::_WebForm',
'Lemonldap::NG::Portal::Lib::REST';
extends qw(
Lemonldap::NG::Portal::Auth::_WebForm
Lemonldap::NG::Portal::Lib::REST
);
# INITIALIZATION
@ -66,7 +68,7 @@ sub setAuthSessionInfo {
}
sub authLogout {
PE_OK;
return PE_OK;
}
1;

View File

@ -11,7 +11,7 @@ use Lemonldap::NG::Portal::Main::Constants qw(
extends qw(Lemonldap::NG::Portal::Auth::_WebForm);
our $VERSION = '2.0.0';
our $VERSION = '2.0.12';
# PROPERTIES
@ -64,7 +64,7 @@ sub authenticate {
}
sub authLogout {
PE_OK;
return PE_OK;
}
1;

View File

@ -4,7 +4,7 @@ use strict;
use Mouse;
use Lemonldap::NG::Portal::Main::Constants qw(PE_OK);
our $VERSION = '2.0.0';
our $VERSION = '2.0.12';
extends 'Lemonldap::NG::Portal::Main::Auth',
'Lemonldap::NG::Portal::Lib::Remote';
@ -18,11 +18,11 @@ sub extractFormInfo {
$req->{user} =
$req->data->{rSessionInfo}->{ $self->conf->{remoteUserField} || 'uid' };
$req->data->{password} = $req->data->{rSessionInfo}->{'_password'};
PE_OK;
return PE_OK;
}
sub authenticate {
PE_OK;
return PE_OK;
}
sub setAuthSessionInfo {
@ -33,11 +33,11 @@ sub setAuthSessionInfo {
$req->{sessionInfo}->{'_password'} = $req->data->{'password'};
$req->{sessionInfo}->{authenticationLevel} =
$req->data->{rSessionInfo}->{authenticationLevel};
PE_OK;
return PE_OK;
}
sub authLogout {
PE_OK;
return PE_OK;
}
sub getDisplayType {

View File

@ -6,11 +6,11 @@ use Mouse;
use Lemonldap::NG::Portal::Lib::SAML;
use Lemonldap::NG::Common::FormEncode;
use Lemonldap::NG::Portal::Main::Constants qw(
PE_OK
PE_CONFIRM
PE_IDPCHOICE
PE_LOGOUT_OK
PE_REDIRECT
PE_OK
PE_SAML_ART_ERROR
PE_SAML_CONDITIONS_ERROR
PE_SAML_DESTINATION_ERROR
@ -1141,7 +1141,7 @@ sub extractFormInfo {
}
sub authenticate {
PE_OK;
return PE_OK;
}
sub setAuthSessionInfo {
@ -1256,7 +1256,7 @@ sub setAuthSessionInfo {
$req->data->{_lassoLogin} = $login;
push @{ $req->steps }, sub { $self->authFinish(@_) };
PE_OK;
return PE_OK;
}
# Inserted in $req->steps by authenticate()
@ -1456,7 +1456,7 @@ sub handleAuthRequests {
if ( $req->uri =~ $self->sloRe ) {
return $self->extractFormInfo($req);
}
PE_OK;
return PE_OK;
}
# TODO: authForce

View File

@ -3,13 +3,13 @@ package Lemonldap::NG::Portal::Auth::SSL;
use strict;
use Mouse;
use Lemonldap::NG::Portal::Main::Constants qw(
PE_BADCERTIFICATE
PE_CERTIFICATEREQUIRED
PE_BADCERTIFICATE
PE_FIRSTACCESS
PE_OK
);
our $VERSION = '2.0.8';
our $VERSION = '2.0.12';
extends 'Lemonldap::NG::Portal::Main::Auth';
@ -89,13 +89,13 @@ sub extractFormInfo {
}
sub authenticate {
PE_OK;
return PE_OK;
}
sub setAuthSessionInfo {
my ( $self, $req ) = @_;
$req->sessionInfo->{authenticationLevel} = $self->conf->{SSLAuthnLevel};
PE_OK;
return PE_OK;
}
sub getDisplayType {
@ -104,7 +104,7 @@ sub getDisplayType {
}
sub authLogout {
PE_OK;
return PE_OK;
}
1;

View File

@ -10,7 +10,7 @@ use Lemonldap::NG::Portal::Main::Constants qw(
PE_USERNOTFOUND
);
our $VERSION = '2.0.10';
our $VERSION = '2.0.12';
extends qw(
Lemonldap::NG::Portal::Main::Auth
@ -42,18 +42,18 @@ sub extractFormInfo {
"No header " . $self->conf->{slaveUserHeader} . " found" );
return PE_USERNOTFOUND;
}
PE_OK;
return PE_OK;
}
sub authenticate {
my ( $self, $req ) = @_;
PE_OK;
return PE_OK;
}
sub setAuthSessionInfo {
my ( $self, $req ) = @_;
$req->{sessionInfo}->{authenticationLevel} = $self->conf->{slaveAuthnLevel};
PE_OK;
return PE_OK;
}
sub getDisplayType {
@ -63,7 +63,7 @@ sub getDisplayType {
sub authLogout {
my ( $self, $req ) = @_;
PE_OK;
return PE_OK;
}
1;

View File

@ -8,7 +8,7 @@ use Lemonldap::NG::Portal::Main::Constants qw(PE_OK PE_ERROR);
extends 'Lemonldap::NG::Portal::Main::Auth';
our $VERSION = '2.0.0';
our $VERSION = '2.0.12';
# INITIALIZATION
@ -216,7 +216,7 @@ sub extractFormInfo {
expires => 'Wed, 21 Oct 2015 00:00:00 GMT'
)
);
PE_OK;
return PE_OK;
}
sub setAuthSessionInfo {
@ -228,15 +228,15 @@ sub setAuthSessionInfo {
$req->{sessionInfo}->{_twitterScreenName} =
$req->data->{_twitterScreenName};
PE_OK;
return PE_OK;
}
sub authenticate {
PE_OK;
return PE_OK;
}
sub authLogout {
PE_OK;
return PE_OK;
}
sub getDisplayType {

View File

@ -5,14 +5,15 @@ use Mouse;
use Regexp::Assemble;
use Web::ID;
use Lemonldap::NG::Portal::Main::Constants qw(
PE_OK
PE_BADPARTNER
PE_BADCERTIFICATE
PE_BADCREDENTIALS
PE_BADPARTNER
PE_CERTIFICATEREQUIRED
PE_OK
);
our $VERSION = '2.0.0';
our $VERSION = '2.0.12';
extends 'Lemonldap::NG::Portal::Main::Auth';
@ -83,13 +84,13 @@ sub extractFormInfo {
}
sub authenticate {
PE_OK;
return PE_OK;
}
sub setAuthSessionInfo {
my ( $self, $req ) = @_;
$req->{sessionInfo}->{authenticationLevel} = $self->conf->{webIDAuthnLevel};
PE_OK;
return PE_OK;
}
sub getDisplayType {

View File

@ -9,7 +9,7 @@ use Lemonldap::NG::Portal::Main::Constants qw(
PE_BADCREDENTIALS
);
our $VERSION = '2.0.11';
our $VERSION = '2.0.12';
extends qw(
Lemonldap::NG::Portal::Main::Plugin
@ -166,13 +166,8 @@ sub check {
# Check token
if ( $self->ottRule->( $req, {} ) ) {
my $token = $req->param('token');
unless ($token) {
$self->userLogger->warn('CheckUser called without token');
$msg = PE_NOTOKEN;
$token = $self->ott->createToken();
}
else {
my $token;
if ( $token = $req->param('token') ) {
unless ( $self->ott->getToken($token) ) {
$self->userLogger->warn(
'CheckUser called with an expired/bad token');
@ -180,6 +175,11 @@ sub check {
$token = $self->ott->createToken();
}
}
else {
$self->userLogger->warn('CheckUser called without token');
$msg = PE_NOTOKEN;
$token = $self->ott->createToken();
}
my $params = {
PORTAL => $self->conf->{portal},

View File

@ -8,7 +8,7 @@ use Lemonldap::NG::Portal::Main::Constants qw(
PE_DECRYPTVALUE_SERVICE_NOT_ALLOWED
);
our $VERSION = '2.0.11';
our $VERSION = '2.0.12';
extends qw(
Lemonldap::NG::Portal::Main::Plugin
@ -90,20 +90,20 @@ sub run {
# Check token
if ( $self->ottRule->( $req, {} ) ) {
my $token = $req->param('token');
unless ($token) {
$self->userLogger->warn('decryptValue try without token');
$msg = PE_NOTOKEN;
$token = $self->ott->createToken();
}
else {
my $token;
if ( $token = $req->param('token') ) {
unless ( $self->ott->getToken($token) ) {
$self->userLogger->warn(
'decryptValue try with expired/bad token');
'DecryptValue called with an expired/bad token');
$msg = PE_TOKENEXPIRED;
$token = $self->ott->createToken();
}
}
else {
$self->userLogger->warn('DecryptValue called without token');
$msg = PE_NOTOKEN;
$token = $self->ott->createToken();
}
my $params = {
PORTAL => $self->conf->{portal},