diff --git a/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/Backends/RDBI.pm b/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/Backends/RDBI.pm index cf36c0029..64ea593ca 100644 --- a/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/Backends/RDBI.pm +++ b/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/Backends/RDBI.pm @@ -53,9 +53,8 @@ sub load { my ( $self, $cfgNum, $fields ) = @_; $fields = $fields ? join( ",", @$fields ) : '*'; my $sth = - $self->_dbh->prepare( "SELECT field,value from " - . $self->{dbiTable} - . " WHERE cfgNum=?" ); + $self->_dbh->prepare( + "SELECT field,value from " . $self->{dbiTable} . " WHERE cfgNum=?" ); $sth->execute($cfgNum); my ( $res, @row ); while ( @row = $sth->fetchrow_array ) { diff --git a/lemonldap-ng-common/lib/Lemonldap/NG/Common/Logger/Dispatch.pm b/lemonldap-ng-common/lib/Lemonldap/NG/Common/Logger/Dispatch.pm index 86feaa70d..6e74a701e 100644 --- a/lemonldap-ng-common/lib/Lemonldap/NG/Common/Logger/Dispatch.pm +++ b/lemonldap-ng-common/lib/Lemonldap/NG/Common/Logger/Dispatch.pm @@ -7,12 +7,12 @@ our $VERSION = '2.0.0'; sub new { no warnings 'redefine'; my $self = bless {}, shift; - my ($conf,%args) = @_; + my ( $conf, %args ) = @_; my %bck; my $last; my $show = 1; my $root = $args{user} ? 'userLogDispatch' : 'logDispatch'; - unless ( $conf->{$root.'Error'} ) { + unless ( $conf->{ $root . 'Error' } ) { die "At least, ${root}Error must be defined in conf"; } foreach my $l (qw(error warn notice info debug)) { diff --git a/lemonldap-ng-common/lib/Lemonldap/NG/Common/Logger/Sentry.pm b/lemonldap-ng-common/lib/Lemonldap/NG/Common/Logger/Sentry.pm index e73a084db..464f6737f 100644 --- a/lemonldap-ng-common/lib/Lemonldap/NG/Common/Logger/Sentry.pm +++ b/lemonldap-ng-common/lib/Lemonldap/NG/Common/Logger/Sentry.pm @@ -24,7 +24,7 @@ sub new { if ($show) { eval qq'sub $_ {\$_[0]->{raven}->capture_message(\$_[1],level => "$rl")}'; - die $@ if($@); + die $@ if ($@); } else { eval qq'sub $_ {1}'; diff --git a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Lib/CDA.pm b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Lib/CDA.pm index 6e86bef39..ffe33f91b 100644 --- a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Lib/CDA.pm +++ b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Lib/CDA.pm @@ -48,7 +48,8 @@ sub run { return $class->REDIRECT; } } - return $class->Lemonldap::NG::Handler::Main::run( $req, $rule, $protection ); + return $class->Lemonldap::NG::Handler::Main::run( $req, $rule, + $protection ); } ## @rmethod protected hash getCDAInfos(id) diff --git a/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/2ndFA.pm b/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/2ndFA.pm index ad56ccfd9..c7723fcbc 100644 --- a/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/2ndFA.pm +++ b/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/2ndFA.pm @@ -235,7 +235,7 @@ sub sfa { # Filter 2FA sessions if needed $self->logger->debug("Filtering 2F sessions..."); my $all = ( keys %$res ); - + if ( $self->{U2FCheck} eq '2' ) { foreach my $session ( keys %$res ) { delete $res->{$session} @@ -262,7 +262,7 @@ sub sfa { } my $total = ( keys %$res ); - $self->logger->debug("Session(s) left : $total / $all"); + $self->logger->debug("Session(s) left : $total / $all"); if ( my $group = $req->params('groupBy') ) { my $r; diff --git a/lemonldap-ng-portal/inc/LWP/Protocol/PSGI.pm b/lemonldap-ng-portal/inc/LWP/Protocol/PSGI.pm index f8aa65f64..e3c1a2e7f 100644 --- a/lemonldap-ng-portal/inc/LWP/Protocol/PSGI.pm +++ b/lemonldap-ng-portal/inc/LWP/Protocol/PSGI.pm @@ -20,59 +20,65 @@ sub register { unshift @apps, $app; # register this guy (as well as saving original code) once - if (! scalar keys %orig) { + if ( !scalar keys %orig ) { for my $proto (@protocols) { - if (my $orig = LWP::Protocol::implementor($proto)) { + if ( my $orig = LWP::Protocol::implementor($proto) ) { $orig{$proto} = $orig; - LWP::Protocol::implementor($proto, $class); - } else { - Carp::carp("LWP::Protocol::$proto is unavailable. Skip registering overrides for it.") if $^W; + LWP::Protocol::implementor( $proto, $class ); + } + else { + Carp::carp( +"LWP::Protocol::$proto is unavailable. Skip registering overrides for it." + ) if $^W; } } } - if (defined wantarray) { - return LWP::Protocol::PSGI::Guard->new(sub { - $class->unregister_app($app); - }); + if ( defined wantarray ) { + return LWP::Protocol::PSGI::Guard->new( + sub { + $class->unregister_app($app); + } + ); } } sub unregister_app { - my ($class, $app) = @_; + my ( $class, $app ) = @_; my $i = 0; foreach my $stored_app (@apps) { - if ($app == $stored_app) { + if ( $app == $stored_app ) { splice @apps, $i, 1; return; } $i++; } } - sub unregister { my $class = shift; for my $proto (@protocols) { - if ($orig{$proto}) { - LWP::Protocol::implementor($proto, $orig{$proto}); + if ( $orig{$proto} ) { + LWP::Protocol::implementor( $proto, $orig{$proto} ); } } @apps = (); } sub request { - my($self, $request, $proxy, $arg, @rest) = @_; + my ( $self, $request, $proxy, $arg, @rest ) = @_; - if (my $app = $self->handles($request)) { - my $env = req_to_psgi $request; + if ( my $app = $self->handles($request) ) { + my $env = req_to_psgi $request; my $response = res_from_psgi $app->app->($env); - my $content = $response->content; + my $content = $response->content; $response->content(''); - $self->collect_once($arg, $response, $content); - } else { - $orig{$self->{scheme}}->new($self->{scheme}, $self->{ua})->request($request, $proxy, $arg, @rest); + $self->collect_once( $arg, $response, $content ); + } + else { + $orig{ $self->{scheme} }->new( $self->{scheme}, $self->{ua} ) + ->request( $request, $proxy, $arg, @rest ); } } @@ -84,21 +90,20 @@ sub create { } sub handles { - my($self, $request) = @_; + my ( $self, $request ) = @_; foreach my $app (@apps) { - if ($app->match($request)) { + if ( $app->match($request) ) { return $app; } } } -package - LWP::Protocol::PSGI::Guard; +package LWP::Protocol::PSGI::Guard; use strict; sub new { - my($class, $code) = @_; + my ( $class, $code ) = @_; bless $code, $class; } @@ -107,41 +112,47 @@ sub DESTROY { $self->(); } -package - LWP::Protocol::PSGI::App; +package LWP::Protocol::PSGI::App; use strict; sub new { - my ($class, $app, %options) = @_; + my ( $class, $app, %options ) = @_; bless { app => $app, options => \%options }, $class; } -sub app { $_[0]->{app} } +sub app { $_[0]->{app} } sub options { $_[0]->{options} } + sub match { - my ($self, $request) = @_; + my ( $self, $request ) = @_; my $options = $self->options; - if ($options->{host}) { - my $matcher = $self->_matcher($options->{host}); - $matcher->($request->uri->host) || $matcher->($request->uri->host_port); - } elsif ($options->{uri}) { - $self->_matcher($options->{uri})->($request->uri); - } else { + if ( $options->{host} ) { + my $matcher = $self->_matcher( $options->{host} ); + $matcher->( $request->uri->host ) + || $matcher->( $request->uri->host_port ); + } + elsif ( $options->{uri} ) { + $self->_matcher( $options->{uri} )->( $request->uri ); + } + else { 1; } } sub _matcher { - my($self, $stuff) = @_; - if (ref $stuff eq 'Regexp') { + my ( $self, $stuff ) = @_; + if ( ref $stuff eq 'Regexp' ) { sub { $_[0] =~ $stuff }; - } elsif (ref $stuff eq 'CODE') { + } + elsif ( ref $stuff eq 'CODE' ) { $stuff; - } elsif (!ref $stuff) { + } + elsif ( !ref $stuff ) { sub { $_[0] eq $stuff }; - } else { - Carp::croak("Don't know how to match: ", ref $stuff); + } + else { + Carp::croak( "Don't know how to match: ", ref $stuff ); } } diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Engines/Default.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Engines/Default.pm index 98ccb4c89..160f20fe8 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Engines/Default.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Engines/Default.pm @@ -111,13 +111,13 @@ sub init { # run() is called at each authentication, just after sessionInfo populated sub run { my ( $self, $req ) = @_; - + my $checkLogins = $req->param('checkLogins'); $self->logger->debug("2F checkLogins set") if ($checkLogins); # Skip 2F unless a module has been registered return PE_OK unless ( @{ $self->sfModules } ); - + # Search for authorized modules for this user my @am; foreach my $m ( @{ $self->sfModules } ) { @@ -128,7 +128,7 @@ sub run { push @am, $m->{m}; } } - + # If no 2F module is authorized, skipping 2F # Note that a rule may forbid access after (GrantSession plugin) return PE_OK unless (@am); diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Ext2F.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Ext2F.pm index af4487fe2..d96fe02e1 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Ext2F.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Ext2F.pm @@ -34,7 +34,7 @@ sub init { sub run { my ( $self, $req, $token ) = @_; - + my $checkLogins = $req->param('checkLogins'); $self->logger->debug("Ext2F checkLogins set") if ($checkLogins); @@ -51,8 +51,8 @@ sub run { $req, 'ext2fcheck', params => { - SKIN => $self->conf->{portalSkin}, - TOKEN => $token, + SKIN => $self->conf->{portalSkin}, + TOKEN => $token, CHECKLOGINS => $checkLogins } ); diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/REST.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/REST.pm index b2b596c7e..d31f1d58c 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/REST.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/REST.pm @@ -55,7 +55,7 @@ sub init { sub run { my ( $self, $req, $token ) = @_; - + my $checkLogins = $req->param('checkLogins'); $self->logger->debug("REST2F checkLogins set") if ($checkLogins); @@ -89,9 +89,9 @@ sub run { $req, 'ext2fcheck', params => { - SKIN => $self->conf->{portalSkin}, - TOKEN => $token, - TARGET => '/rest2fcheck', + SKIN => $self->conf->{portalSkin}, + TOKEN => $token, + TARGET => '/rest2fcheck', CHECKLOGINS => $checkLogins } ); diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Register/U2F.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Register/U2F.pm index ee215064a..84f61e2a2 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Register/U2F.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Register/U2F.pm @@ -213,7 +213,8 @@ sub run { } my ( $err, $error ) = $self->loadUser($req); if ( $err == -1 ) { - return $self->p->sendError( $req, "U2F loading error: $error", 500 ); + return $self->p->sendError( $req, "U2F loading error: $error", + 500 ); } elsif ( $err == 0 ) { return $self->p->sendError( $req, "noU2FKeyFound" ); @@ -362,7 +363,7 @@ sub loadUser { $uk = $_->{_userKey}; my $c = $self->crypter( keyHandle => $kh, publicKey => $uk ); if ($c) { - $self->logger->debug("kh & uk -> OK"); + $self->logger->debug("kh & uk -> OK"); push @crypters, $c; } else { diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/TOTP.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/TOTP.pm index e23e60c72..42888b300 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/TOTP.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/TOTP.pm @@ -44,7 +44,7 @@ sub init { sub run { my ( $self, $req, $token ) = @_; $self->logger->debug('Generate TOTP form'); - + my $checkLogins = $req->param('checkLogins'); $self->logger->debug("TOTP checkLogins set") if ($checkLogins); @@ -53,8 +53,8 @@ sub run { $req, 'totp2fcheck', params => { - SKIN => $self->conf->{portalSkin}, - TOKEN => $token, + SKIN => $self->conf->{portalSkin}, + TOKEN => $token, CHECKLOGINS => $checkLogins } ); diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Yubikey.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Yubikey.pm index 6a75c4dc6..733e046ef 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Yubikey.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Yubikey.pm @@ -62,10 +62,10 @@ sub init { sub run { my ( $self, $req, $token, $_2fDevices ) = @_; - + my $checkLogins = $req->param('checkLogins'); $self->logger->debug("Yubikey checkLogins set") if ($checkLogins); - + my $yubikey = 0; if ( $req->{sessionInfo}->{_2fDevices} ) { $self->logger->debug("Loading 2F Devices ..."); @@ -103,11 +103,11 @@ sub run { $req, 'ext2fcheck', params => { - SKIN => $self->conf->{portalSkin}, - TOKEN => $token, - TARGET => '/yubikey2fcheck', - INPUTLOGO => 'yubikey.png', - LEGEND => 'clickOnYubikey', + SKIN => $self->conf->{portalSkin}, + TOKEN => $token, + TARGET => '/yubikey2fcheck', + INPUTLOGO => 'yubikey.png', + LEGEND => 'clickOnYubikey', CHECKLOGINS => $checkLogins } ); diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/SAML.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/SAML.pm index 3ac43c0db..bbe8d9c9a 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/SAML.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/SAML.pm @@ -69,7 +69,7 @@ qr/^($saml_slo_soap_url|$saml_slo_soap_url_ret|$saml_slo_get_url|$saml_slo_get_u my $saml_ars_url = $self->getMetaDataURL( "samlSPSSODescriptorArtifactResolutionServiceArtifact"); $self->artRe(qr/^($saml_ars_url)(?:\?.*)?$/i); - $self->catch($self->sloAssConsumerRe); + $self->catch( $self->sloAssConsumerRe ); # Load SAML service and SAML IdP list return ( $self->SUPER::init and $self->loadIDPs ); diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Menu.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Menu.pm index c7dbbbf0e..b7421c916 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Menu.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Menu.pm @@ -94,14 +94,15 @@ sub params { $req->param("tab") // '' ) || "applist"; } - + $res{DISPLAY_MODULES} = $self->displayModules($req); $res{AUTH_ERROR_TYPE} = $req->error_type( $res{AUTH_ERROR} = $req->menuError ); - + # Display menu 2fRegisters link only if at least a 2F device is registered - $res{SFAManagment} = $self->p->_sfEngine->display2fRegisters($req, $req->userData); - $self->logger->debug( "Display 2fRegisters link ? ". $res{SFAManagment} ); + $res{SFAManagment} = + $self->p->_sfEngine->display2fRegisters( $req, $req->userData ); + $self->logger->debug( "Display 2fRegisters link ? " . $res{SFAManagment} ); return %res; } diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/SecondFactor.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/SecondFactor.pm index a5576cf0c..a33d86e99 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/SecondFactor.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/SecondFactor.pm @@ -56,7 +56,7 @@ sub _redirect { sub _verify { my ( $self, $req ) = @_; - + my $checkLogins = $req->param('checkLogins'); $self->logger->debug("checkLogins set") if ($checkLogins); diff --git a/lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-Artifact-with-SOAP-SLO-IdP-initiated.t b/lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-Artifact-with-SOAP-SLO-IdP-initiated.t index 28220304c..7c0eb172a 100644 --- a/lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-Artifact-with-SOAP-SLO-IdP-initiated.t +++ b/lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-Artifact-with-SOAP-SLO-IdP-initiated.t @@ -52,7 +52,7 @@ SKIP: { ok( $issuer = issuer(), 'Issuer portal' ); $handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload; switch ('sp'); - &Lemonldap::NG::Handler::Main::cfgNum(0,0); + &Lemonldap::NG::Handler::Main::cfgNum( 0, 0 ); ok( $sp = sp(), 'SP portal' ); $handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload; diff --git a/lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-Artifact-with-SOAP-SLO.t b/lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-Artifact-with-SOAP-SLO.t index b9cfb1d5c..dff90795c 100644 --- a/lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-Artifact-with-SOAP-SLO.t +++ b/lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-Artifact-with-SOAP-SLO.t @@ -51,7 +51,7 @@ SKIP: { ok( $issuer = issuer(), 'Issuer portal' ); $handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload; switch ('sp'); - &Lemonldap::NG::Handler::Main::cfgNum(0,0); + &Lemonldap::NG::Handler::Main::cfgNum( 0, 0 ); ok( $sp = sp(), 'SP portal' ); $handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload; diff --git a/lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-POST-IdP-initiated.t b/lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-POST-IdP-initiated.t index 8c577c7e1..2f36e4f97 100644 --- a/lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-POST-IdP-initiated.t +++ b/lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-POST-IdP-initiated.t @@ -35,7 +35,7 @@ SKIP: { ok( $issuer = issuer(), 'Issuer portal' ); $handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload; switch ('sp'); - &Lemonldap::NG::Handler::Main::cfgNum(0,0); + &Lemonldap::NG::Handler::Main::cfgNum( 0, 0 ); ok( $sp = sp(), 'SP portal' ); $handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload; diff --git a/lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-POST.t b/lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-POST.t index 0d54ed81f..e85b8844c 100644 --- a/lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-POST.t +++ b/lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-POST.t @@ -35,7 +35,7 @@ SKIP: { ok( $issuer = issuer(), 'Issuer portal' ); $handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload; switch ('sp'); - &Lemonldap::NG::Handler::Main::cfgNum(0,0); + &Lemonldap::NG::Handler::Main::cfgNum( 0, 0 ); ok( $sp = sp(), 'SP portal' ); $handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload; diff --git a/lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-Redirect-IdP-initiated.t b/lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-Redirect-IdP-initiated.t index 239b7bf8a..4ebf6e0b6 100644 --- a/lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-Redirect-IdP-initiated.t +++ b/lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-Redirect-IdP-initiated.t @@ -35,7 +35,7 @@ SKIP: { ok( $issuer = issuer(), 'Issuer portal' ); $handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload; switch ('sp'); - &Lemonldap::NG::Handler::Main::cfgNum(0,0); + &Lemonldap::NG::Handler::Main::cfgNum( 0, 0 ); ok( $sp = sp(), 'SP portal' ); $handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload; diff --git a/lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-Redirect.t b/lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-Redirect.t index 0cdd45ba5..dff8b334c 100644 --- a/lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-Redirect.t +++ b/lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-Redirect.t @@ -35,7 +35,7 @@ SKIP: { ok( $issuer = issuer(), 'Issuer portal' ); $handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload; switch ('sp'); - &Lemonldap::NG::Handler::Main::cfgNum(0,0); + &Lemonldap::NG::Handler::Main::cfgNum( 0, 0 ); ok( $sp = sp(), 'SP portal' ); $handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload; diff --git a/lemonldap-ng-portal/t/30-SAML-ReAuth-with-choice.t b/lemonldap-ng-portal/t/30-SAML-ReAuth-with-choice.t index 433dbf711..808c91a5f 100644 --- a/lemonldap-ng-portal/t/30-SAML-ReAuth-with-choice.t +++ b/lemonldap-ng-portal/t/30-SAML-ReAuth-with-choice.t @@ -47,7 +47,7 @@ SKIP: { ok( $issuer = issuer(), 'Issuer portal' ); $handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload; switch ('sp'); - &Lemonldap::NG::Handler::Main::cfgNum(0,0); + &Lemonldap::NG::Handler::Main::cfgNum( 0, 0 ); ok( $sp = sp(), 'SP portal' ); $handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload; diff --git a/lemonldap-ng-portal/t/30-SAML-ReAuth.t b/lemonldap-ng-portal/t/30-SAML-ReAuth.t index d8c8e5c77..ab6976eb5 100644 --- a/lemonldap-ng-portal/t/30-SAML-ReAuth.t +++ b/lemonldap-ng-portal/t/30-SAML-ReAuth.t @@ -35,7 +35,7 @@ SKIP: { ok( $issuer = issuer(), 'Issuer portal' ); $handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload; switch ('sp'); - &Lemonldap::NG::Handler::Main::cfgNum(0,0); + &Lemonldap::NG::Handler::Main::cfgNum( 0, 0 ); ok( $sp = sp(), 'SP portal' ); $handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload; diff --git a/lemonldap-ng-portal/t/30-SAML-SP-rule.t b/lemonldap-ng-portal/t/30-SAML-SP-rule.t index a17e3d2c4..675292a68 100644 --- a/lemonldap-ng-portal/t/30-SAML-SP-rule.t +++ b/lemonldap-ng-portal/t/30-SAML-SP-rule.t @@ -35,7 +35,7 @@ SKIP: { ok( $issuer = issuer(), 'Issuer portal' ); $handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload; switch ('sp'); - &Lemonldap::NG::Handler::Main::cfgNum(0,0); + &Lemonldap::NG::Handler::Main::cfgNum( 0, 0 ); ok( $sp = sp(), 'SP portal' ); $handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload; diff --git a/lemonldap-ng-portal/t/31-Auth-and-issuer-CAS-default.t b/lemonldap-ng-portal/t/31-Auth-and-issuer-CAS-default.t index 505b17914..1e2bde951 100644 --- a/lemonldap-ng-portal/t/31-Auth-and-issuer-CAS-default.t +++ b/lemonldap-ng-portal/t/31-Auth-and-issuer-CAS-default.t @@ -58,7 +58,7 @@ ok( $issuer = issuer(), 'Issuer portal' ); $handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload; count(1); switch ('sp'); -&Lemonldap::NG::Handler::Main::cfgNum(0,0); +&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 ); ok( $sp = sp(), 'SP portal' ); count(1); diff --git a/lemonldap-ng-portal/t/31-Auth-and-issuer-CAS-proxied.t b/lemonldap-ng-portal/t/31-Auth-and-issuer-CAS-proxied.t index 580861cf1..3969d2572 100644 --- a/lemonldap-ng-portal/t/31-Auth-and-issuer-CAS-proxied.t +++ b/lemonldap-ng-portal/t/31-Auth-and-issuer-CAS-proxied.t @@ -56,7 +56,7 @@ ok( $issuer = issuer(), 'Issuer portal' ); $handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload; count(1); switch ('sp'); -&Lemonldap::NG::Handler::Main::cfgNum(0,0); +&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 ); ok( $sp = sp(), 'SP portal' ); count(1); @@ -256,14 +256,14 @@ sub sp { casSrvMetaDataOptions => { idp => { casSrvMetaDataOptionsUrl => 'http://auth.idp.com/cas', - casSrvMetaDataOptionsGateway => 0, + casSrvMetaDataOptionsGateway => 0, } }, casSrvMetaDataOptionsProxiedServices => { idp => { - test => 'http://test.sp.com/', + test => 'http://test.sp.com/', } - }, + }, }, } ); diff --git a/lemonldap-ng-portal/t/31-Auth-and-issuer-CAS-with-choice.t b/lemonldap-ng-portal/t/31-Auth-and-issuer-CAS-with-choice.t index 81dafc6fe..2ac6b1d89 100644 --- a/lemonldap-ng-portal/t/31-Auth-and-issuer-CAS-with-choice.t +++ b/lemonldap-ng-portal/t/31-Auth-and-issuer-CAS-with-choice.t @@ -75,7 +75,7 @@ SKIP: { ok( $issuer = issuer(), 'Issuer portal' ); $handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload; switch ('sp'); - &Lemonldap::NG::Handler::Main::cfgNum(0,0); + &Lemonldap::NG::Handler::Main::cfgNum( 0, 0 ); # Build CAS app ok( $sp = sp(), 'SP portal' ); diff --git a/lemonldap-ng-portal/t/32-Auth-and-issuer-OIDC-authorization_code.t b/lemonldap-ng-portal/t/32-Auth-and-issuer-OIDC-authorization_code.t index 31890d9fc..826338dd9 100644 --- a/lemonldap-ng-portal/t/32-Auth-and-issuer-OIDC-authorization_code.t +++ b/lemonldap-ng-portal/t/32-Auth-and-issuer-OIDC-authorization_code.t @@ -158,8 +158,7 @@ count(1); # Verify UTF-8 ok( $res = $op->_get( - '/oauth2/userinfo', - query => 'access_token=' . $access_token, + '/oauth2/userinfo', query => 'access_token=' . $access_token, ), 'Get userinfo' ); diff --git a/lemonldap-ng-portal/t/33-Auth-and-issuer-OpenID2.t b/lemonldap-ng-portal/t/33-Auth-and-issuer-OpenID2.t index 71ab621fc..a4a9f777f 100644 --- a/lemonldap-ng-portal/t/33-Auth-and-issuer-OpenID2.t +++ b/lemonldap-ng-portal/t/33-Auth-and-issuer-OpenID2.t @@ -52,7 +52,7 @@ SKIP: { ok( $issuer = issuer(), 'Issuer portal' ); $handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload; switch ('sp'); - &Lemonldap::NG::Handler::Main::cfgNum(0,0); + &Lemonldap::NG::Handler::Main::cfgNum( 0, 0 ); ok( $sp = sp(), 'SP portal' ); $handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload; diff --git a/lemonldap-ng-portal/t/34-Auth-Proxy-and-REST-Server.t b/lemonldap-ng-portal/t/34-Auth-Proxy-and-REST-Server.t index b46344229..334a14ec9 100644 --- a/lemonldap-ng-portal/t/34-Auth-Proxy-and-REST-Server.t +++ b/lemonldap-ng-portal/t/34-Auth-Proxy-and-REST-Server.t @@ -64,7 +64,7 @@ LWP::Protocol::PSGI->register( ok( $issuer = issuer(), 'Issuer portal' ); $handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload; switch ('sp'); -&Lemonldap::NG::Handler::Main::cfgNum(0,0); +&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 ); ok( $sp = sp(), 'SP portal' ); $handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload; diff --git a/lemonldap-ng-portal/t/34-Auth-Proxy-and-SOAP-Server.t b/lemonldap-ng-portal/t/34-Auth-Proxy-and-SOAP-Server.t index 4f5dfad0f..12778dc79 100644 --- a/lemonldap-ng-portal/t/34-Auth-Proxy-and-SOAP-Server.t +++ b/lemonldap-ng-portal/t/34-Auth-Proxy-and-SOAP-Server.t @@ -57,7 +57,7 @@ SKIP: { ok( $issuer = issuer(), 'Issuer portal' ); $handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload; switch ('sp'); - &Lemonldap::NG::Handler::Main::cfgNum(0,0); + &Lemonldap::NG::Handler::Main::cfgNum( 0, 0 ); ok( $sp = sp(), 'SP portal' ); $handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload; diff --git a/lemonldap-ng-portal/t/35-REST-config-backend.t b/lemonldap-ng-portal/t/35-REST-config-backend.t index a32fa5b94..2f9fd622b 100644 --- a/lemonldap-ng-portal/t/35-REST-config-backend.t +++ b/lemonldap-ng-portal/t/35-REST-config-backend.t @@ -71,7 +71,7 @@ count(1); expectOK($res); switch ('sp'); -&Lemonldap::NG::Handler::Main::cfgNum(0,0); +&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 ); ok( $sp = sp(), 'SP portal' ); $handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload; diff --git a/lemonldap-ng-portal/t/35-REST-sessions-with-REST-server.t b/lemonldap-ng-portal/t/35-REST-sessions-with-REST-server.t index 04f08a41c..3f3285cee 100644 --- a/lemonldap-ng-portal/t/35-REST-sessions-with-REST-server.t +++ b/lemonldap-ng-portal/t/35-REST-sessions-with-REST-server.t @@ -64,7 +64,7 @@ LWP::Protocol::PSGI->register( ok( $issuer = issuer(), 'Issuer portal' ); $handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload; switch ('sp'); -&Lemonldap::NG::Handler::Main::cfgNum(0,0); +&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 ); ok( $sp = sp(), 'SP portal' ); $handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload; diff --git a/lemonldap-ng-portal/t/35-SOAP-config-backend.t b/lemonldap-ng-portal/t/35-SOAP-config-backend.t index ce6b56ff5..174647872 100644 --- a/lemonldap-ng-portal/t/35-SOAP-config-backend.t +++ b/lemonldap-ng-portal/t/35-SOAP-config-backend.t @@ -68,7 +68,7 @@ SKIP: { # Test SP access switch ('sp'); - &Lemonldap::NG::Handler::Main::cfgNum(0,0); + &Lemonldap::NG::Handler::Main::cfgNum( 0, 0 ); ok( $sp = sp(), 'SP portal' ); $handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload; diff --git a/lemonldap-ng-portal/t/35-SOAP-sessions-with-SOAP-server.t b/lemonldap-ng-portal/t/35-SOAP-sessions-with-SOAP-server.t index a78773020..4a0bbdd83 100644 --- a/lemonldap-ng-portal/t/35-SOAP-sessions-with-SOAP-server.t +++ b/lemonldap-ng-portal/t/35-SOAP-sessions-with-SOAP-server.t @@ -55,7 +55,7 @@ SKIP: { ok( $issuer = issuer(), 'Issuer portal' ); $handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload; switch ('sp'); - &Lemonldap::NG::Handler::Main::cfgNum(0,0); + &Lemonldap::NG::Handler::Main::cfgNum( 0, 0 ); ok( $sp = sp(), 'SP portal' ); $handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload; diff --git a/lemonldap-ng-portal/t/37-Logout-from-OIDC-RP-to-SAML-SP.t b/lemonldap-ng-portal/t/37-Logout-from-OIDC-RP-to-SAML-SP.t index 222713178..83bae4538 100644 --- a/lemonldap-ng-portal/t/37-Logout-from-OIDC-RP-to-SAML-SP.t +++ b/lemonldap-ng-portal/t/37-Logout-from-OIDC-RP-to-SAML-SP.t @@ -96,7 +96,7 @@ SKIP: { $handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload; switch ('rp'); - &Lemonldap::NG::Handler::Main::cfgNum(0,0); + &Lemonldap::NG::Handler::Main::cfgNum( 0, 0 ); ok( $rp = rp( $jwks, $metadata ), 'RP portal' ); $handlerOR{rp} = \@Lemonldap::NG::Handler::Main::_onReload; diff --git a/lemonldap-ng-portal/t/37-OIDC-RP-to-SAML-IdP-GET.t b/lemonldap-ng-portal/t/37-OIDC-RP-to-SAML-IdP-GET.t index 215ad4a96..8367883df 100644 --- a/lemonldap-ng-portal/t/37-OIDC-RP-to-SAML-IdP-GET.t +++ b/lemonldap-ng-portal/t/37-OIDC-RP-to-SAML-IdP-GET.t @@ -78,7 +78,7 @@ SKIP: { $handlerOR{idp} = \@Lemonldap::NG::Handler::Main::_onReload; switch ('sp'); - &Lemonldap::NG::Handler::Main::cfgNum(0,0); + &Lemonldap::NG::Handler::Main::cfgNum( 0, 0 ); ok( $sp = sp(), 'Proxy portal' ); $handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload; diff --git a/lemonldap-ng-portal/t/37-OIDC-RP-to-SAML-IdP-POST.t b/lemonldap-ng-portal/t/37-OIDC-RP-to-SAML-IdP-POST.t index 9e7adaea9..b44c2d7b1 100644 --- a/lemonldap-ng-portal/t/37-OIDC-RP-to-SAML-IdP-POST.t +++ b/lemonldap-ng-portal/t/37-OIDC-RP-to-SAML-IdP-POST.t @@ -78,7 +78,7 @@ SKIP: { $handlerOR{idp} = \@Lemonldap::NG::Handler::Main::_onReload; switch ('sp'); - &Lemonldap::NG::Handler::Main::cfgNum(0,0); + &Lemonldap::NG::Handler::Main::cfgNum( 0, 0 ); ok( $sp = sp(), 'Proxy portal' ); $handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload; diff --git a/lemonldap-ng-portal/t/37-SAML-SP-GET-to-OIDC-OP.t b/lemonldap-ng-portal/t/37-SAML-SP-GET-to-OIDC-OP.t index 2c5c51c81..bef2226fd 100644 --- a/lemonldap-ng-portal/t/37-SAML-SP-GET-to-OIDC-OP.t +++ b/lemonldap-ng-portal/t/37-SAML-SP-GET-to-OIDC-OP.t @@ -96,7 +96,7 @@ SKIP: { $handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload; switch ('proxy'); - &Lemonldap::NG::Handler::Main::cfgNum(0,0); + &Lemonldap::NG::Handler::Main::cfgNum( 0, 0 ); ok( $proxy = proxy( $jwks, $metadata ), 'Proxy portal' ); $handlerOR{proxy} = \@Lemonldap::NG::Handler::Main::_onReload; diff --git a/lemonldap-ng-portal/t/37-SAML-SP-POST-to-OIDC-OP.t b/lemonldap-ng-portal/t/37-SAML-SP-POST-to-OIDC-OP.t index f55a6784d..0d97da50d 100644 --- a/lemonldap-ng-portal/t/37-SAML-SP-POST-to-OIDC-OP.t +++ b/lemonldap-ng-portal/t/37-SAML-SP-POST-to-OIDC-OP.t @@ -96,7 +96,7 @@ SKIP: { $handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload; switch ('proxy'); - &Lemonldap::NG::Handler::Main::cfgNum(0,0); + &Lemonldap::NG::Handler::Main::cfgNum( 0, 0 ); ok( $proxy = proxy( $jwks, $metadata ), 'Proxy portal' ); $handlerOR{proxy} = \@Lemonldap::NG::Handler::Main::_onReload; diff --git a/lemonldap-ng-portal/t/66-CDA-already-auth.t b/lemonldap-ng-portal/t/66-CDA-already-auth.t index fe51b6915..5c43aa61d 100644 --- a/lemonldap-ng-portal/t/66-CDA-already-auth.t +++ b/lemonldap-ng-portal/t/66-CDA-already-auth.t @@ -58,7 +58,7 @@ use_ok('Lemonldap::NG::Common::PSGI::Cli::Lib'); count(2); my ( $cli, $app ); -switch('app'); +switch ('app'); ok( $app = Lemonldap::NG::Handler::Server->run( $client->ini ), 'App' ); count(1); diff --git a/lemonldap-ng-portal/t/66-CDA-with-REST.t b/lemonldap-ng-portal/t/66-CDA-with-REST.t index 3112295a9..1bce34d32 100644 --- a/lemonldap-ng-portal/t/66-CDA-with-REST.t +++ b/lemonldap-ng-portal/t/66-CDA-with-REST.t @@ -20,9 +20,10 @@ my $client; LWP::Protocol::PSGI->register( sub { my $req = Plack::Request->new(@_); - ok( $req->uri =~ m#http://auth.example.com(.*?)(?:\?(.*))?$#, " @ REST REQUEST @" ); + ok( $req->uri =~ m#http://auth.example.com(.*?)(?:\?(.*))?$#, + " @ REST REQUEST @" ); count(1); - my $url = $1; + my $url = $1; my $query = $2; my $res; switch ('portal'); @@ -31,10 +32,10 @@ LWP::Protocol::PSGI->register( my $s = $req->content; ok( $res = $client->$mth( - $url, - IO::String->new($s), - length => length($s), - type => $req->header('Content-Type'), + $url, + IO::String->new($s), + length => length($s), + type => $req->header('Content-Type'), ), ' Post request' ); @@ -45,10 +46,10 @@ LWP::Protocol::PSGI->register( my $mth = '_' . lc($1); ok( $res = $client->$mth( - $url, - accept => $req->header('Accept'), - cookie => $req->header('Cookie'), - query => $query, + $url, + accept => $req->header('Accept'), + cookie => $req->header('Cookie'), + query => $query, ), ' Execute request' ); @@ -64,120 +65,118 @@ LWP::Protocol::PSGI->register( } ); - $client = LLNG::Manager::Test->new( - { - ini => { - logLevel => $debug, - useSafeJail => 1, - cda => 1, - restSessionServer => 1, - logger => 'Lemonldap::NG::Common::Logger::Std', - } +$client = LLNG::Manager::Test->new( + { + ini => { + logLevel => $debug, + useSafeJail => 1, + cda => 1, + restSessionServer => 1, + logger => 'Lemonldap::NG::Common::Logger::Std', } - ); - $handlerOR{portal} = \@Lemonldap::NG::Handler::Main::_onReload; + } +); +$handlerOR{portal} = \@Lemonldap::NG::Handler::Main::_onReload; - # CDA with unauthentified user - ok( - $res = $client->_get( - '/', - query => 'url=aHR0cDovL3Rlc3QuZXhhbXBsZS5vcmcv', - accept => 'text/html', - ), - 'Unauth CDA request' - ); - my ( $host, $url, $query ) = expectForm( $res, undef, undef, 'url' ); - ok( $query =~ /\burl=aHR0cDovL3Rlc3QuZXhhbXBsZS5vcmcv\b/, - ' check url value' ); +# CDA with unauthentified user +ok( + $res = $client->_get( + '/', + query => 'url=aHR0cDovL3Rlc3QuZXhhbXBsZS5vcmcv', + accept => 'text/html', + ), + 'Unauth CDA request' +); +my ( $host, $url, $query ) = expectForm( $res, undef, undef, 'url' ); +ok( $query =~ /\burl=aHR0cDovL3Rlc3QuZXhhbXBsZS5vcmcv\b/, ' check url value' ); - # Authentification - $query .= '&user=dwho&password=dwho'; - ok( - $res = $client->_post( - '/' => IO::String->new($query), - length => length($query), - accept => 'text/html', - ), - 'Post credentials' - ); +# Authentification +$query .= '&user=dwho&password=dwho'; +ok( + $res = $client->_post( + '/' => IO::String->new($query), + length => length($query), + accept => 'text/html', + ), + 'Post credentials' +); - ($query) = - expectRedirection( $res, - qr#^http://test.example.org/\?(lemonldapcda=.*)$# ); +($query) = + expectRedirection( $res, qr#^http://test.example.org/\?(lemonldapcda=.*)$# ); - # Handler part - use_ok('Lemonldap::NG::Handler::Server'); - use_ok('Lemonldap::NG::Common::PSGI::Cli::Lib'); +# Handler part +use_ok('Lemonldap::NG::Handler::Server'); +use_ok('Lemonldap::NG::Common::PSGI::Cli::Lib'); - my ( $cli, $app ); - &Lemonldap::NG::Handler::Main::cfgNum( 0, 0 ); - switch ('app'); - ok( - $app = Lemonldap::NG::Handler::Server->run( - { - %{ $client->ini }, - globalStorage => 'Lemonldap::NG::Common::Apache::Session::REST', - globalStorageOptions => - { baseUrl => 'http://auth.example.com/sessions/global/' }, - localSessionStorage => undef, - } - ), - 'App' - ); +my ( $cli, $app ); +&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 ); +switch ('app'); +ok( + $app = Lemonldap::NG::Handler::Server->run( + { + %{ $client->ini }, + globalStorage => 'Lemonldap::NG::Common::Apache::Session::REST', + globalStorageOptions => + { baseUrl => 'http://auth.example.com/sessions/global/' }, + localSessionStorage => undef, + } + ), + 'App' +); - ok( - $res = $app->( - { - 'HTTP_ACCEPT' => 'text/html', - 'SCRIPT_NAME' => '/', - 'SERVER_NAME' => '127.0.0.1', - 'QUERY_STRING' => $query, - 'HTTP_CACHE_CONTROL' => 'max-age=0', - 'HTTP_ACCEPT_LANGUAGE' => 'fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3', - 'PATH_INFO' => '/', - 'REQUEST_METHOD' => 'GET', - 'REQUEST_URI' => "/?$query", - 'X_ORIGINAL_URI' => "/?$query", - 'SERVER_PORT' => '80', - 'SERVER_PROTOCOL' => 'HTTP/1.1', - 'HTTP_USER_AGENT' => - 'Mozilla/5.0 (VAX-4000; rv:36.0) Gecko/20350101 Firefox', - 'REMOTE_ADDR' => '127.0.0.1', - 'HTTP_HOST' => 'test.example.org', - 'VHOSTTYPE' => 'CDA', - } - ), - 'Push cda cookie' - ); - expectRedirection( $res, 'http://test.example.org/' ); - my $cid = expectCookie($res); +ok( + $res = $app->( + { + 'HTTP_ACCEPT' => 'text/html', + 'SCRIPT_NAME' => '/', + 'SERVER_NAME' => '127.0.0.1', + 'QUERY_STRING' => $query, + 'HTTP_CACHE_CONTROL' => 'max-age=0', + 'HTTP_ACCEPT_LANGUAGE' => 'fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3', + 'PATH_INFO' => '/', + 'REQUEST_METHOD' => 'GET', + 'REQUEST_URI' => "/?$query", + 'X_ORIGINAL_URI' => "/?$query", + 'SERVER_PORT' => '80', + 'SERVER_PROTOCOL' => 'HTTP/1.1', + 'HTTP_USER_AGENT' => + 'Mozilla/5.0 (VAX-4000; rv:36.0) Gecko/20350101 Firefox', + 'REMOTE_ADDR' => '127.0.0.1', + 'HTTP_HOST' => 'test.example.org', + 'VHOSTTYPE' => 'CDA', + } + ), + 'Push cda cookie' +); +expectRedirection( $res, 'http://test.example.org/' ); +my $cid = expectCookie($res); - ok( - $res = $app->( - { - 'HTTP_ACCEPT' => 'text/html', - 'SCRIPT_NAME' => '/', - 'SERVER_NAME' => '127.0.0.1', - 'HTTP_COOKIE' => "lemonldap=$cid", - 'HTTP_CACHE_CONTROL' => 'max-age=0', - 'HTTP_ACCEPT_LANGUAGE' => 'fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3', - 'PATH_INFO' => '/', - 'REQUEST_METHOD' => 'GET', - 'REQUEST_URI' => "/", - 'X_ORIGINAL_URI' => "/", - 'SERVER_PORT' => '80', - 'SERVER_PROTOCOL' => 'HTTP/1.1', - 'HTTP_USER_AGENT' => - 'Mozilla/5.0 (VAX-4000; rv:36.0) Gecko/20350101 Firefox', - 'REMOTE_ADDR' => '127.0.0.1', - 'HTTP_HOST' => 'test.example.org', - 'VHOSTTYPE' => 'CDA', - } - ), - 'Authenticated query' - ); - expectOK($res); - expectAuthenticatedAs( $res, 'dwho' ); +ok( + $res = $app->( + { + 'HTTP_ACCEPT' => 'text/html', + 'SCRIPT_NAME' => '/', + 'SERVER_NAME' => '127.0.0.1', + 'HTTP_COOKIE' => "lemonldap=$cid", + 'HTTP_CACHE_CONTROL' => 'max-age=0', + 'HTTP_ACCEPT_LANGUAGE' => 'fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3', + 'PATH_INFO' => '/', + 'REQUEST_METHOD' => 'GET', + 'REQUEST_URI' => "/", + 'X_ORIGINAL_URI' => "/", + 'SERVER_PORT' => '80', + 'SERVER_PROTOCOL' => 'HTTP/1.1', + 'HTTP_USER_AGENT' => + 'Mozilla/5.0 (VAX-4000; rv:36.0) Gecko/20350101 Firefox', + 'REMOTE_ADDR' => '127.0.0.1', + 'HTTP_HOST' => 'test.example.org', + 'VHOSTTYPE' => 'CDA', + } + ), + 'Authenticated query' +); +expectOK($res); +expectAuthenticatedAs( $res, 'dwho' ); clean_sessions(); diff --git a/lemonldap-ng-portal/t/66-CDA.t b/lemonldap-ng-portal/t/66-CDA.t index ef20c9bb2..15a360ee1 100644 --- a/lemonldap-ng-portal/t/66-CDA.t +++ b/lemonldap-ng-portal/t/66-CDA.t @@ -57,7 +57,7 @@ use_ok('Lemonldap::NG::Common::PSGI::Cli::Lib'); count(2); my ( $cli, $app ); -switch('app'); +switch ('app'); ok( $app = Lemonldap::NG::Handler::Server->run( $client->ini ), 'App' ); count(1);