Don't load Data::Dumper unless debug
This commit is contained in:
parent
3cc4362873
commit
323d92fa1b
|
@ -348,16 +348,18 @@ sub sessionStorageInit {
|
||||||
if ( $conf->{status} ) {
|
if ( $conf->{status} ) {
|
||||||
my $params = "";
|
my $params = "";
|
||||||
if ( $class->tsv->{sessionCacheModule} ) {
|
if ( $class->tsv->{sessionCacheModule} ) {
|
||||||
require Data::Dumper;
|
$params = ' ' . join(
|
||||||
$params = ' '
|
',',
|
||||||
. $class->tsv->{sessionCacheModule} . ','
|
$class->tsv->{sessionCacheModule} . map {
|
||||||
. Data::Dumper->new( [ $class->tsv->{sessionCacheOptions} ] )
|
"$_ => "
|
||||||
->Terse(1)->Indent(0)->Dump; # To send params on one line
|
. $class->tsv->{sessionCacheOptions}->{$_}
|
||||||
|
} keys %{ $class->tsv->{sessionCacheOptions} // {} }
|
||||||
|
);
|
||||||
}
|
}
|
||||||
$class->tsv->{statusPipe}->print("RELOADCACHE $params\n");
|
$class->tsv->{statusPipe}->print("RELOADCACHE $params\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
## @imethod void headersInit(hashRef args)
|
## @imethod void headersInit(hashRef args)
|
||||||
|
|
|
@ -147,7 +147,9 @@ sub run {
|
||||||
|
|
||||||
# ACCOUNTING (1. Inform web server)
|
# ACCOUNTING (1. Inform web server)
|
||||||
$class->set_user( $req, $session->{ $class->tsv->{whatToTrace} } );
|
$class->set_user( $req, $session->{ $class->tsv->{whatToTrace} } );
|
||||||
$class->set_custom( $req, $session->{ $class->tsv->{customToTrace} } );
|
$class->set_custom( $req, $session->{ $class->tsv->{customToTrace} } )
|
||||||
|
if $class->tsv->{customToTrace}
|
||||||
|
and $session->{ $class->tsv->{customToTrace} };
|
||||||
|
|
||||||
# AUTHORIZATION
|
# AUTHORIZATION
|
||||||
return ( $class->forbidden( $req, $session ), $session )
|
return ( $class->forbidden( $req, $session ), $session )
|
||||||
|
@ -409,7 +411,7 @@ sub fetchId {
|
||||||
my $value =
|
my $value =
|
||||||
$lookForHttpCookie
|
$lookForHttpCookie
|
||||||
? ( $t =~ /${cn}http=([^,; ]+)/o ? $1 : 0 )
|
? ( $t =~ /${cn}http=([^,; ]+)/o ? $1 : 0 )
|
||||||
: ( $t =~ /$cn=([^,; ]+)/o ? $1 : 0 );
|
: ( $t =~ /$cn=([^,; ]+)/o ? $1 : 0 );
|
||||||
|
|
||||||
if ( $value && $lookForHttpCookie && $class->tsv->{securedCookie} == 3 ) {
|
if ( $value && $lookForHttpCookie && $class->tsv->{securedCookie} == 3 ) {
|
||||||
$value = $class->tsv->{cipher}->decryptHex( $value, "http" );
|
$value = $class->tsv->{cipher}->decryptHex( $value, "http" );
|
||||||
|
|
|
@ -332,6 +332,7 @@ site/htdocs/static/common/modules/Kerberos.png
|
||||||
site/htdocs/static/common/modules/LinkedIn.png
|
site/htdocs/static/common/modules/LinkedIn.png
|
||||||
site/htdocs/static/common/modules/OpenIDConnect.png
|
site/htdocs/static/common/modules/OpenIDConnect.png
|
||||||
site/htdocs/static/common/modules/SAML.png
|
site/htdocs/static/common/modules/SAML.png
|
||||||
|
site/htdocs/static/common/modules/Slave.png
|
||||||
site/htdocs/static/common/modules/SSL.png
|
site/htdocs/static/common/modules/SSL.png
|
||||||
site/htdocs/static/common/modules/Twitter.png
|
site/htdocs/static/common/modules/Twitter.png
|
||||||
site/htdocs/static/common/modules/WebID.png
|
site/htdocs/static/common/modules/WebID.png
|
||||||
|
@ -496,7 +497,7 @@ t/32-Auth-and-issuer-OIDC-implicit.t
|
||||||
t/32-Auth-and-issuer-OIDC-sorted.t
|
t/32-Auth-and-issuer-OIDC-sorted.t
|
||||||
t/32-CAS-10.t
|
t/32-CAS-10.t
|
||||||
t/32-OIDC-RP-rule.t
|
t/32-OIDC-RP-rule.t
|
||||||
t/32-OIDC-Token-Spoof.t
|
t/32-OIDC-Token-Security.t
|
||||||
t/33-Auth-and-issuer-OpenID2.t
|
t/33-Auth-and-issuer-OpenID2.t
|
||||||
t/34-Auth-Proxy-and-REST-Server.t
|
t/34-Auth-Proxy-and-REST-Server.t
|
||||||
t/34-Auth-Proxy-and-SOAP-Server.t
|
t/34-Auth-Proxy-and-SOAP-Server.t
|
||||||
|
@ -567,7 +568,7 @@ t/66-CDA-with-REST.t
|
||||||
t/66-CDA-with-SOAP.t
|
t/66-CDA-with-SOAP.t
|
||||||
t/66-CDA.t
|
t/66-CDA.t
|
||||||
t/67-CheckUser-with-Global-token.t
|
t/67-CheckUser-with-Global-token.t
|
||||||
t/67-Checkuser-with-Impersonation-and-whatToTrace.t
|
t/67-CheckUser-with-Impersonation-and-whatToTrace.t
|
||||||
t/67-CheckUser-with-issuer-SAML-POST.t
|
t/67-CheckUser-with-issuer-SAML-POST.t
|
||||||
t/67-CheckUser-with-token.t
|
t/67-CheckUser-with-token.t
|
||||||
t/67-CheckUser.t
|
t/67-CheckUser.t
|
||||||
|
@ -604,6 +605,7 @@ t/77-2F-Mail-with-global-storage.t
|
||||||
t/77-2F-Mail.t
|
t/77-2F-Mail.t
|
||||||
t/78-2F-Upgrade.t
|
t/78-2F-Upgrade.t
|
||||||
t/90-Translations.t
|
t/90-Translations.t
|
||||||
|
t/99-Dont-load-Dumper.t
|
||||||
t/99-pod.t
|
t/99-pod.t
|
||||||
t/gpghome/key.asc
|
t/gpghome/key.asc
|
||||||
t/gpghome/openpgp-revocs.d/9482CEFB055809CBAFE6D71AAB2D5542891D1677.rev
|
t/gpghome/openpgp-revocs.d/9482CEFB055809CBAFE6D71AAB2D5542891D1677.rev
|
||||||
|
|
|
@ -3,7 +3,6 @@ package Lemonldap::NG::Portal::Lib::Notifications::JSON;
|
||||||
use strict;
|
use strict;
|
||||||
use Mouse;
|
use Mouse;
|
||||||
use JSON qw(from_json);
|
use JSON qw(from_json);
|
||||||
use Data::Dumper;
|
|
||||||
|
|
||||||
our $VERSION = '2.0.6';
|
our $VERSION = '2.0.6';
|
||||||
|
|
||||||
|
@ -260,7 +259,8 @@ sub notificationServer {
|
||||||
return $self->p->sendError( $req, "Unable to decode JSON file: $@",
|
return $self->p->sendError( $req, "Unable to decode JSON file: $@",
|
||||||
400 )
|
400 )
|
||||||
if ($@);
|
if ($@);
|
||||||
$self->p->logger->debug( "Notification $notif: " . Dumper($json) );
|
$self->p->logger->debug(
|
||||||
|
"Notification $notif: " . $notifs->{$notif} );
|
||||||
if ($ref) {
|
if ($ref) {
|
||||||
push( @$res,
|
push( @$res,
|
||||||
map { "$_" => $json->{$_} },
|
map { "$_" => $json->{$_} },
|
||||||
|
|
|
@ -8,7 +8,6 @@ package Lemonldap::NG::Portal::Main;
|
||||||
use strict;
|
use strict;
|
||||||
use Mouse;
|
use Mouse;
|
||||||
use JSON;
|
use JSON;
|
||||||
use Data::Dumper;
|
|
||||||
|
|
||||||
has skinRules => ( is => 'rw' );
|
has skinRules => ( is => 'rw' );
|
||||||
|
|
||||||
|
@ -126,8 +125,9 @@ sub display {
|
||||||
# 1.3 There is a message to display
|
# 1.3 There is a message to display
|
||||||
elsif ( my $info = $req->info ) {
|
elsif ( my $info = $req->info ) {
|
||||||
$self->logger->debug('Display: info detected');
|
$self->logger->debug('Display: info detected');
|
||||||
$self->logger->debug(
|
$self->logger->debug('Hidden values :');
|
||||||
'Hidden values -> ' . Dumper( $req->{portalHiddenFormValues} ) );
|
$self->logger->debug( " $_: " . $req->{portalHiddenFormValues}->{$_} )
|
||||||
|
for keys %{ $req->{portalHiddenFormValues} // {} };
|
||||||
$skinfile = 'info';
|
$skinfile = 'info';
|
||||||
%templateParams = (
|
%templateParams = (
|
||||||
MAIN_LOGO => $self->conf->{portalMainLogo},
|
MAIN_LOGO => $self->conf->{portalMainLogo},
|
||||||
|
|
|
@ -758,10 +758,12 @@ sub cookie {
|
||||||
|
|
||||||
sub _dump {
|
sub _dump {
|
||||||
my ( $self, $variable ) = @_;
|
my ( $self, $variable ) = @_;
|
||||||
require Data::Dumper;
|
if ( $self->conf->{logLevel} eq 'debug' ) {
|
||||||
$Data::Dumper::Indent = 0;
|
require Data::Dumper;
|
||||||
$Data::Dumper::Useperl = 1;
|
$Data::Dumper::Indent = 0;
|
||||||
$self->logger->debug( "Dump: " . Data::Dumper::Dumper($variable) );
|
$Data::Dumper::Useperl = 1;
|
||||||
|
$self->logger->debug( "Dump: " . Data::Dumper::Dumper($variable) );
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -813,11 +815,11 @@ sub sendHtml {
|
||||||
'Pragma' => 'no-cache', # HTTP 1.0
|
'Pragma' => 'no-cache', # HTTP 1.0
|
||||||
'Expires' => '0'; # Proxies
|
'Expires' => '0'; # Proxies
|
||||||
|
|
||||||
my @cors = split /;/, $self->cors;
|
|
||||||
if ( $self->conf->{corsEnabled} ) {
|
if ( $self->conf->{corsEnabled} ) {
|
||||||
|
my @cors = split /;/, $self->cors;
|
||||||
push @{ $res->[1] }, @cors;
|
push @{ $res->[1] }, @cors;
|
||||||
$self->logger->debug(
|
$self->logger->debug('Apply following CORS policy :');
|
||||||
"Apply following CORS policy : " . Data::Dumper::Dumper( \@cors ) );
|
$self->logger->debug(" $_") for @cors;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set authorized URL for POST
|
# Set authorized URL for POST
|
||||||
|
@ -1002,7 +1004,7 @@ sub registerLogin {
|
||||||
}
|
}
|
||||||
|
|
||||||
my $history = $req->sessionInfo->{_loginHistory} ||= {};
|
my $history = $req->sessionInfo->{_loginHistory} ||= {};
|
||||||
my $type = ( $req->authResult > 0 ? 'failed' : 'success' ) . 'Login';
|
my $type = ( $req->authResult > 0 ? 'failed' : 'success' ) . 'Login';
|
||||||
$history->{$type} ||= [];
|
$history->{$type} ||= [];
|
||||||
$self->logger->debug("Current login saved into $type");
|
$self->logger->debug("Current login saved into $type");
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ sub hAttr {
|
||||||
sub init {
|
sub init {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
my $hd = $self->p->HANDLER;
|
my $hd = $self->p->HANDLER;
|
||||||
$self->addAuthRoute( checkuser => 'check', ['POST'] );
|
$self->addAuthRoute( checkuser => 'check', ['POST'] );
|
||||||
$self->addAuthRouteWithRedirect( checkuser => 'display', ['GET'] );
|
$self->addAuthRouteWithRedirect( checkuser => 'display', ['GET'] );
|
||||||
|
|
||||||
# Parse identity rule
|
# Parse identity rule
|
||||||
|
@ -175,7 +175,7 @@ sub check {
|
||||||
? 'checkUserMerged'
|
? 'checkUserMerged'
|
||||||
: 'checkUser';
|
: 'checkUser';
|
||||||
if ($compute) {
|
if ($compute) {
|
||||||
$msg = 'checkUserComputeSession';
|
$msg = 'checkUserComputeSession';
|
||||||
$attrs->{authenticationLevel} = $authLevel;
|
$attrs->{authenticationLevel} = $authLevel;
|
||||||
$attrs->{_auth} = $authMode;
|
$attrs->{_auth} = $authMode;
|
||||||
|
|
||||||
|
@ -272,7 +272,7 @@ sub check {
|
||||||
}
|
}
|
||||||
|
|
||||||
sub display {
|
sub display {
|
||||||
my ( $self, $req ) = @_;
|
my ( $self, $req ) = @_;
|
||||||
my ( $attrs, $array_attrs ) = ( {}, [] );
|
my ( $attrs, $array_attrs ) = ( {}, [] );
|
||||||
|
|
||||||
$self->logger->debug("Display current session data...");
|
$self->logger->debug("Display current session data...");
|
||||||
|
@ -422,8 +422,8 @@ sub _splitAttributes {
|
||||||
$self->logger->debug("Dispatching attributes...");
|
$self->logger->debug("Dispatching attributes...");
|
||||||
while (@$attrs) {
|
while (@$attrs) {
|
||||||
my $element = shift @$attrs;
|
my $element = shift @$attrs;
|
||||||
$self->logger->debug(
|
$self->logger->debug( "Processing element: $element->{key} => "
|
||||||
'Processing element: ' . Data::Dumper::Dumper($element) );
|
. ( $element->{value} // '' ) );
|
||||||
my $ok = 0;
|
my $ok = 0;
|
||||||
if ( $element->{key} eq 'groups' ) {
|
if ( $element->{key} eq 'groups' ) {
|
||||||
$self->logger->debug('Key "groups" found');
|
$self->logger->debug('Key "groups" found');
|
||||||
|
@ -452,14 +452,15 @@ sub _splitAttributes {
|
||||||
my $prefix = "$self->{conf}->{impersonationPrefix}";
|
my $prefix = "$self->{conf}->{impersonationPrefix}";
|
||||||
while (@$others) {
|
while (@$others) {
|
||||||
my $element = shift @$others;
|
my $element = shift @$others;
|
||||||
$self->logger->debug(
|
$self->logger->debug( "Processing attribute $element->{key} => "
|
||||||
'Processing attribute: ' . Data::Dumper::Dumper($element) );
|
. ( $element->{value} // '' ) );
|
||||||
if ( $element->{key} =~ /^$prefix.+$/ ) {
|
if ( $element->{key} =~ /^$prefix.+$/ ) {
|
||||||
push @$realAttrs, $element;
|
push @$realAttrs, $element;
|
||||||
$self->logger->debug(' -> Real attribute');
|
$self->logger->debug(' -> Real attribute');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
push @$spoofedAttrs, $element;
|
push @$spoofedAttrs, $element;
|
||||||
|
|
||||||
#$self->logger->debug(' -> Spoofed attribute');
|
#$self->logger->debug(' -> Spoofed attribute');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,7 +166,6 @@ SKIP: {
|
||||||
expectAuthenticatedAs( $res, 'davros@badguy.org@idp' );
|
expectAuthenticatedAs( $res, 'davros@badguy.org@idp' );
|
||||||
|
|
||||||
# Simple SP access
|
# Simple SP access
|
||||||
my $res;
|
|
||||||
ok(
|
ok(
|
||||||
$res = $sp->_get(
|
$res = $sp->_get(
|
||||||
'/', accept => 'text/html',
|
'/', accept => 'text/html',
|
||||||
|
@ -179,7 +178,7 @@ SKIP: {
|
||||||
$res->[1],
|
$res->[1],
|
||||||
'Set-Cookie => lemonldapidp=http://auth.idp.com/saml/metadata; domain=.sp.com; path=/'
|
'Set-Cookie => lemonldapidp=http://auth.idp.com/saml/metadata; domain=.sp.com; path=/'
|
||||||
);
|
);
|
||||||
my ( $host, $url, $s ) =
|
( $host, $url, $s ) =
|
||||||
expectAutoPost( $res, 'auth.idp.com', '/saml/singleSignOn',
|
expectAutoPost( $res, 'auth.idp.com', '/saml/singleSignOn',
|
||||||
'SAMLRequest' );
|
'SAMLRequest' );
|
||||||
|
|
||||||
|
@ -195,7 +194,7 @@ SKIP: {
|
||||||
'Post SAML request to IdP'
|
'Post SAML request to IdP'
|
||||||
);
|
);
|
||||||
expectOK($res);
|
expectOK($res);
|
||||||
my $pdata = 'lemonldappdata=' . expectCookie( $res, 'lemonldappdata' );
|
$pdata = 'lemonldappdata=' . expectCookie( $res, 'lemonldappdata' );
|
||||||
|
|
||||||
# Try to authenticate with an authorized user to IdP
|
# Try to authenticate with an authorized user to IdP
|
||||||
$s = "user=french&password=french&$s";
|
$s = "user=french&password=french&$s";
|
||||||
|
@ -254,7 +253,8 @@ SKIP: {
|
||||||
),
|
),
|
||||||
'CheckUser form',
|
'CheckUser form',
|
||||||
);
|
);
|
||||||
my ( $host, $url, $query ) =
|
my $query;
|
||||||
|
( $host, $url, $query ) =
|
||||||
expectForm( $res, undef, '/checkuser', 'user', 'url' );
|
expectForm( $res, undef, '/checkuser', 'user', 'url' );
|
||||||
ok( $res->[2]->[0] =~ m%<span trspan="checkUser">%,
|
ok( $res->[2]->[0] =~ m%<span trspan="checkUser">%,
|
||||||
'Found trspan="checkUser"' )
|
'Found trspan="checkUser"' )
|
||||||
|
@ -263,10 +263,14 @@ SKIP: {
|
||||||
or explain( $res->[2]->[0], 'Attribute uid' );
|
or explain( $res->[2]->[0], 'Attribute uid' );
|
||||||
ok( $res->[2]->[0] =~ m%<td scope="row">french</td>%, 'Found value french' )
|
ok( $res->[2]->[0] =~ m%<td scope="row">french</td>%, 'Found value french' )
|
||||||
or explain( $res->[2]->[0], 'Value french' );
|
or explain( $res->[2]->[0], 'Value french' );
|
||||||
ok( $res->[2]->[0] =~ m%<td scope="row">_lassoSessionDump</td>%, 'Found attribute _lassoSessionDump' )
|
ok( $res->[2]->[0] =~ m%<td scope="row">_lassoSessionDump</td>%,
|
||||||
|
'Found attribute _lassoSessionDump' )
|
||||||
or explain( $res->[2]->[0], 'Attribute _lassoSessionDump' );
|
or explain( $res->[2]->[0], 'Attribute _lassoSessionDump' );
|
||||||
ok( $res->[2]->[0] =~ m%ProviderID="http://auth.idp.com/saml/metadata" AssertionID=%, 'Found ProviderID & AssertionID values' )
|
ok(
|
||||||
or explain( $res->[2]->[0], 'Provider & Assertion Ids' );
|
$res->[2]->[0] =~
|
||||||
|
m%ProviderID="http://auth.idp.com/saml/metadata" AssertionID=%,
|
||||||
|
'Found ProviderID & AssertionID values'
|
||||||
|
) or explain( $res->[2]->[0], 'Provider & Assertion Ids' );
|
||||||
count(6);
|
count(6);
|
||||||
|
|
||||||
# CheckUser request with an unknown user
|
# CheckUser request with an unknown user
|
||||||
|
@ -301,7 +305,7 @@ m%<div class="message message-positive alert"><span trspan="PE5"></span></div>%,
|
||||||
'POST checkuser'
|
'POST checkuser'
|
||||||
);
|
);
|
||||||
|
|
||||||
my ( $host, $url, $query ) =
|
( $host, $url, $query ) =
|
||||||
expectForm( $res, undef, '/checkuser', 'user', 'url' );
|
expectForm( $res, undef, '/checkuser', 'user', 'url' );
|
||||||
ok( $res->[2]->[0] =~ m%<span trspan="checkUser">%,
|
ok( $res->[2]->[0] =~ m%<span trspan="checkUser">%,
|
||||||
'Found trspan="checkUser"' )
|
'Found trspan="checkUser"' )
|
||||||
|
|
|
@ -197,7 +197,7 @@ ok(
|
||||||
);
|
);
|
||||||
count(3);
|
count(3);
|
||||||
|
|
||||||
my ( $host, $url, $query ) =
|
( $host, $url, $query ) =
|
||||||
expectForm( $res, undef, '/checkuser', 'user', 'url' );
|
expectForm( $res, undef, '/checkuser', 'user', 'url' );
|
||||||
ok( $res->[2]->[0] =~ m%<span trspan="checkUser">%, 'Found trspan="checkUser"' )
|
ok( $res->[2]->[0] =~ m%<span trspan="checkUser">%, 'Found trspan="checkUser"' )
|
||||||
or explain( $res->[2]->[0], 'trspan="checkUser"' );
|
or explain( $res->[2]->[0], 'trspan="checkUser"' );
|
||||||
|
|
6
lemonldap-ng-portal/t/99-Dont-load-Dumper.t
Normal file
6
lemonldap-ng-portal/t/99-Dont-load-Dumper.t
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
use Test::More tests => 2;
|
||||||
|
|
||||||
|
use_ok('Lemonldap::NG::Portal::Main');
|
||||||
|
|
||||||
|
eval { Data::Dumper::Dumper( {} ) };
|
||||||
|
ok( $@, "Portal don't depends on Data::Dumper" );
|
Loading…
Reference in New Issue
Block a user