...
 
Commits (1)
......@@ -28,7 +28,7 @@ Build-Depends-Indep: libapache-session-perl,
libjson-perl,
liblasso-perl,
libmime-tools-perl,
libmouse-perl,
libmoo-perl,
libnet-cidr-lite-perl,
libnet-ldap-perl,
libnet-openid-consumer-perl,
......@@ -197,7 +197,7 @@ Depends: ${misc:Depends},
libcrypt-rijndael-perl,
libhtml-template-perl,
libjson-perl,
libmouse-perl,
libmoo-perl,
libplack-perl,
liburi-perl,
libwww-perl
......
# debian/tests/runner launch pkg-perl-autopkgtest tests for each library
Test-Command: ./debian/tests/runner build-deps
Depends: @, @builddeps@, pkg-perl-autopkgtest, libmouse-perl
Depends: @, @builddeps@, pkg-perl-autopkgtest, libmoo-perl
Test-Command: ./debian/tests/runner runtime-deps
Depends: @, pkg-perl-autopkgtest, libmouse-perl
Depends: @, pkg-perl-autopkgtest, libmoo-perl
# Use pkg-perl-autopkgtest test for runtime-deps-and-recommends
# Some portal suggested dependencies are added here
......@@ -11,4 +11,4 @@ Test-Command: /usr/share/pkg-perl-autopkgtest/runner runtime-deps-and-recommends
Depends: @, @builddeps@, pkg-perl-autopkgtest, libyaml-perl, liblog-log4perl-perl, libauthen-pam-perl, libauthen-radius-perl, libweb-id-perl
#Test-Command: ./debian/tests/runner heavy-deps
#Depends: @, pkg-perl-autopkgtest, pkg-perl-autopkgtest-heavy, libmouse-perl
#Depends: @, pkg-perl-autopkgtest, pkg-perl-autopkgtest-heavy, libmoo-perl
......@@ -10,27 +10,23 @@ our $VERSION = '2.0.0';
use strict;
use Lemonldap::NG::Common::Session;
use Mouse;
use Moo;
use Digest::MD5 qw(md5_hex);
has 'storageModule' => (
is => 'ro',
isa => 'Str',
required => 1,
);
has 'storageModuleOptions' => (
is => 'ro',
isa => 'HashRef|Undef',
);
has 'storageModuleOptions' => ( is => 'ro' );
has code => ( is => 'rw', isa => 'Str' );
has code => ( is => 'rw' );
has md5 => ( is => 'rw', isa => 'Str' );
has md5 => ( is => 'rw' );
has image => ( is => 'rw', isa => 'Str' );
has image => ( is => 'rw' );
has size => ( is => 'ro', isa => 'Int' );
has size => ( is => 'ro' );
sub BUILD {
......@@ -115,6 +111,4 @@ sub removeSession {
return 0;
}
no Mouse;
1;
package Lemonldap::NG::Common::Cli;
use strict;
use Mouse;
use Moo;
use Lemonldap::NG::Common::Conf;
our $VERSION = '2.0.0';
has confAccess => (
is => 'rw',
builder => sub {
lazy=>1,
builder => 1,
);
sub _build_confAccess {
my $res = Lemonldap::NG::Common::Conf->new(
{
(
......@@ -21,11 +24,9 @@ has confAccess => (
die $Lemonldap::NG::Common::Conf::msg unless ($res);
return $res;
},
);
has cfgNum => (
is => 'rw',
isa => 'Int',
);
sub info {
......
package Lemonldap::NG::Common::Combination::Parser;
use strict;
use Mouse;
use Moo;
use Safe;
use constant PE_OK => 0;
......
......@@ -2,14 +2,14 @@ package Lemonldap::NG::Common::Conf::AccessLib;
use 5.10.0;
use utf8;
use Mouse;
use Moo;
use Lemonldap::NG::Common::Conf;
has '_confAcc' => ( is => 'rw', isa => 'Lemonldap::NG::Common::Conf' );
has 'configStorage' => ( is => 'rw', isa => 'HashRef', default => sub { {} } );
has 'currentConf' => ( is => 'rw', required => 1, default => sub { {} } );
has 'protection' => ( is => 'rw', isa => 'Str', default => 'manager' );
has '_confAcc' => ( is => 'rw' );
has 'configStorage' => ( is => 'rw', default => sub { {} } );
has 'currentConf' => ( is => 'rw', required => 1, default => sub { {} } );
has 'protection' => ( is => 'rw', default => sub { 'manager' } );
our $VERSION = '2.0.0';
......
package Lemonldap::NG::Common::Conf::Compact;
use strict;
use Mouse;
use Moo;
use Lemonldap::NG::Common::Conf::ReConstants;
our $VERSION = '2.0.0';
......
......@@ -2,7 +2,7 @@ package Lemonldap::NG::Common::Conf::RESTServer;
use strict;
use JSON 'from_json';
use Mouse;
use Moo;
use Lemonldap::NG::Common::Conf::Constants;
use Lemonldap::NG::Common::Conf::ReConstants;
......
......@@ -6,7 +6,7 @@
package Lemonldap::NG::Common::Conf::SAML::Metadata;
use strict;
use Mouse;
use Moo;
use Crypt::OpenSSL::RSA;
use Crypt::OpenSSL::X509;
use HTML::Template;
......
package Lemonldap::NG::Common::Module;
use strict;
use Mouse;
use Moo;
our $VERSION = '2.0.0';
......
package Lemonldap::NG::Common::Notifications;
use strict;
use Mouse;
use Moo;
our $VERSION = '2.0.0';
......@@ -20,7 +20,10 @@ sub import {
has notifField => (
is => 'rw',
builder => sub {
lazy=>1,
builder => 1,
);
sub _build_notifField {
my $uid =
$_[0]->conf->{notificationField}
|| $_[0]->conf->{whatToTrace}
......@@ -28,7 +31,6 @@ has notifField => (
$uid =~ s/^\$//;
return $uid;
}
);
sub getNotifications {
my ( $self, $uid ) = @_;
......
......@@ -6,7 +6,7 @@
package Lemonldap::NG::Common::Notifications::DBI;
use strict;
use Mouse;
use Moo;
use Time::Local;
use DBI;
use Encode;
......@@ -40,13 +40,15 @@ has dbiUser => (
}
);
has dbiPassword => ( is => 'ro', default => '' );
has dbiPassword => ( is => 'ro', default => sub{''} );
# Database handle object
has _dbh => (
is => 'rw',
lazy => 1,
builder => sub {
builder => 1,
);
sub _build__dbh {
my $self = shift;
my $r = DBI->connect_cached(
$self->{dbiChain}, $self->{dbiUser},
......@@ -55,7 +57,6 @@ has _dbh => (
$self->logger->error($DBI::errstr) unless ($r);
return $r;
}
);
# Current query
has sth => ( is => 'rw' );
......
......@@ -6,7 +6,7 @@
package Lemonldap::NG::Common::Notifications::File;
use strict;
use Mouse;
use Moo;
use MIME::Base64;
our $VERSION = '2.0.0';
......@@ -31,7 +31,7 @@ has table => (
}
);
has fileNameSeparator => ( is => 'rw', default => '_' );
has fileNameSeparator => ( is => 'rw', default => sub{'_'} );
# Returns notifications corresponding to the user $uid.
# If $ref is set, returns only notification corresponding to this reference.
......
package Lemonldap::NG::Common::Notifications::JSON;
use strict;
use Mouse;
use Moo;
use JSON qw(from_json to_json);
our $VERSION = '2.0.0';
......
......@@ -7,7 +7,7 @@
package Lemonldap::NG::Common::Notifications::LDAP;
use strict;
use Mouse;
use Moo;
use Time::Local;
use MIME::Base64;
use Net::LDAP;
......
package Lemonldap::NG::Common::Notifications::XML;
use strict;
use Mouse;
use Moo;
use XML::LibXML;
our $VERSION = '2.0.0';
......@@ -9,10 +9,13 @@ our $VERSION = '2.0.0';
# XML parser
has parser => (
is => 'rw',
builder => sub {
lazy=>1,
builder => 1,
);
sub _build_parser {
return XML::LibXML->new();
}
);
# Check XML data and insert new notifications.
# @param $xml XML string containing notification
......
package Lemonldap::NG::Common::PSGI;
use 5.10.0;
use Mouse;
use Moo;
use JSON;
use Lemonldap::NG::Common::PSGI::Constants;
use Lemonldap::NG::Common::PSGI::Request;
......@@ -12,16 +12,16 @@ our $_json = JSON->new->allow_nonref;
# PROPERTIES
has error => ( is => 'rw', default => '' );
has languages => ( is => 'rw', isa => 'Str', default => 'en' );
has logLevel => ( is => 'rw', isa => 'Str', default => 'info' );
has portal => ( is => 'rw', isa => 'Str' );
has staticPrefix => ( is => 'rw', isa => 'Str' );
has templateDir => ( is => 'rw', isa => 'Str' );
has links => ( is => 'rw', isa => 'ArrayRef' );
has menuLinks => ( is => 'rw', isa => 'ArrayRef' );
has logger => ( is => 'rw' );
has userLogger => ( is => 'rw' );
has error => ( is => 'rw', default => sub { '' } );
has languages => ( is => 'rw', default => sub { 'en' } );
has logLevel => ( is => 'rw', default => sub { 'info' } );
has portal => ( is => 'rw' );
has staticPrefix => ( is => 'rw' );
has templateDir => ( is => 'rw' );
has links => ( is => 'rw' );
has menuLinks => ( is => 'rw' );
has logger => ( is => 'rw' );
has userLogger => ( is => 'rw' );
# INITIALIZATION
......
package Lemonldap::NG::Common::PSGI::Cli::Lib;
use JSON;
use Mouse;
use Moo;
use Lemonldap::NG::Common::PSGI;
our $VERSION = '2.0.0';
has iniFile => ( is => 'ro', isa => 'Str' );
has iniFile => ( is => 'ro' );
has app => ( is => 'ro', isa => 'CodeRef' );
has app => ( is => 'ro' );
sub _get {
my ( $self, $path, $query ) = @_;
......
......@@ -2,7 +2,7 @@ package Lemonldap::NG::Common::PSGI::Request;
use strict;
use 5.14.0;
use Mouse;
use Moo;
use JSON;
use Plack::Request;
use URI::Escape;
......
package Lemonldap::NG::Common::PSGI::Router;
use Mouse;
use Moo;
use Lemonldap::NG::Common::PSGI;
use Lemonldap::NG::Common::PSGI::Constants;
......@@ -11,10 +11,9 @@ extends 'Lemonldap::NG::Common::PSGI';
# Properties
has 'routes' => (
is => 'rw',
isa => 'HashRef',
default => sub { { GET => {}, POST => {}, PUT => {}, DELETE => {} } }
);
has 'defaultRoute' => ( is => 'rw', default => 'index.html' );
has 'defaultRoute' => ( is => 'rw', default => sub{'index.html'} );
# Routes initialization
......
......@@ -10,71 +10,36 @@ our $VERSION = '2.0.0';
use Lemonldap::NG::Common::Apache::Session;
# Workaround for another ModPerl/Mouse issue...
BEGIN {
require Mouse;
my $v = sprintf( "%d.%03d%03d", ( $Mouse::VERSION =~ /(\d+)/g ) );
if ( $v < 2.005001 and $Lemonldap::NG::Handler::Apache2::Main::VERSION ) {
require Moose;
Moose->import();
}
else {
Mouse->import();
}
}
use Moo;
has 'id' => (
is => 'rw',
isa => 'Str|Undef',
);
has 'id' => ( is => 'rw', );
has 'force' => (
is => 'rw',
isa => 'Bool',
default => 0,
default => sub { 0 },
);
has 'kind' => (
is => 'rw',
isa => 'Str|Undef',
);
has 'kind' => ( is => 'rw', );
has 'data' => (
is => 'rw',
isa => 'HashRef',
default => sub { {} },
);
has 'options' => (
is => 'rw',
isa => 'HashRef',
);
has 'options' => ( is => 'rw', );
has 'storageModule' => (
is => 'ro',
isa => 'Str',
required => 1,
);
has 'storageModuleOptions' => (
is => 'ro',
isa => 'HashRef|Undef',
);
has 'storageModuleOptions' => ( is => 'ro', );
has 'cacheModule' => (
is => 'rw',
isa => 'Str|Undef',
);
has 'cacheModule' => ( is => 'rw', );
has 'cacheModuleOptions' => (
is => 'rw',
isa => 'HashRef|Undef',
);
has 'cacheModuleOptions' => ( is => 'rw', );
has 'error' => (
is => 'rw',
isa => 'Str|Undef',
);
has 'error' => ( is => 'rw', );
has info => ( is => 'rw' );
......@@ -224,6 +189,4 @@ sub remove {
return 1;
}
no Mouse;
1;
package Lemonldap::NG::Common::Session::REST;
use strict;
use Mouse;
use Moo;
use Lemonldap::NG::Common::Conf::Constants;
use JSON qw(from_json to_json);
......
......@@ -4,7 +4,7 @@ package Lemonldap::NG::Common::TOTP;
# <gryphon@cpan.org>
use strict;
use Mouse;
use Moo;
use Convert::Base32 'decode_base32';
use Digest::HMAC_SHA1 'hmac_sha1_hex';
......
package Lemonldap::NG::Handler::Lib::PSGI;
#use 5.10.0;
use Mouse;
use Moo;
#use Lemonldap::NG::Handler::Main qw(:jailSharedVars);
our $VERSION = '2.0.0';
has protection => ( is => 'rw', isa => 'Str' );
has rule => ( is => 'rw', isa => 'Str' );
has api => ( is => 'rw', isa => 'Str' );
has protection => ( is => 'rw' );
has rule => ( is => 'rw' );
has api => ( is => 'rw' );
## @method boolean init($args)
# Initalize main handler
......
......@@ -5,22 +5,11 @@ use strict;
use Safe;
use Lemonldap::NG::Common::Safelib; #link protected safe Safe object
# Workaround for another ModPerl/Mouse issue...
BEGIN {
require Mouse;
my $v = sprintf( "%d.%03d%03d", ( $Mouse::VERSION =~ /(\d+)/g ) );
if ( $v < 2.005001 and $Lemonldap::NG::Handler::Apache2::Main::VERSION ) {
require Moose;
Moose->import();
}
else {
Mouse->import();
}
}
use Moo;
has customFunctions => ( is => 'rw', isa => 'Maybe[Str]' );
has customFunctions => ( is => 'rw' );
has useSafeJail => ( is => 'rw', isa => 'Maybe[Int]' );
has useSafeJail => ( is => 'rw' );
has jail => ( is => 'rw' );
......
......@@ -4,7 +4,7 @@
package Lemonldap::NG::Handler::PSGI;
use 5.10.0;
use Mouse;
use Moo;
use Lemonldap::NG::Handler::PSGI::Main;
extends 'Lemonldap::NG::Handler::Lib::PSGI', 'Lemonldap::NG::Common::PSGI';
......
package Lemonldap::NG::Handler::PSGI::Router;
use 5.10.0;
use Mouse;
use Moo;
require Lemonldap::NG::Handler::PSGI::Main;
extends 'Lemonldap::NG::Handler::Lib::PSGI',
......
package Lemonldap::NG::Handler::PSGI::Try;
use strict;
use Mouse;
use Moo;
our $VERSION = '2.0.0';
......@@ -9,13 +9,11 @@ extends 'Lemonldap::NG::Handler::PSGI::Router';
has 'authRoutes' => (
is => 'rw',
isa => 'HashRef',
default => sub { { GET => {}, POST => {}, PUT => {}, DELETE => {} } }
);
has 'unAuthRoutes' => (
is => 'rw',
isa => 'HashRef',
default => sub { { GET => {}, POST => {}, PUT => {}, DELETE => {} } }
);
......
......@@ -4,7 +4,7 @@
package Lemonldap::NG::Handler::Server;
use strict;
use Mouse;
use Moo;
use Lemonldap::NG::Handler::Server::Main;
our $VERSION = '2.0.0';
......
......@@ -3,7 +3,7 @@
package Lemonldap::NG::Handler::Server::Nginx;
use strict;
use Mouse;
use Moo;
use Lemonldap::NG::Handler::Server::Main;
our $VERSION = '2.0.0';
......
......@@ -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(
......@@ -87,7 +87,7 @@ sub clean {
package Lemonldap::NG::Handler::PSGI::Cli::Lib;
use Mouse;
use Moo;
extends 'Lemonldap::NG::Common::PSGI::Cli::Lib';
......@@ -95,12 +95,14 @@ has ini => ( is => 'rw' );
has app => (
is => 'ro',
isa => 'CodeRef',
builder => sub {
return $module->run( $_[0]->{ini} );
}
lazy => 1,
builder => 1,
);
sub _build_app {
return $module->run( $_[0]->{ini} );
}
sub _get {
my ( $self, $path, $query, $host, $cookie, %custom ) = @_;
$query //= '';
......
......@@ -12,7 +12,7 @@ package Lemonldap::NG::Manager;
use 5.10.0;
use utf8;
use Mouse;
use Moo;
use JSON;
use Lemonldap::NG::Common::Conf::Constants;
use Lemonldap::NG::Common::PSGI::Constants;
......
......@@ -3,7 +3,7 @@ package Lemonldap::NG::Manager::2ndFA;
use 5.10.0;
use utf8;
use strict;
use Mouse;
use Moo;
use MIME::Base64 qw(encode_base64 decode_base64);
use Lemonldap::NG::Common::Session;
......
......@@ -2,7 +2,7 @@ package Lemonldap::NG::Manager::Build;
use strict;
use utf8;
use Mouse;
use Moo;
use Lemonldap::NG::Manager::Build::Attributes;
use Lemonldap::NG::Manager::Build::Tree;
use Lemonldap::NG::Manager::Build::CTrees;
......@@ -13,14 +13,14 @@ use JSON;
use Getopt::Std;
use IO::String;
has structFile => ( isa => 'Str', is => 'ro', required => 1 );
has confTreeFile => ( isa => 'Str', is => 'ro', required => 1 );
has managerConstantsFile => ( isa => 'Str', is => 'ro', required => 1 );
has managerAttributesFile => ( isa => 'Str', is => 'ro', required => 1 );
has defaultValuesFile => ( isa => 'Str', is => 'ro', required => 1 );
has confConstantsFile => ( isa => 'Str', is => 'ro', required => 1 );
has firstLmConfFile => ( isa => 'Str', is => 'ro', required => 1 );
has reverseTreeFile => ( isa => 'Str', is => 'ro', required => 1 );
has structFile => ( is => 'ro', required => 1 );
has confTreeFile => ( is => 'ro', required => 1 );
has managerConstantsFile => ( is => 'ro', required => 1 );
has managerAttributesFile => ( is => 'ro', required => 1 );
has defaultValuesFile => ( is => 'ro', required => 1 );
has confConstantsFile => ( is => 'ro', required => 1 );
has firstLmConfFile => ( is => 'ro', required => 1 );
has reverseTreeFile => ( is => 'ro', required => 1 );
my @managerAttrKeys = qw(keyTest keyMsgFail select type test msgFail default);
my $format = 'Creating %-69s: ';
......
package Lemonldap::NG::Manager::Cli;
use strict;
use Mouse;
use Moo;
use Data::Dumper;
use Lemonldap::NG::Common::Conf::ReConstants;
......@@ -12,7 +12,6 @@ extends('Lemonldap::NG::Manager::Cli::Lib');
has cfgNum => (
is => 'rw',
isa => 'Int',
trigger => sub {
$_[0]->{req} =
Lemonldap::NG::Manager::Cli::Request->new(
......@@ -20,15 +19,15 @@ has cfgNum => (
}
);
has sep => ( is => 'rw', isa => 'Str', default => '/' );
has sep => ( is => 'rw', default => sub { '/' } );
has req => ( is => 'ro' );
has format => ( is => 'rw', isa => 'Str', default => "%-25s | %-25s | %-25s" );
has format => ( is => 'rw', default => sub { "%-25s | %-25s | %-25s" } );
has yes => ( is => 'rw', isa => 'Bool', default => 0 );
has yes => ( is => 'rw', default => sub { 0 } );
has force => ( is => 'rw', isa => 'Bool', default => 0 );
has force => ( is => 'rw', default => sub { 0 } );
sub get {
my ( $self, @keys ) = @_;
......@@ -301,7 +300,7 @@ sub run {
package Lemonldap::NG::Manager::Cli::Request;
use Mouse;
use Moo;
has cfgNum => ( is => 'rw' );
......
package Lemonldap::NG::Manager::Cli::Lib;
use Mouse;
use Moo;
use Lemonldap::NG::Manager;
our $VERSION = '2.0.0';
extends 'Lemonldap::NG::Common::PSGI::Cli::Lib';
has mgr => ( is => 'ro', isa => 'Lemonldap::NG::Manager' );
has mgr => ( is => 'ro' );
has app => (
is => 'ro',
isa => 'CodeRef',
builder => sub {
lazy=>1,
builder => 1,
);
sub _build_app {
my $args = { protection => 'none' };
$args->{configStorage} = { confFile => $_[0]->{iniFile} }
if ( $_[0]->{iniFile} );
......@@ -20,6 +22,5 @@ has app => (
$_[0]->{mgr}->init($args);
return $_[0]->{mgr}->run();
}
);
1;
......@@ -8,7 +8,7 @@ package Lemonldap::NG::Manager::Conf;
use 5.10.0;
use utf8;
use Mouse;
use Moo;
use Lemonldap::NG::Common::Conf::Constants;
use Lemonldap::NG::Common::UserAgent;
use Crypt::OpenSSL::RSA;
......
package Lemonldap::NG::Manager::Conf::Diff;
use strict;
use Mouse;
use Moo;
use Lemonldap::NG::Manager::Conf::Parser;
use Lemonldap::NG::Common::Conf::Constants;
......
......@@ -20,7 +20,7 @@ package Lemonldap::NG::Manager::Conf::Parser;
use strict;
use utf8;
use Mouse;
use Moo;
use JSON 'to_json';
use Lemonldap::NG::Common::Conf::ReConstants;
use Lemonldap::NG::Manager::Attributes;
......@@ -35,44 +35,39 @@ use constant HIGHDEBUG => 0;
# Messages storage
has errors => (
is => 'rw',
isa => 'ArrayRef',
default => sub { return [] }
);
has warnings => (
is => 'rw',
isa => 'ArrayRef',
default => sub { return [] },
trigger => sub {
hdebug( 'warnings contains', $_[0]->{warnings} );
}
);
has changes => ( is => 'rw', isa => 'ArrayRef', default => sub { return [] } );
has changes => ( is => 'rw', default => sub { return [] } );
has message => (
is => 'rw',
isa => 'Str',
default => '',
default => sub { '' },
trigger => sub {
hdebug( "Message becomes " . $_[0]->{message} );
}
);
# Booleans
has needConfirm =>
( is => 'rw', isa => 'ArrayRef', default => sub { return [] } );
has needConfirm => ( is => 'rw', default => sub { return [] } );
has confChanged => (
is => 'rw',
isa => 'Bool',
default => 0,
default => sub { 0 },
trigger => sub {
hdebug( "condChanged: " . $_[0]->{confChanged} );
}
);
# Properties required during build
has refConf => ( is => 'ro', isa => 'HashRef', required => 1 );
has refConf => ( is => 'ro', required => 1 );
has req => ( is => 'ro', required => 1 );
has newConf => ( is => 'rw', isa => 'HashRef' );
has tree => ( is => 'rw', isa => 'ArrayRef' );
has newConf => ( is => 'rw' );
has tree => ( is => 'rw' );
# High debug method
sub hdebug {
......@@ -158,7 +153,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};
##################################
......@@ -1060,15 +1055,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},
......
......@@ -2,7 +2,7 @@ package Lemonldap::NG::Manager::Notifications;
use 5.10.0;
use utf8;
use Mouse;
use Moo;
use JSON qw(from_json to_json);
use POSIX qw(strftime);
......
......@@ -3,7 +3,7 @@ package Lemonldap::NG::Manager::Sessions;
use 5.10.0;
use utf8;
use strict;
use Mouse;
use Moo;
use Lemonldap::NG::Common::Session;
use Lemonldap::NG::Common::Conf::Constants;
......
......@@ -10,7 +10,7 @@
package Lemonldap::NG::Portal::2F::Engines::Default;
use strict;
use Mouse;
use Moo;
use JSON qw(from_json to_json);
use Lemonldap::NG::Portal::Main::Constants qw(
PE_ERROR
......
package Lemonldap::NG::Portal::2F::Ext2F;
use strict;
use Mouse;
use Moo;
use Lemonldap::NG::Portal::Main::Constants qw(
PE_BADCREDENTIALS
PE_ERROR
......@@ -16,7 +16,7 @@ extends 'Lemonldap::NG::Portal::Main::SecondFactor';
# INITIALIZATION
has prefix => ( is => 'ro', default => 'ext' );
has prefix => ( is => 'ro', default => sub{'ext'} );
sub init {
my ($self) = @_;
......
package Lemonldap::NG::Portal::2F::REST;
use strict;
use Mouse;
use Moo;
use Lemonldap::NG::Portal::Main::Constants qw(
PE_BADCREDENTIALS
PE_ERROR
......@@ -17,7 +17,7 @@ extends 'Lemonldap::NG::Portal::Main::SecondFactor',
# INITIALIZATION
has prefix => ( is => 'ro', default => 'rest' );
has prefix => ( is => 'ro', default => sub{'rest'} );
has initAttrs => ( is => 'rw', default => sub { {} } );
......
......@@ -2,7 +2,7 @@
package Lemonldap::NG::Portal::2F::Register::TOTP;
use strict;
use Mouse;
use Moo;
use JSON qw(from_json to_json);
our $VERSION = '2.0.0';
......@@ -11,11 +11,11 @@ extends 'Lemonldap::NG::Portal::Main::Plugin', 'Lemonldap::NG::Common::TOTP';
# INITIALIZATION
has prefix => ( is => 'rw', default => 'totp' );
has prefix => ( is => 'rw', default => sub { 'totp' } );
has template => ( is => 'ro', default => 'totp2fregister' );
has template => ( is => 'ro', default => sub { 'totp2fregister' } );
has logo => ( is => 'rw', default => 'totp.png' );
has logo => ( is => 'rw', default => sub { 'totp.png' } );
has ott => (
is => 'rw',
......
......@@ -2,7 +2,7 @@
package Lemonldap::NG::Portal::2F::Register::U2F;
use strict;
use Mouse;
use Moo;
use JSON qw(from_json to_json);
our $VERSION = '2.0.0';
......@@ -12,11 +12,11 @@ extends 'Lemonldap::NG::Portal::Main::Plugin',
# INITIALIZATION
has prefix => ( is => 'rw', default => 'u' );
has prefix => ( is => 'rw', default => sub{'u'} );
has template => ( is => 'ro', default => 'u2fregister' );
has template => ( is => 'ro', default => sub{'u2fregister'} );
has logo => ( is => 'rw', default => 'u2f.png' );
has logo => ( is => 'rw', default => sub{'u2f.png'} );
sub init {
my ($self) = @_;
......
......@@ -2,7 +2,7 @@
package Lemonldap::NG::Portal::2F::Register::Yubikey;
use strict;
use Mouse;
use Moo;
use JSON qw(from_json to_json);
use Lemonldap::NG::Portal::Main::Constants qw(
PE_FORMEMPTY
......@@ -15,11 +15,11 @@ extends 'Lemonldap::NG::Portal::Main::Plugin';
# INITIALIZATION
has prefix => ( is => 'rw', default => 'yubikey' );
has prefix => ( is => 'rw', default => sub { 'yubikey' } );
has template => ( is => 'ro', default => 'yubikey2fregister' );
has template => ( is => 'ro', default => sub { 'yubikey2fregister' } );
has logo => ( is => 'rw', default => 'yubikey.png' );
has logo => ( is => 'rw', default => sub { 'yubikey.png' } );
sub init {
my ($self) = @_;
......
......@@ -5,7 +5,7 @@
package Lemonldap::NG::Portal::2F::TOTP;
use strict;
use Mouse;
use Moo;
use JSON qw(from_json to_json);
use Lemonldap::NG::Portal::Main::Constants qw(
PE_BADCREDENTIALS
......@@ -22,9 +22,9 @@ extends 'Lemonldap::NG::Portal::Main::SecondFactor',
# INITIALIZATION
has prefix => ( is => 'ro', default => 'totp' );
has prefix => ( is => 'ro', default => sub{'totp'} );
has logo => ( is => 'rw', default => 'totp.png' );
has logo => ( is => 'rw', default => sub{'totp.png'} );
sub init {
my ($self) = @_;
......
......@@ -6,7 +6,7 @@ package Lemonldap::NG::Portal::2F::U2F;
#use 5.16.0;
use strict;
use Mouse;
use Moo;
use JSON qw(from_json to_json);
use Lemonldap::NG::Portal::Main::Constants qw(
PE_BADCREDENTIALS
......@@ -25,9 +25,9 @@ extends 'Lemonldap::NG::Portal::Main::SecondFactor',
has rule => ( is => 'rw' );
has prefix => ( is => 'ro', default => 'u' );
has prefix => ( is => 'ro', default => sub{'u'} );
has logo => ( is => 'rw', default => 'u2f.png' );
has logo => ( is => 'rw', default => sub{'u2f.png'} );
sub init {
my ($self) = @_;
......
package Lemonldap::NG::Portal::2F::UTOTP;
use strict;
use Mouse;
use Moo;
use JSON qw(from_json to_json);
use Lemonldap::NG::Portal::Main::Constants qw(
);
......@@ -12,9 +12,9 @@ extends 'Lemonldap::NG::Portal::Main::SecondFactor';
# INITIALIZATION
has prefix => ( is => 'ro', default => 'utotp' );
has prefix => ( is => 'ro', default => sub{'utotp'} );
has logo => ( is => 'rw', default => 'utotp.png' );
has logo => ( is => 'rw', default => sub{'utotp.png'} );
has u2f => ( is => 'rw' );
......
......@@ -5,7 +5,7 @@
package Lemonldap::NG::Portal::2F::Yubikey;
use strict;
use Mouse;
use Moo;
use JSON qw(from_json to_json);
use Lemonldap::NG::Portal::Main::Constants qw(
PE_ERROR
......@@ -21,9 +21,9 @@ extends 'Lemonldap::NG::Portal::Main::SecondFactor';
# INITIALIZATION
has prefix => ( is => 'ro', default => 'yubikey' );
has prefix => ( is => 'ro', default => sub{'yubikey'} );
has logo => ( is => 'rw', default => 'yubikey.png' );
has logo => ( is => 'rw', default => sub{'yubikey.png'} );
has yubi => ( is => 'rw' );
......
......@@ -11,13 +11,13 @@ Lemonldap:NG::Portal::Auth - Writing authentication modules for LemonLDAP::NG.
package Lemonldap::NG::Portal::Auth::My;
use strict;
use Mouse;
use Moo;
# Add constants used by this module
use Lemonldap::NG::Portal::Main::Constants qw(PE_OK);
our $VERSION = '0.1';
# Directive provides by Mouse
# Directive provides by Moo
extends 'Lemonldap::NG::Portal::Main::Auth';
sub init {
......
......@@ -4,7 +4,7 @@
package Lemonldap::NG::Portal::Auth::AD;
use strict;
use Mouse;
use Moo;
use Lemonldap::NG::Portal::Main::Constants
qw(PE_OK PE_PP_PASSWORD_EXPIRED PE_PP_CHANGE_AFTER_RESET);
......@@ -17,22 +17,24 @@ extends 'Lemonldap::NG::Portal::Auth::LDAP';
has adPwdMaxAge => (
is => 'rw',
lazy => 1,
builder => sub {
builder => 1,
);
sub _build_adPwdMaxAge {
my $conf = $_[0]->{conf};
my $res = $conf->{ADPwdMaxAge} || 0;
return $res * 10000000; # padding with '0' to obtain 0.1 micro-seconds
}
);
has adPwdExpireWarning => (
is => 'rw',
lazy => 1,
builder => sub {
builder => 1,
);
sub _build_adPwdExpireWarning {
my $conf = $_[0]->{conf};
my $res = $conf->{ADPwdExpireWarning} || 0;
return $res * 10000000; # padding with '0' to obtain 0.1 micro-seconds
}
);
# AD timestamp starts from Jan 01 1601 and is defined in 0.1 micro seconds.
# This method converts Unix timestamp into AD timestamp.
......
package Lemonldap::NG::Portal::Auth::Apache;
use strict;
use Mouse;
use Moo;
use Lemonldap::NG::Portal::Main::Constants qw(PE_ERROR PE_OK);
our $VERSION = '2.0.0';
......
package Lemonldap::NG::Portal::Auth::CAS;
use strict;
use Mouse;
use Moo;
use URI::Escape;
use Lemonldap::NG::Common::FormEncode;
use Lemonldap::NG::Portal::Main::Constants qw(
......@@ -18,7 +18,7 @@ extends 'Lemonldap::NG::Portal::Main::Auth', 'Lemonldap::NG::Portal::Lib::CAS';
# PROPERTIES
has srvNumber => ( is => 'rw', default => 0 );
has srvNumber => ( is => 'rw', default => sub{0} );
has srvList => ( is => 'rw', default => sub { [] } );
use constant sessionKind => 'CAS';
......
package Lemonldap::NG::Portal::Auth::Choice;
use strict;
use Mouse;
use Moo;
use Lemonldap::NG::Portal::Main::Constants qw(PE_OK PE_FIRSTACCESS);
our $VERSION = '2.0.0';
......
package Lemonldap::NG::Portal::Auth::Combination;
use strict;
use Mouse;
use Moo;
use Lemonldap::NG::Common::Combination::Parser;
use Lemonldap::NG::Portal::Main::Constants qw(PE_OK PE_ERROR);
use Scalar::Util 'weaken';
......
package Lemonldap::NG::Portal::Auth::DBI;
use strict;
use Mouse;
use Moo;
use Lemonldap::NG::Portal::Main::Constants qw(PE_OK PE_BADCREDENTIALS);
our $VERSION = '2.0.0';
......
......@@ -6,7 +6,7 @@
package Lemonldap::NG::Portal::Auth::Demo;
use strict;
use Mouse;
use Moo;
use Lemonldap::NG::Portal::Main::Constants qw(PE_OK PE_BADCREDENTIALS);
extends qw(Lemonldap::NG::Portal::Auth::_WebForm);
......
package Lemonldap::NG::Portal::Auth::Facebook;
use strict;
use Mouse;
use Moo;
use URI::Escape;
use Lemonldap::NG::Common::FormEncode;
use Lemonldap::NG::Portal::Main::Constants qw(PE_OK PE_ERROR PE_BADCREDENTIALS);
......
package Lemonldap::NG::Portal::Auth::Kerberos;
use strict;
use Mouse;
use Moo;
use GSSAPI;
use MIME::Base64;
use Lemonldap::NG::Portal::Main::Constants qw(
......
package Lemonldap::NG::Portal::Auth::LDAP;
use strict;
use Mouse;
use Moo;
use Lemonldap::NG::Portal::Main::Constants
qw(PE_OK PE_LDAPCONNECTFAILED PE_PP_CHANGE_AFTER_RESET PE_PP_PASSWORD_EXPIRED);
......
......@@ -2,7 +2,7 @@ package Lemonldap::NG::Portal::Auth::LinkedIn;
use strict;
use JSON;
use Mouse;
use Moo;
use MIME::Base64 qw/encode_base64 decode_base64/;
use Lemonldap::NG::Common::FormEncode;
use Lemonldap::NG::Common::UserAgent;
......@@ -18,14 +18,15 @@ extends 'Lemonldap::NG::Portal::Main::Auth';
has ua => (
is => 'rw',
lazy => 1,
builder => sub {
builder => 1,
);
sub _build_ua {
# TODO : LWP options to use a proxy for example
my $ua = Lemonldap::NG::Common::UserAgent->new( $_[0]->{conf} );
$ua->env_proxy();
return $ua;
}
);
has linkedInAuthorizationEndpoint => (
is => 'ro',
......
package Lemonldap::NG::Portal::Auth::Null;
use strict;