Tidy
This commit is contained in:
parent
7a83f4e84b
commit
4ebcae3e15
|
@ -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 ) {
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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}';
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -20,30 +20,35 @@ 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 {
|
||||
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;
|
||||
}
|
||||
|
@ -51,28 +56,29 @@ sub unregister_app {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
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)) {
|
||||
if ( my $app = $self->handles($request) ) {
|
||||
my $env = req_to_psgi $request;
|
||||
my $response = res_from_psgi $app->app->($env);
|
||||
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 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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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" );
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -100,8 +100,9 @@ sub params {
|
|||
$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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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' );
|
||||
|
|
|
@ -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'
|
||||
);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -20,7 +20,8 @@ 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 $query = $2;
|
||||
|
@ -64,7 +65,7 @@ LWP::Protocol::PSGI->register(
|
|||
}
|
||||
);
|
||||
|
||||
$client = LLNG::Manager::Test->new(
|
||||
$client = LLNG::Manager::Test->new(
|
||||
{
|
||||
ini => {
|
||||
logLevel => $debug,
|
||||
|
@ -74,45 +75,43 @@ LWP::Protocol::PSGI->register(
|
|||
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(
|
||||
# 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' );
|
||||
);
|
||||
my ( $host, $url, $query ) = expectForm( $res, undef, undef, 'url' );
|
||||
ok( $query =~ /\burl=aHR0cDovL3Rlc3QuZXhhbXBsZS5vcmcv\b/, ' check url value' );
|
||||
|
||||
# Authentification
|
||||
$query .= '&user=dwho&password=dwho';
|
||||
ok(
|
||||
# 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(
|
||||
my ( $cli, $app );
|
||||
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
|
||||
switch ('app');
|
||||
ok(
|
||||
$app = Lemonldap::NG::Handler::Server->run(
|
||||
{
|
||||
%{ $client->ini },
|
||||
|
@ -123,9 +122,9 @@ LWP::Protocol::PSGI->register(
|
|||
}
|
||||
),
|
||||
'App'
|
||||
);
|
||||
);
|
||||
|
||||
ok(
|
||||
ok(
|
||||
$res = $app->(
|
||||
{
|
||||
'HTTP_ACCEPT' => 'text/html',
|
||||
|
@ -148,11 +147,11 @@ LWP::Protocol::PSGI->register(
|
|||
}
|
||||
),
|
||||
'Push cda cookie'
|
||||
);
|
||||
expectRedirection( $res, 'http://test.example.org/' );
|
||||
my $cid = expectCookie($res);
|
||||
);
|
||||
expectRedirection( $res, 'http://test.example.org/' );
|
||||
my $cid = expectCookie($res);
|
||||
|
||||
ok(
|
||||
ok(
|
||||
$res = $app->(
|
||||
{
|
||||
'HTTP_ACCEPT' => 'text/html',
|
||||
|
@ -175,9 +174,9 @@ LWP::Protocol::PSGI->register(
|
|||
}
|
||||
),
|
||||
'Authenticated query'
|
||||
);
|
||||
expectOK($res);
|
||||
expectAuthenticatedAs( $res, 'dwho' );
|
||||
);
|
||||
expectOK($res);
|
||||
expectAuthenticatedAs( $res, 'dwho' );
|
||||
|
||||
clean_sessions();
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue