Mark some properties "lazy" to be sure conf is intialized (#595)
This commit is contained in:
parent
6efec8525f
commit
c761cc5781
|
@ -628,8 +628,7 @@ sub metadatas {
|
||||||
. $c );
|
. $c );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$self->logger->info(
|
$self->logger->info("REST request to get full configuration $c");
|
||||||
"REST request to get full configuration $c");
|
|
||||||
}
|
}
|
||||||
return $self->sendJSONresponse(
|
return $self->sendJSONresponse(
|
||||||
$req,
|
$req,
|
||||||
|
|
|
@ -5,7 +5,7 @@ use base 'Exporter';
|
||||||
@EXPORT = qw(&isIPv6 &net6 &expand6);
|
@EXPORT = qw(&isIPv6 &net6 &expand6);
|
||||||
|
|
||||||
sub isIPv6 {
|
sub isIPv6 {
|
||||||
my($ip) = @_;
|
my ($ip) = @_;
|
||||||
return $ip =~ /^[a-z0-9:]+$/i;
|
return $ip =~ /^[a-z0-9:]+$/i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -292,7 +292,8 @@ sub forbidden {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $session->{_upgrade} ) {
|
if ( $session->{_upgrade} ) {
|
||||||
return $class->goToPortal( $class->unparsed_uri, undef, '/upgradesession' );
|
return $class->goToPortal( $class->unparsed_uri, undef,
|
||||||
|
'/upgradesession' );
|
||||||
}
|
}
|
||||||
|
|
||||||
# Log forbidding
|
# Log forbidding
|
||||||
|
|
|
@ -495,6 +495,7 @@ sub scanTree {
|
||||||
push @sessionTypes, $1
|
push @sessionTypes, $1
|
||||||
if ( $leaf =~ /^(.*)(?<!notification)StorageOptions$/ );
|
if ( $leaf =~ /^(.*)(?<!notification)StorageOptions$/ );
|
||||||
my $attr = $attributes->{$leaf} or die("Missing attribute $leaf");
|
my $attr = $attributes->{$leaf} or die("Missing attribute $leaf");
|
||||||
|
|
||||||
#print STDERR "| $attr->{documentation} | $leaf |\n";
|
#print STDERR "| $attr->{documentation} | $leaf |\n";
|
||||||
$jleaf = { id => "$prefix$leaf", title => $leaf };
|
$jleaf = { id => "$prefix$leaf", title => $leaf };
|
||||||
unless ( $attr->{type} ) {
|
unless ( $attr->{type} ) {
|
||||||
|
|
|
@ -136,7 +136,8 @@ ok( $res->{count} == 1, 'One A subnet' );
|
||||||
ok( $res->{values}->[0]->{count} == 4, 'All sessions found' );
|
ok( $res->{values}->[0]->{count} == 4, 'All sessions found' );
|
||||||
$res = &client->jsonResponse( '/sessions/global', 'groupBy=net4(ipAddr,2)' );
|
$res = &client->jsonResponse( '/sessions/global', 'groupBy=net4(ipAddr,2)' );
|
||||||
ok( $res->{count} == 3, 'Three B subnet' );
|
ok( $res->{count} == 3, 'Three B subnet' );
|
||||||
ok( $res->{values}->[1]->{count} == 2, 'All sessions found' ) or print STDERR Dumper($res);
|
ok( $res->{values}->[1]->{count} == 2, 'All sessions found' )
|
||||||
|
or print STDERR Dumper($res);
|
||||||
count(4);
|
count(4);
|
||||||
|
|
||||||
$res = &client->jsonResponse( '/sessions/global', 'orderBy=net4(ipAddr)' );
|
$res = &client->jsonResponse( '/sessions/global', 'orderBy=net4(ipAddr)' );
|
||||||
|
|
|
@ -16,6 +16,7 @@ extends 'Lemonldap::NG::Portal::Auth::LDAP';
|
||||||
|
|
||||||
has adPwdMaxAge => (
|
has adPwdMaxAge => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
|
lazy => 1,
|
||||||
builder => sub {
|
builder => sub {
|
||||||
my $conf = $_[0]->{conf};
|
my $conf = $_[0]->{conf};
|
||||||
my $res = $conf->{ADPwdMaxAge} || 0;
|
my $res = $conf->{ADPwdMaxAge} || 0;
|
||||||
|
@ -25,6 +26,7 @@ has adPwdMaxAge => (
|
||||||
|
|
||||||
has adPwdExpireWarning => (
|
has adPwdExpireWarning => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
|
lazy => 1,
|
||||||
builder => sub {
|
builder => sub {
|
||||||
my $conf = $_[0]->{conf};
|
my $conf = $_[0]->{conf};
|
||||||
my $res = $conf->{ADPwdExpireWarning} || 0;
|
my $res = $conf->{ADPwdExpireWarning} || 0;
|
||||||
|
|
|
@ -19,6 +19,7 @@ extends 'Lemonldap::NG::Portal::Auth::Base', 'Lemonldap::NG::Portal::Lib::CAS';
|
||||||
# Act as a proxy if proxied services configured
|
# Act as a proxy if proxied services configured
|
||||||
has proxy => (
|
has proxy => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
|
lazy => 1,
|
||||||
builder => sub {
|
builder => sub {
|
||||||
return
|
return
|
||||||
ref( $_[0]->conf->{CAS_proxiedServices} ) eq 'HASH'
|
ref( $_[0]->conf->{CAS_proxiedServices} ) eq 'HASH'
|
||||||
|
|
|
@ -17,6 +17,7 @@ has stackSub => ( is => 'rw' );
|
||||||
|
|
||||||
has wrapUserLogger => (
|
has wrapUserLogger => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
|
lazy => 1,
|
||||||
default => sub {
|
default => sub {
|
||||||
Lemonldap::NG::Portal::Lib::Combination::UserLogger->new(
|
Lemonldap::NG::Portal::Lib::Combination::UserLogger->new(
|
||||||
$_[0]->{userLogger} );
|
$_[0]->{userLogger} );
|
||||||
|
|
|
@ -23,6 +23,7 @@ extends 'Lemonldap::NG::Portal::Auth::Base';
|
||||||
|
|
||||||
has secret => (
|
has secret => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
|
lazy => 1,
|
||||||
default => sub {
|
default => sub {
|
||||||
return $_[0]->conf->{openIdSecret}
|
return $_[0]->conf->{openIdSecret}
|
||||||
|| $_[0]->conf->{cipher}->encrypt(0);
|
|| $_[0]->conf->{cipher}->encrypt(0);
|
||||||
|
@ -31,6 +32,7 @@ has secret => (
|
||||||
|
|
||||||
has listIsWhite => (
|
has listIsWhite => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
|
lazy => 1,
|
||||||
default => sub {
|
default => sub {
|
||||||
( $_[0]->conf->{openIdIDPList} =~ /^(\d);/ )[0] + 0;
|
( $_[0]->conf->{openIdIDPList} =~ /^(\d);/ )[0] + 0;
|
||||||
}
|
}
|
||||||
|
@ -38,6 +40,7 @@ has listIsWhite => (
|
||||||
|
|
||||||
has idpList => (
|
has idpList => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
|
lazy => 1,
|
||||||
default => sub {
|
default => sub {
|
||||||
Lemonldap::NG::Common::Regexp::reDomainsToHost(
|
Lemonldap::NG::Common::Regexp::reDomainsToHost(
|
||||||
( $_[0]->conf->{openIdIDPList} =~ /^\d;(.*)$/ )[0] );
|
( $_[0]->conf->{openIdIDPList} =~ /^\d;(.*)$/ )[0] );
|
||||||
|
|
|
@ -302,8 +302,8 @@ sub authLogout {
|
||||||
my $logout_url = $self->conf->{portal} . '?logout=1';
|
my $logout_url = $self->conf->{portal} . '?logout=1';
|
||||||
$req->urldc(
|
$req->urldc(
|
||||||
$self->buildLogoutRequest(
|
$self->buildLogoutRequest(
|
||||||
$endsession_endpoint,
|
$endsession_endpoint, $req->{sessionInfo}->{_oidc_id_token},
|
||||||
$req->{sessionInfo}->{_oidc_id_token}, $logout_url
|
$logout_url
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ our $VERSION = '2.0.0';
|
||||||
|
|
||||||
has service => (
|
has service => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
|
lazy => 1,
|
||||||
default => sub {
|
default => sub {
|
||||||
return $_[0]->{conf}->{pamService} || 'login';
|
return $_[0]->{conf}->{pamService} || 'login';
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ has radius => ( is => 'rw' );
|
||||||
|
|
||||||
has authnLevel => (
|
has authnLevel => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
|
lazy => 1,
|
||||||
default => sub {
|
default => sub {
|
||||||
$_[0]->conf->{radiusAuthnLevel};
|
$_[0]->conf->{radiusAuthnLevel};
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ our $VERSION = '2.0.0';
|
||||||
|
|
||||||
has twitterRequestTokenURL => (
|
has twitterRequestTokenURL => (
|
||||||
is => 'ro',
|
is => 'ro',
|
||||||
|
lazy => 1,
|
||||||
default => sub {
|
default => sub {
|
||||||
$_[0]->conf->{twitterRequestTokenURL}
|
$_[0]->conf->{twitterRequestTokenURL}
|
||||||
|| 'https://api.twitter.com/oauth/request_token';
|
|| 'https://api.twitter.com/oauth/request_token';
|
||||||
|
@ -19,6 +20,7 @@ has twitterRequestTokenURL => (
|
||||||
|
|
||||||
has twitterAuthorizeURL => (
|
has twitterAuthorizeURL => (
|
||||||
is => 'ro',
|
is => 'ro',
|
||||||
|
lazy => 1,
|
||||||
default => sub {
|
default => sub {
|
||||||
$_[0]->conf->{twitterAuthorizeURL}
|
$_[0]->conf->{twitterAuthorizeURL}
|
||||||
|| 'https://api.twitter.com/oauth/authorize';
|
|| 'https://api.twitter.com/oauth/authorize';
|
||||||
|
@ -27,6 +29,7 @@ has twitterAuthorizeURL => (
|
||||||
|
|
||||||
has twitterAccessTokenURL => (
|
has twitterAccessTokenURL => (
|
||||||
is => 'ro',
|
is => 'ro',
|
||||||
|
lazy => 1,
|
||||||
default => sub {
|
default => sub {
|
||||||
$_[0]->conf->{twitterAccessTokenURL}
|
$_[0]->conf->{twitterAccessTokenURL}
|
||||||
|| 'https://api.twitter.com/oauth/access_token';
|
|| 'https://api.twitter.com/oauth/access_token';
|
||||||
|
|
|
@ -20,6 +20,7 @@ extends 'Lemonldap::NG::Portal::Auth::Base';
|
||||||
|
|
||||||
has SSLField => (
|
has SSLField => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
|
lazy => 1,
|
||||||
default => sub {
|
default => sub {
|
||||||
return ( $_[0]->{conf}->{SSLVar} || 'SSL_CLIENT_S_DN_Email' );
|
return ( $_[0]->{conf}->{SSLVar} || 'SSL_CLIENT_S_DN_Email' );
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ extends 'Lemonldap::NG::Portal::Auth::Base';
|
||||||
|
|
||||||
has authnLevel => (
|
has authnLevel => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
|
lazy => 1,
|
||||||
builder => sub {
|
builder => sub {
|
||||||
my $conf = $_[0]->{conf};
|
my $conf = $_[0]->{conf};
|
||||||
return ( $conf->{portal} =~ /^https/ ? 2 : 1 );
|
return ( $conf->{portal} =~ /^https/ ? 2 : 1 );
|
||||||
|
@ -109,7 +110,9 @@ sub extractFormInfo {
|
||||||
$self->logger->debug("Captcha code verified");
|
$self->logger->debug("Captcha code verified");
|
||||||
}
|
}
|
||||||
elsif ( $self->ott ) {
|
elsif ( $self->ott ) {
|
||||||
unless ( $req->datas->{tokenVerified} or $self->ott->getToken($token) ) {
|
unless ( $req->datas->{tokenVerified}
|
||||||
|
or $self->ott->getToken($token) )
|
||||||
|
{
|
||||||
$self->ott->setToken($req);
|
$self->ott->setToken($req);
|
||||||
$self->userLogger->warn('Token expired');
|
$self->userLogger->warn('Token expired');
|
||||||
return PE_TOKENEXPIRED;
|
return PE_TOKENEXPIRED;
|
||||||
|
@ -150,7 +153,8 @@ sub getDisplayType {
|
||||||
}
|
}
|
||||||
|
|
||||||
sub setSecurity {
|
sub setSecurity {
|
||||||
my($self,$req) = @_;
|
my ( $self, $req ) = @_;
|
||||||
|
|
||||||
# If captcha is enable, prepare it
|
# If captcha is enable, prepare it
|
||||||
if ( $self->captcha ) {
|
if ( $self->captcha ) {
|
||||||
$self->captcha->setCaptcha($req);
|
$self->captcha->setCaptcha($req);
|
||||||
|
|
|
@ -23,6 +23,7 @@ extends 'Lemonldap::NG::Portal::Main::Issuer';
|
||||||
|
|
||||||
has secret => (
|
has secret => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
|
lazy => 1,
|
||||||
default => sub {
|
default => sub {
|
||||||
return $_[0]->conf->{openIdIssuerSecret}
|
return $_[0]->conf->{openIdIssuerSecret}
|
||||||
|| $_[0]->conf->{cipher}->encrypt(0);
|
|| $_[0]->conf->{cipher}->encrypt(0);
|
||||||
|
@ -31,6 +32,7 @@ has secret => (
|
||||||
|
|
||||||
has listIsWhite => (
|
has listIsWhite => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
|
lazy => 1,
|
||||||
default => sub {
|
default => sub {
|
||||||
( $_[0]->conf->{openIdSPList} =~ /^(\d);/ )[0] + 0;
|
( $_[0]->conf->{openIdSPList} =~ /^(\d);/ )[0] + 0;
|
||||||
}
|
}
|
||||||
|
@ -38,6 +40,7 @@ has listIsWhite => (
|
||||||
|
|
||||||
has spList => (
|
has spList => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
|
lazy => 1,
|
||||||
default => sub {
|
default => sub {
|
||||||
Lemonldap::NG::Common::Regexp::reDomainsToHost(
|
Lemonldap::NG::Common::Regexp::reDomainsToHost(
|
||||||
( $_[0]->conf->{openIdSPList} =~ /^\d;(.*)$/ )[0] );
|
( $_[0]->conf->{openIdSPList} =~ /^\d;(.*)$/ )[0] );
|
||||||
|
|
|
@ -28,6 +28,7 @@ sub beforeAuth { 'exportRequestParameters' }
|
||||||
|
|
||||||
has configStorage => (
|
has configStorage => (
|
||||||
is => 'ro',
|
is => 'ro',
|
||||||
|
lazy => 1,
|
||||||
default => sub {
|
default => sub {
|
||||||
$_[0]->{p}->HANDLER->localConfig->{configStorage};
|
$_[0]->{p}->HANDLER->localConfig->{configStorage};
|
||||||
}
|
}
|
||||||
|
@ -114,7 +115,9 @@ sub run {
|
||||||
$oidc_request->{$param} = $req->param($param);
|
$oidc_request->{$param} = $req->param($param);
|
||||||
$self->logger->debug( "OIDC request parameter $param: "
|
$self->logger->debug( "OIDC request parameter $param: "
|
||||||
. $oidc_request->{$param} );
|
. $oidc_request->{$param} );
|
||||||
$self->p->setHiddenFormValue( $req, $param, $oidc_request->{$param}, '', 0 );
|
$self->p->setHiddenFormValue( $req, $param,
|
||||||
|
$oidc_request->{$param},
|
||||||
|
'', 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -840,7 +843,9 @@ qq'<h3 trspan="oidcConsent,$display_name">The application $display_name would li
|
||||||
$req->urldc($response_url);
|
$req->urldc($response_url);
|
||||||
return PE_REDIRECT;
|
return PE_REDIRECT;
|
||||||
}
|
}
|
||||||
return $req->param('confirm') == 1 ? ($err ? $err : PE_LOGOUT_OK ) : PE_OK;
|
return $req->param('confirm') == 1
|
||||||
|
? ( $err ? $err : PE_LOGOUT_OK )
|
||||||
|
: PE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
$req->info(
|
$req->info(
|
||||||
|
|
|
@ -9,21 +9,46 @@ our $VERSION = '2.0.0';
|
||||||
|
|
||||||
extends 'Lemonldap::NG::Common::Module';
|
extends 'Lemonldap::NG::Common::Module';
|
||||||
|
|
||||||
has width =>
|
has width => (
|
||||||
( is => 'rw', default => sub { $_[0]->{conf}->{captchaWidth} || 220 } );
|
is => 'rw',
|
||||||
has height =>
|
lazy => 1,
|
||||||
( is => 'rw', default => sub { $_[0]->{conf}->{captchaHeight} || 40 } );
|
default => sub { $_[0]->{conf}->{captchaWidth} || 220 }
|
||||||
has lines =>
|
);
|
||||||
( is => 'rw', default => sub { $_[0]->{conf}->{captchaLines} || 5 } );
|
has height => (
|
||||||
has scramble =>
|
is => 'rw',
|
||||||
( is => 'rw', default => sub { $_[0]->{conf}->{captchaScramble} || 1 } );
|
lazy => 1,
|
||||||
has fgColor =>
|
default => sub { $_[0]->{conf}->{captchaHeight} || 40 }
|
||||||
( is => 'rw', default => sub { $_[0]->{conf}->{captchaFg} || '#403030' } );
|
);
|
||||||
has bgColor =>
|
has lines => (
|
||||||
( is => 'rw', default => sub { $_[0]->{conf}->{captchaBg} || '#FF644B' } );
|
is => 'rw',
|
||||||
has rndmax =>
|
lazy => 1,
|
||||||
( is => 'rw', default => sub { $_[0]->{conf}->{captcha_size} || 6 } );
|
default => sub { $_[0]->{conf}->{captchaLines} || 5 }
|
||||||
has timeout => ( is => 'rw', default => sub { $_[0]->{conf}->{formTimeout} } );
|
);
|
||||||
|
has scramble => (
|
||||||
|
is => 'rw',
|
||||||
|
lazy => 1,
|
||||||
|
default => sub { $_[0]->{conf}->{captchaScramble} || 1 }
|
||||||
|
);
|
||||||
|
has fgColor => (
|
||||||
|
is => 'rw',
|
||||||
|
lazy => 1,
|
||||||
|
default => sub { $_[0]->{conf}->{captchaFg} || '#403030' }
|
||||||
|
);
|
||||||
|
has bgColor => (
|
||||||
|
is => 'rw',
|
||||||
|
lazy => 1,
|
||||||
|
default => sub { $_[0]->{conf}->{captchaBg} || '#FF644B' }
|
||||||
|
);
|
||||||
|
has rndmax => (
|
||||||
|
is => 'rw',
|
||||||
|
lazy => 1,
|
||||||
|
default => sub { $_[0]->{conf}->{captcha_size} || 6 }
|
||||||
|
);
|
||||||
|
has timeout => (
|
||||||
|
is => 'rw',
|
||||||
|
lazy => 1,
|
||||||
|
default => sub { $_[0]->{conf}->{formTimeout} }
|
||||||
|
);
|
||||||
|
|
||||||
has ott => (
|
has ott => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
|
|
|
@ -10,6 +10,7 @@ extends 'Lemonldap::NG::Common::Module';
|
||||||
|
|
||||||
has timeout => (
|
has timeout => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
|
lazy => 1,
|
||||||
default => sub {
|
default => sub {
|
||||||
$_[0]->{conf}->{timeout};
|
$_[0]->{conf}->{timeout};
|
||||||
}
|
}
|
||||||
|
@ -17,6 +18,7 @@ has timeout => (
|
||||||
|
|
||||||
has cache => (
|
has cache => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
|
lazy => 1,
|
||||||
default => sub {
|
default => sub {
|
||||||
my $c = $_[0]->{conf};
|
my $c = $_[0]->{conf};
|
||||||
if ( !$c->{tokenUseGlobalStorage} ) {
|
if ( !$c->{tokenUseGlobalStorage} ) {
|
||||||
|
|
|
@ -10,6 +10,7 @@ has module =>
|
||||||
|
|
||||||
has moduleOpts => (
|
has moduleOpts => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
|
lazy => 1,
|
||||||
default => sub {
|
default => sub {
|
||||||
my %opts = %{ $_[0]->{conf}->{globalStorageOptions} || {} };
|
my %opts = %{ $_[0]->{conf}->{globalStorageOptions} || {} };
|
||||||
$opts{backend} = $_[0]->{conf}->{globalStorage};
|
$opts{backend} = $_[0]->{conf}->{globalStorage};
|
||||||
|
|
|
@ -9,6 +9,7 @@ our $VERSION = '2.0.0';
|
||||||
|
|
||||||
has ua => (
|
has ua => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
|
lazy => 1,
|
||||||
default => sub {
|
default => sub {
|
||||||
return Lemonldap::NG::Common::UserAgent->new( $_[0]->{conf} );
|
return Lemonldap::NG::Common::UserAgent->new( $_[0]->{conf} );
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,10 +29,12 @@ has random => (
|
||||||
);
|
);
|
||||||
has charset => (
|
has charset => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
|
lazy => 1,
|
||||||
default => sub { return $_[0]->{conf}->{mailCharset} || 'utf-8' }
|
default => sub { return $_[0]->{conf}->{mailCharset} || 'utf-8' }
|
||||||
);
|
);
|
||||||
has transport => (
|
has transport => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
|
lazy => 1,
|
||||||
default => sub {
|
default => sub {
|
||||||
return $transport if $transport;
|
return $transport if $transport;
|
||||||
my $conf = $_[0]->{conf};
|
my $conf = $_[0]->{conf};
|
||||||
|
|
|
@ -150,7 +150,10 @@ sub display {
|
||||||
}
|
}
|
||||||
|
|
||||||
# 2.3 Case : user authenticated but an error was returned (bas url,...)
|
# 2.3 Case : user authenticated but an error was returned (bas url,...)
|
||||||
elsif ( not $req->datas->{noerror} and $req->userData and %{ $req->userData } ) {
|
elsif ( not $req->datas->{noerror}
|
||||||
|
and $req->userData
|
||||||
|
and %{ $req->userData } )
|
||||||
|
{
|
||||||
$skinfile = 'error';
|
$skinfile = 'error';
|
||||||
%templateParams = (
|
%templateParams = (
|
||||||
AUTH_ERROR => $req->error,
|
AUTH_ERROR => $req->error,
|
||||||
|
|
|
@ -28,6 +28,7 @@ has path => ( is => 'rw' );
|
||||||
|
|
||||||
has _ott => (
|
has _ott => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
|
lazy => 1,
|
||||||
default => sub {
|
default => sub {
|
||||||
my $ott = $_[0]->{p}->loadModule('::Lib::OneTimeToken');
|
my $ott = $_[0]->{p}->loadModule('::Lib::OneTimeToken');
|
||||||
$ott->timeout( $_[0]->{conf}->{formTimeout} );
|
$ott->timeout( $_[0]->{conf}->{formTimeout} );
|
||||||
|
|
|
@ -15,6 +15,7 @@ extends 'Lemonldap::NG::Common::Module';
|
||||||
|
|
||||||
has menuModules => (
|
has menuModules => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
|
lazy => 1,
|
||||||
builder => sub {
|
builder => sub {
|
||||||
my $conf = $_[0]->{conf}->{menuModule};
|
my $conf = $_[0]->{conf}->{menuModule};
|
||||||
my @res;
|
my @res;
|
||||||
|
@ -31,6 +32,7 @@ has menuModules => (
|
||||||
|
|
||||||
has imgPath => (
|
has imgPath => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
|
lazy => 1,
|
||||||
builder => sub {
|
builder => sub {
|
||||||
return $_[0]->{conf}->{impgPath}
|
return $_[0]->{conf}->{impgPath}
|
||||||
|| $_[0]->{conf}->{staticPrefix} . '/logos';
|
|| $_[0]->{conf}->{staticPrefix} . '/logos';
|
||||||
|
|
|
@ -74,10 +74,12 @@ sub controlUrl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$req->{datas}->{_url} ||= '';
|
$req->{datas}->{_url} ||= '';
|
||||||
my ($url, $issuerUrl);
|
my ( $url, $issuerUrl );
|
||||||
if ( ($url = $req->param('url')) or ($issuerUrl = $req->param('issuerUrldc')) ) {
|
if ( ( $url = $req->param('url') )
|
||||||
|
or ( $issuerUrl = $req->param('issuerUrldc') ) )
|
||||||
|
{
|
||||||
|
|
||||||
if($issuerUrl) {
|
if ($issuerUrl) {
|
||||||
$req->urlNotBase64(1);
|
$req->urlNotBase64(1);
|
||||||
$url = $issuerUrl;
|
$url = $issuerUrl;
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ sub _run {
|
||||||
$req->id(0);
|
$req->id(0);
|
||||||
$self->p->rebuildCookies($req);
|
$self->p->rebuildCookies($req);
|
||||||
my $res = $self->run( $req, $token );
|
my $res = $self->run( $req, $token );
|
||||||
delete $req->{authResult} if($res);
|
delete $req->{authResult} if ($res);
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ sub verify {
|
||||||
. $session->{ $self->conf->{whatToTrace} } );
|
. $session->{ $self->conf->{whatToTrace} } );
|
||||||
return PE_BADCREDENTIALS;
|
return PE_BADCREDENTIALS;
|
||||||
}
|
}
|
||||||
PE_OK
|
PE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
# system() is used with an array to avoid shell injection
|
# system() is used with an array to avoid shell injection
|
||||||
|
|
|
@ -38,6 +38,7 @@ extends 'Lemonldap::NG::Portal::Main::Plugin',
|
||||||
# Form timout token generator (used even if requireToken is not set)
|
# Form timout token generator (used even if requireToken is not set)
|
||||||
has ott => (
|
has ott => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
|
lazy => 1,
|
||||||
default => sub {
|
default => sub {
|
||||||
my $ott =
|
my $ott =
|
||||||
$_[0]->{p}->loadModule('Lemonldap::NG::Portal::Lib::OneTimeToken');
|
$_[0]->{p}->loadModule('Lemonldap::NG::Portal::Lib::OneTimeToken');
|
||||||
|
|
|
@ -51,6 +51,7 @@ extends 'Lemonldap::NG::Portal::Main::Plugin';
|
||||||
|
|
||||||
has configStorage => (
|
has configStorage => (
|
||||||
is => 'ro',
|
is => 'ro',
|
||||||
|
lazy => 1,
|
||||||
default => sub {
|
default => sub {
|
||||||
$_[0]->{p}->HANDLER->localConfig->{configStorage};
|
$_[0]->{p}->HANDLER->localConfig->{configStorage};
|
||||||
}
|
}
|
||||||
|
@ -58,6 +59,7 @@ has configStorage => (
|
||||||
|
|
||||||
has exportedAttr => (
|
has exportedAttr => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
|
lazy => 1,
|
||||||
default => sub {
|
default => sub {
|
||||||
my $conf = $_[0]->{conf};
|
my $conf = $_[0]->{conf};
|
||||||
if ( $conf->{exportedAttr} and $conf->{exportedAttr} !~ /^\s*\+/ ) {
|
if ( $conf->{exportedAttr} and $conf->{exportedAttr} !~ /^\s*\+/ ) {
|
||||||
|
|
|
@ -35,6 +35,7 @@ has registerModule => ( is => 'rw' );
|
||||||
# Register url to set in the mail
|
# Register url to set in the mail
|
||||||
has registerUrl => (
|
has registerUrl => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
|
lazy => 1,
|
||||||
default => sub {
|
default => sub {
|
||||||
my $p = $_[0]->conf->{portal};
|
my $p = $_[0]->conf->{portal};
|
||||||
$p =~ s#/*$##;
|
$p =~ s#/*$##;
|
||||||
|
@ -45,6 +46,7 @@ has registerUrl => (
|
||||||
# Mail timeout token generator
|
# Mail timeout token generator
|
||||||
has mailott => (
|
has mailott => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
|
lazy => 1,
|
||||||
default => sub {
|
default => sub {
|
||||||
my $ott =
|
my $ott =
|
||||||
$_[0]->{p}->loadModule('Lemonldap::NG::Portal::Lib::OneTimeToken');
|
$_[0]->{p}->loadModule('Lemonldap::NG::Portal::Lib::OneTimeToken');
|
||||||
|
|
|
@ -24,6 +24,7 @@ has server => ( is => 'rw' );
|
||||||
|
|
||||||
has configStorage => (
|
has configStorage => (
|
||||||
is => 'ro',
|
is => 'ro',
|
||||||
|
lazy => 1,
|
||||||
default => sub {
|
default => sub {
|
||||||
$_[0]->{p}->HANDLER->localConfig->{configStorage};
|
$_[0]->{p}->HANDLER->localConfig->{configStorage};
|
||||||
}
|
}
|
||||||
|
@ -31,6 +32,7 @@ has configStorage => (
|
||||||
|
|
||||||
has exportedAttr => (
|
has exportedAttr => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
|
lazy => 1,
|
||||||
default => sub {
|
default => sub {
|
||||||
my $conf = $_[0]->{conf};
|
my $conf = $_[0]->{conf};
|
||||||
if ( $conf->{exportedAttr} and $conf->{exportedAttr} !~ /^\s*\+/ ) {
|
if ( $conf->{exportedAttr} and $conf->{exportedAttr} !~ /^\s*\+/ ) {
|
||||||
|
|
|
@ -26,6 +26,7 @@ use constant beforeLogout => 'logout';
|
||||||
|
|
||||||
has ott => (
|
has ott => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
|
lazy => 1,
|
||||||
default => sub {
|
default => sub {
|
||||||
my $ott =
|
my $ott =
|
||||||
$_[0]->{p}->loadModule('Lemonldap::NG::Portal::Lib::OneTimeToken');
|
$_[0]->{p}->loadModule('Lemonldap::NG::Portal::Lib::OneTimeToken');
|
||||||
|
@ -37,6 +38,7 @@ has ott => (
|
||||||
# Default timeout: 1 month
|
# Default timeout: 1 month
|
||||||
has timeout => (
|
has timeout => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
|
lazy => 1,
|
||||||
default => sub {
|
default => sub {
|
||||||
$_[0]->{conf}->{stayConnectedTimeout} || 2678400;
|
$_[0]->{conf}->{stayConnectedTimeout} || 2678400;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ extends 'Lemonldap::NG::Portal::Main::Plugin';
|
||||||
|
|
||||||
has ott => (
|
has ott => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
|
lazy => 1,
|
||||||
default => sub {
|
default => sub {
|
||||||
my $ott =
|
my $ott =
|
||||||
$_[0]->{p}->loadModule('Lemonldap::NG::Portal::Lib::OneTimeToken');
|
$_[0]->{p}->loadModule('Lemonldap::NG::Portal::Lib::OneTimeToken');
|
||||||
|
@ -66,9 +67,9 @@ sub confirm {
|
||||||
return $self->p->do( $req, [ sub { PE_TOKENEXPIRED } ] );
|
return $self->p->do( $req, [ sub { PE_TOKENEXPIRED } ] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$req->steps(['controlUrl']);
|
$req->steps( ['controlUrl'] );
|
||||||
my $res = $self->p->process($req);
|
my $res = $self->p->process($req);
|
||||||
return $self->p->do( $req, [ sub { $res } ] ) if($res);
|
return $self->p->do( $req, [ sub { $res } ] ) if ($res);
|
||||||
if ( $upg or $req->param('confirm') == 1 ) {
|
if ( $upg or $req->param('confirm') == 1 ) {
|
||||||
$req->datas->{noerror} = 1;
|
$req->datas->{noerror} = 1;
|
||||||
$self->p->setHiddenFormValue(
|
$self->p->setHiddenFormValue(
|
||||||
|
|
|
@ -12,6 +12,7 @@ our $VERSION = '2.0.0';
|
||||||
|
|
||||||
has table => (
|
has table => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
|
lazy => 1,
|
||||||
builder => sub {
|
builder => sub {
|
||||||
my $conf = $_[0]->{conf};
|
my $conf = $_[0]->{conf};
|
||||||
return $conf->{dbiUserTable} || $conf->{dbiAuthTable};
|
return $conf->{dbiUserTable} || $conf->{dbiAuthTable};
|
||||||
|
@ -20,6 +21,7 @@ has table => (
|
||||||
|
|
||||||
has pivot => (
|
has pivot => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
|
lazy => 1,
|
||||||
builder => sub {
|
builder => sub {
|
||||||
my $conf = $_[0]->{conf};
|
my $conf = $_[0]->{conf};
|
||||||
return $conf->{userPivot} || $conf->{dbiAuthLoginCol};
|
return $conf->{userPivot} || $conf->{dbiAuthLoginCol};
|
||||||
|
@ -28,6 +30,7 @@ has pivot => (
|
||||||
|
|
||||||
has exportedVars => (
|
has exportedVars => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
|
lazy => 1,
|
||||||
builder => sub {
|
builder => sub {
|
||||||
my $conf = $_[0]->{conf};
|
my $conf = $_[0]->{conf};
|
||||||
return { %{ $conf->{exportedVars} }, %{ $conf->{dbiExportedVars} } };
|
return { %{ $conf->{exportedVars} }, %{ $conf->{dbiExportedVars} } };
|
||||||
|
|
|
@ -10,6 +10,7 @@ our $VERSION = '2.0.0';
|
||||||
|
|
||||||
has vars => (
|
has vars => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
|
lazy => 1,
|
||||||
builder => sub {
|
builder => sub {
|
||||||
return {
|
return {
|
||||||
%{ $_[0]->conf->{exportedVars} },
|
%{ $_[0]->conf->{exportedVars} },
|
||||||
|
|
|
@ -11,6 +11,7 @@ our $VERSION = '2.0.0';
|
||||||
|
|
||||||
has ldapGroupAttributeNameSearch => (
|
has ldapGroupAttributeNameSearch => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
|
lazy => 1,
|
||||||
builder => sub {
|
builder => sub {
|
||||||
return $_[0]->{conf}->{ldapGroupAttributeNameSearch}
|
return $_[0]->{conf}->{ldapGroupAttributeNameSearch}
|
||||||
? [
|
? [
|
||||||
|
@ -30,6 +31,7 @@ has ldapGroupAttributeNameSearch => (
|
||||||
|
|
||||||
has attrs => (
|
has attrs => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
|
lazy => 1,
|
||||||
builder => sub {
|
builder => sub {
|
||||||
return [
|
return [
|
||||||
values %{ $_[0]->{conf}->{exportedVars} },
|
values %{ $_[0]->{conf}->{exportedVars} },
|
||||||
|
|
|
@ -317,7 +317,8 @@ ywIDAQAB
|
||||||
",
|
",
|
||||||
samlSPMetaDataXML => {
|
samlSPMetaDataXML => {
|
||||||
"sp.com" => {
|
"sp.com" => {
|
||||||
samlSPMetaDataXML => samlSPMetaDataXML('sp','HTTP-POST')
|
samlSPMetaDataXML =>
|
||||||
|
samlSPMetaDataXML( 'sp', 'HTTP-POST' )
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -364,7 +365,8 @@ sub sp {
|
||||||
},
|
},
|
||||||
samlIDPMetaDataXML => {
|
samlIDPMetaDataXML => {
|
||||||
idp => {
|
idp => {
|
||||||
samlIDPMetaDataXML => samlIDPMetaDataXML('idp','HTTP-POST')
|
samlIDPMetaDataXML =>
|
||||||
|
samlIDPMetaDataXML( 'idp', 'HTTP-POST' )
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
samlOrganizationDisplayName => "SP",
|
samlOrganizationDisplayName => "SP",
|
||||||
|
|
|
@ -334,7 +334,8 @@ ywIDAQAB
|
||||||
",
|
",
|
||||||
samlSPMetaDataXML => {
|
samlSPMetaDataXML => {
|
||||||
"sp.com" => {
|
"sp.com" => {
|
||||||
samlSPMetaDataXML => samlSPMetaDataXML('sp','HTTP-POST')
|
samlSPMetaDataXML =>
|
||||||
|
samlSPMetaDataXML( 'sp', 'HTTP-POST' )
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -380,7 +381,8 @@ sub sp {
|
||||||
},
|
},
|
||||||
samlIDPMetaDataXML => {
|
samlIDPMetaDataXML => {
|
||||||
idp => {
|
idp => {
|
||||||
samlIDPMetaDataXML => samlIDPMetaDataXML('idp','HTTP-POST')
|
samlIDPMetaDataXML =>
|
||||||
|
samlIDPMetaDataXML( 'idp', 'HTTP-POST' )
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
samlOrganizationDisplayName => "SP",
|
samlOrganizationDisplayName => "SP",
|
||||||
|
|
|
@ -297,7 +297,8 @@ ywIDAQAB
|
||||||
",
|
",
|
||||||
samlSPMetaDataXML => {
|
samlSPMetaDataXML => {
|
||||||
"sp.com" => {
|
"sp.com" => {
|
||||||
samlSPMetaDataXML => samlSPMetaDataXML('sp','HTTP-Redirect')
|
samlSPMetaDataXML =>
|
||||||
|
samlSPMetaDataXML( 'sp', 'HTTP-Redirect' )
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -344,7 +345,8 @@ sub sp {
|
||||||
},
|
},
|
||||||
samlIDPMetaDataXML => {
|
samlIDPMetaDataXML => {
|
||||||
idp => {
|
idp => {
|
||||||
samlIDPMetaDataXML => samlIDPMetaDataXML('idp','HTTP-Redirect')
|
samlIDPMetaDataXML =>
|
||||||
|
samlIDPMetaDataXML( 'idp', 'HTTP-Redirect' )
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
samlOrganizationDisplayName => "SP",
|
samlOrganizationDisplayName => "SP",
|
||||||
|
|
|
@ -108,7 +108,7 @@ SKIP: {
|
||||||
);
|
);
|
||||||
expectOK($res);
|
expectOK($res);
|
||||||
my $idpId = expectCookie($res);
|
my $idpId = expectCookie($res);
|
||||||
ok($res->[2]->[0] =~ /trmsg="84"/, 'Reject reason is 84');
|
ok( $res->[2]->[0] =~ /trmsg="84"/, 'Reject reason is 84' );
|
||||||
}
|
}
|
||||||
|
|
||||||
count($maintests);
|
count($maintests);
|
||||||
|
|
|
@ -72,6 +72,7 @@ ok(
|
||||||
count(1);
|
count(1);
|
||||||
|
|
||||||
($query) = expectRedirection( $res, qr#^http://auth.rp.com/?\?(.*)$# );
|
($query) = expectRedirection( $res, qr#^http://auth.rp.com/?\?(.*)$# );
|
||||||
|
|
||||||
# Push OP response to RP
|
# Push OP response to RP
|
||||||
switch ('rp');
|
switch ('rp');
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ ok(
|
||||||
);
|
);
|
||||||
count(1);
|
count(1);
|
||||||
my $idpId = expectCookie($res);
|
my $idpId = expectCookie($res);
|
||||||
ok($res->[2]->[0] =~ /trmsg="84"/, 'Reject reason is 84');
|
ok( $res->[2]->[0] =~ /trmsg="84"/, 'Reject reason is 84' );
|
||||||
count(1);
|
count(1);
|
||||||
|
|
||||||
#print STDERR Dumper($res);
|
#print STDERR Dumper($res);
|
||||||
|
|
|
@ -50,7 +50,9 @@ ok(
|
||||||
count(1);
|
count(1);
|
||||||
expectOK($res);
|
expectOK($res);
|
||||||
|
|
||||||
ok( mail() =~ m#a href="http://auth.example.com/register\?(.*?)"#, 'Found register token') or print STDERR Dumper($main::mail);
|
ok( mail() =~ m#a href="http://auth.example.com/register\?(.*?)"#,
|
||||||
|
'Found register token' )
|
||||||
|
or print STDERR Dumper($main::mail);
|
||||||
$query = $1;
|
$query = $1;
|
||||||
ok( $query =~ /register_token=/, 'Found register_token' );
|
ok( $query =~ /register_token=/, 'Found register_token' );
|
||||||
count(2);
|
count(2);
|
||||||
|
@ -62,7 +64,11 @@ ok(
|
||||||
expectOK($res);
|
expectOK($res);
|
||||||
count(1);
|
count(1);
|
||||||
|
|
||||||
ok( mail() =~ m#Your login is.+?<b>(\w+)</b>.*?Your password is.+?<b>(.*?)</b>#s, 'Found user and password');
|
ok(
|
||||||
|
mail() =~
|
||||||
|
m#Your login is.+?<b>(\w+)</b>.*?Your password is.+?<b>(.*?)</b>#s,
|
||||||
|
'Found user and password'
|
||||||
|
);
|
||||||
$user = $1;
|
$user = $1;
|
||||||
$pwd = $2;
|
$pwd = $2;
|
||||||
ok( $user eq 'fbar', 'Get good login' );
|
ok( $user eq 'fbar', 'Get good login' );
|
||||||
|
|
Loading…
Reference in New Issue
Block a user