Tidy
This commit is contained in:
parent
7a83f4e84b
commit
4ebcae3e15
|
@ -53,9 +53,8 @@ sub load {
|
||||||
my ( $self, $cfgNum, $fields ) = @_;
|
my ( $self, $cfgNum, $fields ) = @_;
|
||||||
$fields = $fields ? join( ",", @$fields ) : '*';
|
$fields = $fields ? join( ",", @$fields ) : '*';
|
||||||
my $sth =
|
my $sth =
|
||||||
$self->_dbh->prepare( "SELECT field,value from "
|
$self->_dbh->prepare(
|
||||||
. $self->{dbiTable}
|
"SELECT field,value from " . $self->{dbiTable} . " WHERE cfgNum=?" );
|
||||||
. " WHERE cfgNum=?" );
|
|
||||||
$sth->execute($cfgNum);
|
$sth->execute($cfgNum);
|
||||||
my ( $res, @row );
|
my ( $res, @row );
|
||||||
while ( @row = $sth->fetchrow_array ) {
|
while ( @row = $sth->fetchrow_array ) {
|
||||||
|
|
|
@ -7,12 +7,12 @@ our $VERSION = '2.0.0';
|
||||||
sub new {
|
sub new {
|
||||||
no warnings 'redefine';
|
no warnings 'redefine';
|
||||||
my $self = bless {}, shift;
|
my $self = bless {}, shift;
|
||||||
my ($conf,%args) = @_;
|
my ( $conf, %args ) = @_;
|
||||||
my %bck;
|
my %bck;
|
||||||
my $last;
|
my $last;
|
||||||
my $show = 1;
|
my $show = 1;
|
||||||
my $root = $args{user} ? 'userLogDispatch' : 'logDispatch';
|
my $root = $args{user} ? 'userLogDispatch' : 'logDispatch';
|
||||||
unless ( $conf->{$root.'Error'} ) {
|
unless ( $conf->{ $root . 'Error' } ) {
|
||||||
die "At least, ${root}Error must be defined in conf";
|
die "At least, ${root}Error must be defined in conf";
|
||||||
}
|
}
|
||||||
foreach my $l (qw(error warn notice info debug)) {
|
foreach my $l (qw(error warn notice info debug)) {
|
||||||
|
|
|
@ -24,7 +24,7 @@ sub new {
|
||||||
if ($show) {
|
if ($show) {
|
||||||
eval
|
eval
|
||||||
qq'sub $_ {\$_[0]->{raven}->capture_message(\$_[1],level => "$rl")}';
|
qq'sub $_ {\$_[0]->{raven}->capture_message(\$_[1],level => "$rl")}';
|
||||||
die $@ if($@);
|
die $@ if ($@);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
eval qq'sub $_ {1}';
|
eval qq'sub $_ {1}';
|
||||||
|
|
|
@ -48,7 +48,8 @@ sub run {
|
||||||
return $class->REDIRECT;
|
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)
|
## @rmethod protected hash getCDAInfos(id)
|
||||||
|
|
|
@ -235,7 +235,7 @@ sub sfa {
|
||||||
# Filter 2FA sessions if needed
|
# Filter 2FA sessions if needed
|
||||||
$self->logger->debug("Filtering 2F sessions...");
|
$self->logger->debug("Filtering 2F sessions...");
|
||||||
my $all = ( keys %$res );
|
my $all = ( keys %$res );
|
||||||
|
|
||||||
if ( $self->{U2FCheck} eq '2' ) {
|
if ( $self->{U2FCheck} eq '2' ) {
|
||||||
foreach my $session ( keys %$res ) {
|
foreach my $session ( keys %$res ) {
|
||||||
delete $res->{$session}
|
delete $res->{$session}
|
||||||
|
@ -262,7 +262,7 @@ sub sfa {
|
||||||
}
|
}
|
||||||
|
|
||||||
my $total = ( keys %$res );
|
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') ) {
|
if ( my $group = $req->params('groupBy') ) {
|
||||||
my $r;
|
my $r;
|
||||||
|
|
|
@ -20,59 +20,65 @@ sub register {
|
||||||
unshift @apps, $app;
|
unshift @apps, $app;
|
||||||
|
|
||||||
# register this guy (as well as saving original code) once
|
# register this guy (as well as saving original code) once
|
||||||
if (! scalar keys %orig) {
|
if ( !scalar keys %orig ) {
|
||||||
for my $proto (@protocols) {
|
for my $proto (@protocols) {
|
||||||
if (my $orig = LWP::Protocol::implementor($proto)) {
|
if ( my $orig = LWP::Protocol::implementor($proto) ) {
|
||||||
$orig{$proto} = $orig;
|
$orig{$proto} = $orig;
|
||||||
LWP::Protocol::implementor($proto, $class);
|
LWP::Protocol::implementor( $proto, $class );
|
||||||
} else {
|
}
|
||||||
Carp::carp("LWP::Protocol::$proto is unavailable. Skip registering overrides for it.") if $^W;
|
else {
|
||||||
|
Carp::carp(
|
||||||
|
"LWP::Protocol::$proto is unavailable. Skip registering overrides for it."
|
||||||
|
) if $^W;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (defined wantarray) {
|
if ( defined wantarray ) {
|
||||||
return LWP::Protocol::PSGI::Guard->new(sub {
|
return LWP::Protocol::PSGI::Guard->new(
|
||||||
$class->unregister_app($app);
|
sub {
|
||||||
});
|
$class->unregister_app($app);
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub unregister_app {
|
sub unregister_app {
|
||||||
my ($class, $app) = @_;
|
my ( $class, $app ) = @_;
|
||||||
|
|
||||||
my $i = 0;
|
my $i = 0;
|
||||||
foreach my $stored_app (@apps) {
|
foreach my $stored_app (@apps) {
|
||||||
if ($app == $stored_app) {
|
if ( $app == $stored_app ) {
|
||||||
splice @apps, $i, 1;
|
splice @apps, $i, 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sub unregister {
|
sub unregister {
|
||||||
my $class = shift;
|
my $class = shift;
|
||||||
for my $proto (@protocols) {
|
for my $proto (@protocols) {
|
||||||
if ($orig{$proto}) {
|
if ( $orig{$proto} ) {
|
||||||
LWP::Protocol::implementor($proto, $orig{$proto});
|
LWP::Protocol::implementor( $proto, $orig{$proto} );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@apps = ();
|
@apps = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
sub request {
|
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 $env = req_to_psgi $request;
|
||||||
my $response = res_from_psgi $app->app->($env);
|
my $response = res_from_psgi $app->app->($env);
|
||||||
my $content = $response->content;
|
my $content = $response->content;
|
||||||
$response->content('');
|
$response->content('');
|
||||||
$self->collect_once($arg, $response, $content);
|
$self->collect_once( $arg, $response, $content );
|
||||||
} else {
|
}
|
||||||
$orig{$self->{scheme}}->new($self->{scheme}, $self->{ua})->request($request, $proxy, $arg, @rest);
|
else {
|
||||||
|
$orig{ $self->{scheme} }->new( $self->{scheme}, $self->{ua} )
|
||||||
|
->request( $request, $proxy, $arg, @rest );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,21 +90,20 @@ sub create {
|
||||||
}
|
}
|
||||||
|
|
||||||
sub handles {
|
sub handles {
|
||||||
my($self, $request) = @_;
|
my ( $self, $request ) = @_;
|
||||||
|
|
||||||
foreach my $app (@apps) {
|
foreach my $app (@apps) {
|
||||||
if ($app->match($request)) {
|
if ( $app->match($request) ) {
|
||||||
return $app;
|
return $app;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
package
|
package LWP::Protocol::PSGI::Guard;
|
||||||
LWP::Protocol::PSGI::Guard;
|
|
||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my($class, $code) = @_;
|
my ( $class, $code ) = @_;
|
||||||
bless $code, $class;
|
bless $code, $class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,41 +112,47 @@ sub DESTROY {
|
||||||
$self->();
|
$self->();
|
||||||
}
|
}
|
||||||
|
|
||||||
package
|
package LWP::Protocol::PSGI::App;
|
||||||
LWP::Protocol::PSGI::App;
|
|
||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my ($class, $app, %options) = @_;
|
my ( $class, $app, %options ) = @_;
|
||||||
bless { app => $app, options => \%options }, $class;
|
bless { app => $app, options => \%options }, $class;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub app { $_[0]->{app} }
|
sub app { $_[0]->{app} }
|
||||||
sub options { $_[0]->{options} }
|
sub options { $_[0]->{options} }
|
||||||
|
|
||||||
sub match {
|
sub match {
|
||||||
my ($self, $request) = @_;
|
my ( $self, $request ) = @_;
|
||||||
my $options = $self->options;
|
my $options = $self->options;
|
||||||
|
|
||||||
if ($options->{host}) {
|
if ( $options->{host} ) {
|
||||||
my $matcher = $self->_matcher($options->{host});
|
my $matcher = $self->_matcher( $options->{host} );
|
||||||
$matcher->($request->uri->host) || $matcher->($request->uri->host_port);
|
$matcher->( $request->uri->host )
|
||||||
} elsif ($options->{uri}) {
|
|| $matcher->( $request->uri->host_port );
|
||||||
$self->_matcher($options->{uri})->($request->uri);
|
}
|
||||||
} else {
|
elsif ( $options->{uri} ) {
|
||||||
|
$self->_matcher( $options->{uri} )->( $request->uri );
|
||||||
|
}
|
||||||
|
else {
|
||||||
1;
|
1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub _matcher {
|
sub _matcher {
|
||||||
my($self, $stuff) = @_;
|
my ( $self, $stuff ) = @_;
|
||||||
if (ref $stuff eq 'Regexp') {
|
if ( ref $stuff eq 'Regexp' ) {
|
||||||
sub { $_[0] =~ $stuff };
|
sub { $_[0] =~ $stuff };
|
||||||
} elsif (ref $stuff eq 'CODE') {
|
}
|
||||||
|
elsif ( ref $stuff eq 'CODE' ) {
|
||||||
$stuff;
|
$stuff;
|
||||||
} elsif (!ref $stuff) {
|
}
|
||||||
|
elsif ( !ref $stuff ) {
|
||||||
sub { $_[0] eq $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 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -111,13 +111,13 @@ sub init {
|
||||||
# run() is called at each authentication, just after sessionInfo populated
|
# run() is called at each authentication, just after sessionInfo populated
|
||||||
sub run {
|
sub run {
|
||||||
my ( $self, $req ) = @_;
|
my ( $self, $req ) = @_;
|
||||||
|
|
||||||
my $checkLogins = $req->param('checkLogins');
|
my $checkLogins = $req->param('checkLogins');
|
||||||
$self->logger->debug("2F checkLogins set") if ($checkLogins);
|
$self->logger->debug("2F checkLogins set") if ($checkLogins);
|
||||||
|
|
||||||
# Skip 2F unless a module has been registered
|
# Skip 2F unless a module has been registered
|
||||||
return PE_OK unless ( @{ $self->sfModules } );
|
return PE_OK unless ( @{ $self->sfModules } );
|
||||||
|
|
||||||
# Search for authorized modules for this user
|
# Search for authorized modules for this user
|
||||||
my @am;
|
my @am;
|
||||||
foreach my $m ( @{ $self->sfModules } ) {
|
foreach my $m ( @{ $self->sfModules } ) {
|
||||||
|
@ -128,7 +128,7 @@ sub run {
|
||||||
push @am, $m->{m};
|
push @am, $m->{m};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# If no 2F module is authorized, skipping 2F
|
# If no 2F module is authorized, skipping 2F
|
||||||
# Note that a rule may forbid access after (GrantSession plugin)
|
# Note that a rule may forbid access after (GrantSession plugin)
|
||||||
return PE_OK unless (@am);
|
return PE_OK unless (@am);
|
||||||
|
|
|
@ -34,7 +34,7 @@ sub init {
|
||||||
|
|
||||||
sub run {
|
sub run {
|
||||||
my ( $self, $req, $token ) = @_;
|
my ( $self, $req, $token ) = @_;
|
||||||
|
|
||||||
my $checkLogins = $req->param('checkLogins');
|
my $checkLogins = $req->param('checkLogins');
|
||||||
$self->logger->debug("Ext2F checkLogins set") if ($checkLogins);
|
$self->logger->debug("Ext2F checkLogins set") if ($checkLogins);
|
||||||
|
|
||||||
|
@ -51,8 +51,8 @@ sub run {
|
||||||
$req,
|
$req,
|
||||||
'ext2fcheck',
|
'ext2fcheck',
|
||||||
params => {
|
params => {
|
||||||
SKIN => $self->conf->{portalSkin},
|
SKIN => $self->conf->{portalSkin},
|
||||||
TOKEN => $token,
|
TOKEN => $token,
|
||||||
CHECKLOGINS => $checkLogins
|
CHECKLOGINS => $checkLogins
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -55,7 +55,7 @@ sub init {
|
||||||
|
|
||||||
sub run {
|
sub run {
|
||||||
my ( $self, $req, $token ) = @_;
|
my ( $self, $req, $token ) = @_;
|
||||||
|
|
||||||
my $checkLogins = $req->param('checkLogins');
|
my $checkLogins = $req->param('checkLogins');
|
||||||
$self->logger->debug("REST2F checkLogins set") if ($checkLogins);
|
$self->logger->debug("REST2F checkLogins set") if ($checkLogins);
|
||||||
|
|
||||||
|
@ -89,9 +89,9 @@ sub run {
|
||||||
$req,
|
$req,
|
||||||
'ext2fcheck',
|
'ext2fcheck',
|
||||||
params => {
|
params => {
|
||||||
SKIN => $self->conf->{portalSkin},
|
SKIN => $self->conf->{portalSkin},
|
||||||
TOKEN => $token,
|
TOKEN => $token,
|
||||||
TARGET => '/rest2fcheck',
|
TARGET => '/rest2fcheck',
|
||||||
CHECKLOGINS => $checkLogins
|
CHECKLOGINS => $checkLogins
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -213,7 +213,8 @@ sub run {
|
||||||
}
|
}
|
||||||
my ( $err, $error ) = $self->loadUser($req);
|
my ( $err, $error ) = $self->loadUser($req);
|
||||||
if ( $err == -1 ) {
|
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 ) {
|
elsif ( $err == 0 ) {
|
||||||
return $self->p->sendError( $req, "noU2FKeyFound" );
|
return $self->p->sendError( $req, "noU2FKeyFound" );
|
||||||
|
@ -362,7 +363,7 @@ sub loadUser {
|
||||||
$uk = $_->{_userKey};
|
$uk = $_->{_userKey};
|
||||||
my $c = $self->crypter( keyHandle => $kh, publicKey => $uk );
|
my $c = $self->crypter( keyHandle => $kh, publicKey => $uk );
|
||||||
if ($c) {
|
if ($c) {
|
||||||
$self->logger->debug("kh & uk -> OK");
|
$self->logger->debug("kh & uk -> OK");
|
||||||
push @crypters, $c;
|
push @crypters, $c;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -44,7 +44,7 @@ sub init {
|
||||||
sub run {
|
sub run {
|
||||||
my ( $self, $req, $token ) = @_;
|
my ( $self, $req, $token ) = @_;
|
||||||
$self->logger->debug('Generate TOTP form');
|
$self->logger->debug('Generate TOTP form');
|
||||||
|
|
||||||
my $checkLogins = $req->param('checkLogins');
|
my $checkLogins = $req->param('checkLogins');
|
||||||
$self->logger->debug("TOTP checkLogins set") if ($checkLogins);
|
$self->logger->debug("TOTP checkLogins set") if ($checkLogins);
|
||||||
|
|
||||||
|
@ -53,8 +53,8 @@ sub run {
|
||||||
$req,
|
$req,
|
||||||
'totp2fcheck',
|
'totp2fcheck',
|
||||||
params => {
|
params => {
|
||||||
SKIN => $self->conf->{portalSkin},
|
SKIN => $self->conf->{portalSkin},
|
||||||
TOKEN => $token,
|
TOKEN => $token,
|
||||||
CHECKLOGINS => $checkLogins
|
CHECKLOGINS => $checkLogins
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -62,10 +62,10 @@ sub init {
|
||||||
|
|
||||||
sub run {
|
sub run {
|
||||||
my ( $self, $req, $token, $_2fDevices ) = @_;
|
my ( $self, $req, $token, $_2fDevices ) = @_;
|
||||||
|
|
||||||
my $checkLogins = $req->param('checkLogins');
|
my $checkLogins = $req->param('checkLogins');
|
||||||
$self->logger->debug("Yubikey checkLogins set") if ($checkLogins);
|
$self->logger->debug("Yubikey checkLogins set") if ($checkLogins);
|
||||||
|
|
||||||
my $yubikey = 0;
|
my $yubikey = 0;
|
||||||
if ( $req->{sessionInfo}->{_2fDevices} ) {
|
if ( $req->{sessionInfo}->{_2fDevices} ) {
|
||||||
$self->logger->debug("Loading 2F Devices ...");
|
$self->logger->debug("Loading 2F Devices ...");
|
||||||
|
@ -103,11 +103,11 @@ sub run {
|
||||||
$req,
|
$req,
|
||||||
'ext2fcheck',
|
'ext2fcheck',
|
||||||
params => {
|
params => {
|
||||||
SKIN => $self->conf->{portalSkin},
|
SKIN => $self->conf->{portalSkin},
|
||||||
TOKEN => $token,
|
TOKEN => $token,
|
||||||
TARGET => '/yubikey2fcheck',
|
TARGET => '/yubikey2fcheck',
|
||||||
INPUTLOGO => 'yubikey.png',
|
INPUTLOGO => 'yubikey.png',
|
||||||
LEGEND => 'clickOnYubikey',
|
LEGEND => 'clickOnYubikey',
|
||||||
CHECKLOGINS => $checkLogins
|
CHECKLOGINS => $checkLogins
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -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(
|
my $saml_ars_url = $self->getMetaDataURL(
|
||||||
"samlSPSSODescriptorArtifactResolutionServiceArtifact");
|
"samlSPSSODescriptorArtifactResolutionServiceArtifact");
|
||||||
$self->artRe(qr/^($saml_ars_url)(?:\?.*)?$/i);
|
$self->artRe(qr/^($saml_ars_url)(?:\?.*)?$/i);
|
||||||
$self->catch($self->sloAssConsumerRe);
|
$self->catch( $self->sloAssConsumerRe );
|
||||||
|
|
||||||
# Load SAML service and SAML IdP list
|
# Load SAML service and SAML IdP list
|
||||||
return ( $self->SUPER::init and $self->loadIDPs );
|
return ( $self->SUPER::init and $self->loadIDPs );
|
||||||
|
|
|
@ -94,14 +94,15 @@ sub params {
|
||||||
$req->param("tab") // '' )
|
$req->param("tab") // '' )
|
||||||
|| "applist";
|
|| "applist";
|
||||||
}
|
}
|
||||||
|
|
||||||
$res{DISPLAY_MODULES} = $self->displayModules($req);
|
$res{DISPLAY_MODULES} = $self->displayModules($req);
|
||||||
$res{AUTH_ERROR_TYPE} =
|
$res{AUTH_ERROR_TYPE} =
|
||||||
$req->error_type( $res{AUTH_ERROR} = $req->menuError );
|
$req->error_type( $res{AUTH_ERROR} = $req->menuError );
|
||||||
|
|
||||||
# Display menu 2fRegisters link only if at least a 2F device is registered
|
# Display menu 2fRegisters link only if at least a 2F device is registered
|
||||||
$res{SFAManagment} = $self->p->_sfEngine->display2fRegisters($req, $req->userData);
|
$res{SFAManagment} =
|
||||||
$self->logger->debug( "Display 2fRegisters link ? ". $res{SFAManagment} );
|
$self->p->_sfEngine->display2fRegisters( $req, $req->userData );
|
||||||
|
$self->logger->debug( "Display 2fRegisters link ? " . $res{SFAManagment} );
|
||||||
|
|
||||||
return %res;
|
return %res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ sub _redirect {
|
||||||
|
|
||||||
sub _verify {
|
sub _verify {
|
||||||
my ( $self, $req ) = @_;
|
my ( $self, $req ) = @_;
|
||||||
|
|
||||||
my $checkLogins = $req->param('checkLogins');
|
my $checkLogins = $req->param('checkLogins');
|
||||||
$self->logger->debug("checkLogins set") if ($checkLogins);
|
$self->logger->debug("checkLogins set") if ($checkLogins);
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ SKIP: {
|
||||||
ok( $issuer = issuer(), 'Issuer portal' );
|
ok( $issuer = issuer(), 'Issuer portal' );
|
||||||
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
switch ('sp');
|
switch ('sp');
|
||||||
&Lemonldap::NG::Handler::Main::cfgNum(0,0);
|
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
|
||||||
|
|
||||||
ok( $sp = sp(), 'SP portal' );
|
ok( $sp = sp(), 'SP portal' );
|
||||||
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
|
|
|
@ -51,7 +51,7 @@ SKIP: {
|
||||||
ok( $issuer = issuer(), 'Issuer portal' );
|
ok( $issuer = issuer(), 'Issuer portal' );
|
||||||
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
switch ('sp');
|
switch ('sp');
|
||||||
&Lemonldap::NG::Handler::Main::cfgNum(0,0);
|
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
|
||||||
|
|
||||||
ok( $sp = sp(), 'SP portal' );
|
ok( $sp = sp(), 'SP portal' );
|
||||||
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
|
|
|
@ -35,7 +35,7 @@ SKIP: {
|
||||||
ok( $issuer = issuer(), 'Issuer portal' );
|
ok( $issuer = issuer(), 'Issuer portal' );
|
||||||
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
switch ('sp');
|
switch ('sp');
|
||||||
&Lemonldap::NG::Handler::Main::cfgNum(0,0);
|
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
|
||||||
|
|
||||||
ok( $sp = sp(), 'SP portal' );
|
ok( $sp = sp(), 'SP portal' );
|
||||||
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
|
|
|
@ -35,7 +35,7 @@ SKIP: {
|
||||||
ok( $issuer = issuer(), 'Issuer portal' );
|
ok( $issuer = issuer(), 'Issuer portal' );
|
||||||
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
switch ('sp');
|
switch ('sp');
|
||||||
&Lemonldap::NG::Handler::Main::cfgNum(0,0);
|
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
|
||||||
|
|
||||||
ok( $sp = sp(), 'SP portal' );
|
ok( $sp = sp(), 'SP portal' );
|
||||||
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
|
|
|
@ -35,7 +35,7 @@ SKIP: {
|
||||||
ok( $issuer = issuer(), 'Issuer portal' );
|
ok( $issuer = issuer(), 'Issuer portal' );
|
||||||
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
switch ('sp');
|
switch ('sp');
|
||||||
&Lemonldap::NG::Handler::Main::cfgNum(0,0);
|
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
|
||||||
|
|
||||||
ok( $sp = sp(), 'SP portal' );
|
ok( $sp = sp(), 'SP portal' );
|
||||||
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
|
|
|
@ -35,7 +35,7 @@ SKIP: {
|
||||||
ok( $issuer = issuer(), 'Issuer portal' );
|
ok( $issuer = issuer(), 'Issuer portal' );
|
||||||
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
switch ('sp');
|
switch ('sp');
|
||||||
&Lemonldap::NG::Handler::Main::cfgNum(0,0);
|
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
|
||||||
|
|
||||||
ok( $sp = sp(), 'SP portal' );
|
ok( $sp = sp(), 'SP portal' );
|
||||||
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
|
|
|
@ -47,7 +47,7 @@ SKIP: {
|
||||||
ok( $issuer = issuer(), 'Issuer portal' );
|
ok( $issuer = issuer(), 'Issuer portal' );
|
||||||
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
switch ('sp');
|
switch ('sp');
|
||||||
&Lemonldap::NG::Handler::Main::cfgNum(0,0);
|
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
|
||||||
|
|
||||||
ok( $sp = sp(), 'SP portal' );
|
ok( $sp = sp(), 'SP portal' );
|
||||||
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
|
|
|
@ -35,7 +35,7 @@ SKIP: {
|
||||||
ok( $issuer = issuer(), 'Issuer portal' );
|
ok( $issuer = issuer(), 'Issuer portal' );
|
||||||
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
switch ('sp');
|
switch ('sp');
|
||||||
&Lemonldap::NG::Handler::Main::cfgNum(0,0);
|
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
|
||||||
|
|
||||||
ok( $sp = sp(), 'SP portal' );
|
ok( $sp = sp(), 'SP portal' );
|
||||||
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
|
|
|
@ -35,7 +35,7 @@ SKIP: {
|
||||||
ok( $issuer = issuer(), 'Issuer portal' );
|
ok( $issuer = issuer(), 'Issuer portal' );
|
||||||
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
switch ('sp');
|
switch ('sp');
|
||||||
&Lemonldap::NG::Handler::Main::cfgNum(0,0);
|
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
|
||||||
|
|
||||||
ok( $sp = sp(), 'SP portal' );
|
ok( $sp = sp(), 'SP portal' );
|
||||||
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
|
|
|
@ -58,7 +58,7 @@ ok( $issuer = issuer(), 'Issuer portal' );
|
||||||
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
count(1);
|
count(1);
|
||||||
switch ('sp');
|
switch ('sp');
|
||||||
&Lemonldap::NG::Handler::Main::cfgNum(0,0);
|
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
|
||||||
|
|
||||||
ok( $sp = sp(), 'SP portal' );
|
ok( $sp = sp(), 'SP portal' );
|
||||||
count(1);
|
count(1);
|
||||||
|
|
|
@ -56,7 +56,7 @@ ok( $issuer = issuer(), 'Issuer portal' );
|
||||||
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
count(1);
|
count(1);
|
||||||
switch ('sp');
|
switch ('sp');
|
||||||
&Lemonldap::NG::Handler::Main::cfgNum(0,0);
|
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
|
||||||
|
|
||||||
ok( $sp = sp(), 'SP portal' );
|
ok( $sp = sp(), 'SP portal' );
|
||||||
count(1);
|
count(1);
|
||||||
|
@ -256,14 +256,14 @@ sub sp {
|
||||||
casSrvMetaDataOptions => {
|
casSrvMetaDataOptions => {
|
||||||
idp => {
|
idp => {
|
||||||
casSrvMetaDataOptionsUrl => 'http://auth.idp.com/cas',
|
casSrvMetaDataOptionsUrl => 'http://auth.idp.com/cas',
|
||||||
casSrvMetaDataOptionsGateway => 0,
|
casSrvMetaDataOptionsGateway => 0,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
casSrvMetaDataOptionsProxiedServices => {
|
casSrvMetaDataOptionsProxiedServices => {
|
||||||
idp => {
|
idp => {
|
||||||
test => 'http://test.sp.com/',
|
test => 'http://test.sp.com/',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -75,7 +75,7 @@ SKIP: {
|
||||||
ok( $issuer = issuer(), 'Issuer portal' );
|
ok( $issuer = issuer(), 'Issuer portal' );
|
||||||
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
switch ('sp');
|
switch ('sp');
|
||||||
&Lemonldap::NG::Handler::Main::cfgNum(0,0);
|
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
|
||||||
|
|
||||||
# Build CAS app
|
# Build CAS app
|
||||||
ok( $sp = sp(), 'SP portal' );
|
ok( $sp = sp(), 'SP portal' );
|
||||||
|
|
|
@ -158,8 +158,7 @@ count(1);
|
||||||
# Verify UTF-8
|
# Verify UTF-8
|
||||||
ok(
|
ok(
|
||||||
$res = $op->_get(
|
$res = $op->_get(
|
||||||
'/oauth2/userinfo',
|
'/oauth2/userinfo', query => 'access_token=' . $access_token,
|
||||||
query => 'access_token=' . $access_token,
|
|
||||||
),
|
),
|
||||||
'Get userinfo'
|
'Get userinfo'
|
||||||
);
|
);
|
||||||
|
|
|
@ -52,7 +52,7 @@ SKIP: {
|
||||||
ok( $issuer = issuer(), 'Issuer portal' );
|
ok( $issuer = issuer(), 'Issuer portal' );
|
||||||
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
switch ('sp');
|
switch ('sp');
|
||||||
&Lemonldap::NG::Handler::Main::cfgNum(0,0);
|
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
|
||||||
|
|
||||||
ok( $sp = sp(), 'SP portal' );
|
ok( $sp = sp(), 'SP portal' );
|
||||||
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
|
|
|
@ -64,7 +64,7 @@ LWP::Protocol::PSGI->register(
|
||||||
ok( $issuer = issuer(), 'Issuer portal' );
|
ok( $issuer = issuer(), 'Issuer portal' );
|
||||||
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
switch ('sp');
|
switch ('sp');
|
||||||
&Lemonldap::NG::Handler::Main::cfgNum(0,0);
|
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
|
||||||
|
|
||||||
ok( $sp = sp(), 'SP portal' );
|
ok( $sp = sp(), 'SP portal' );
|
||||||
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
|
|
|
@ -57,7 +57,7 @@ SKIP: {
|
||||||
ok( $issuer = issuer(), 'Issuer portal' );
|
ok( $issuer = issuer(), 'Issuer portal' );
|
||||||
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
switch ('sp');
|
switch ('sp');
|
||||||
&Lemonldap::NG::Handler::Main::cfgNum(0,0);
|
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
|
||||||
|
|
||||||
ok( $sp = sp(), 'SP portal' );
|
ok( $sp = sp(), 'SP portal' );
|
||||||
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
|
|
|
@ -71,7 +71,7 @@ count(1);
|
||||||
expectOK($res);
|
expectOK($res);
|
||||||
|
|
||||||
switch ('sp');
|
switch ('sp');
|
||||||
&Lemonldap::NG::Handler::Main::cfgNum(0,0);
|
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
|
||||||
|
|
||||||
ok( $sp = sp(), 'SP portal' );
|
ok( $sp = sp(), 'SP portal' );
|
||||||
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
|
|
|
@ -64,7 +64,7 @@ LWP::Protocol::PSGI->register(
|
||||||
ok( $issuer = issuer(), 'Issuer portal' );
|
ok( $issuer = issuer(), 'Issuer portal' );
|
||||||
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
switch ('sp');
|
switch ('sp');
|
||||||
&Lemonldap::NG::Handler::Main::cfgNum(0,0);
|
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
|
||||||
|
|
||||||
ok( $sp = sp(), 'SP portal' );
|
ok( $sp = sp(), 'SP portal' );
|
||||||
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
|
|
|
@ -68,7 +68,7 @@ SKIP: {
|
||||||
|
|
||||||
# Test SP access
|
# Test SP access
|
||||||
switch ('sp');
|
switch ('sp');
|
||||||
&Lemonldap::NG::Handler::Main::cfgNum(0,0);
|
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
|
||||||
|
|
||||||
ok( $sp = sp(), 'SP portal' );
|
ok( $sp = sp(), 'SP portal' );
|
||||||
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
|
|
|
@ -55,7 +55,7 @@ SKIP: {
|
||||||
ok( $issuer = issuer(), 'Issuer portal' );
|
ok( $issuer = issuer(), 'Issuer portal' );
|
||||||
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
switch ('sp');
|
switch ('sp');
|
||||||
&Lemonldap::NG::Handler::Main::cfgNum(0,0);
|
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
|
||||||
|
|
||||||
ok( $sp = sp(), 'SP portal' );
|
ok( $sp = sp(), 'SP portal' );
|
||||||
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
|
|
|
@ -96,7 +96,7 @@ SKIP: {
|
||||||
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
|
|
||||||
switch ('rp');
|
switch ('rp');
|
||||||
&Lemonldap::NG::Handler::Main::cfgNum(0,0);
|
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
|
||||||
ok( $rp = rp( $jwks, $metadata ), 'RP portal' );
|
ok( $rp = rp( $jwks, $metadata ), 'RP portal' );
|
||||||
$handlerOR{rp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{rp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ SKIP: {
|
||||||
$handlerOR{idp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{idp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
|
|
||||||
switch ('sp');
|
switch ('sp');
|
||||||
&Lemonldap::NG::Handler::Main::cfgNum(0,0);
|
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
|
||||||
ok( $sp = sp(), 'Proxy portal' );
|
ok( $sp = sp(), 'Proxy portal' );
|
||||||
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ SKIP: {
|
||||||
$handlerOR{idp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{idp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
|
|
||||||
switch ('sp');
|
switch ('sp');
|
||||||
&Lemonldap::NG::Handler::Main::cfgNum(0,0);
|
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
|
||||||
ok( $sp = sp(), 'Proxy portal' );
|
ok( $sp = sp(), 'Proxy portal' );
|
||||||
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ SKIP: {
|
||||||
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
|
|
||||||
switch ('proxy');
|
switch ('proxy');
|
||||||
&Lemonldap::NG::Handler::Main::cfgNum(0,0);
|
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
|
||||||
ok( $proxy = proxy( $jwks, $metadata ), 'Proxy portal' );
|
ok( $proxy = proxy( $jwks, $metadata ), 'Proxy portal' );
|
||||||
$handlerOR{proxy} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{proxy} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ SKIP: {
|
||||||
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
|
|
||||||
switch ('proxy');
|
switch ('proxy');
|
||||||
&Lemonldap::NG::Handler::Main::cfgNum(0,0);
|
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
|
||||||
ok( $proxy = proxy( $jwks, $metadata ), 'Proxy portal' );
|
ok( $proxy = proxy( $jwks, $metadata ), 'Proxy portal' );
|
||||||
$handlerOR{proxy} = \@Lemonldap::NG::Handler::Main::_onReload;
|
$handlerOR{proxy} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ use_ok('Lemonldap::NG::Common::PSGI::Cli::Lib');
|
||||||
count(2);
|
count(2);
|
||||||
|
|
||||||
my ( $cli, $app );
|
my ( $cli, $app );
|
||||||
switch('app');
|
switch ('app');
|
||||||
ok( $app = Lemonldap::NG::Handler::Server->run( $client->ini ), 'App' );
|
ok( $app = Lemonldap::NG::Handler::Server->run( $client->ini ), 'App' );
|
||||||
count(1);
|
count(1);
|
||||||
|
|
||||||
|
|
|
@ -20,9 +20,10 @@ my $client;
|
||||||
LWP::Protocol::PSGI->register(
|
LWP::Protocol::PSGI->register(
|
||||||
sub {
|
sub {
|
||||||
my $req = Plack::Request->new(@_);
|
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);
|
count(1);
|
||||||
my $url = $1;
|
my $url = $1;
|
||||||
my $query = $2;
|
my $query = $2;
|
||||||
my $res;
|
my $res;
|
||||||
switch ('portal');
|
switch ('portal');
|
||||||
|
@ -31,10 +32,10 @@ LWP::Protocol::PSGI->register(
|
||||||
my $s = $req->content;
|
my $s = $req->content;
|
||||||
ok(
|
ok(
|
||||||
$res = $client->$mth(
|
$res = $client->$mth(
|
||||||
$url,
|
$url,
|
||||||
IO::String->new($s),
|
IO::String->new($s),
|
||||||
length => length($s),
|
length => length($s),
|
||||||
type => $req->header('Content-Type'),
|
type => $req->header('Content-Type'),
|
||||||
),
|
),
|
||||||
' Post request'
|
' Post request'
|
||||||
);
|
);
|
||||||
|
@ -45,10 +46,10 @@ LWP::Protocol::PSGI->register(
|
||||||
my $mth = '_' . lc($1);
|
my $mth = '_' . lc($1);
|
||||||
ok(
|
ok(
|
||||||
$res = $client->$mth(
|
$res = $client->$mth(
|
||||||
$url,
|
$url,
|
||||||
accept => $req->header('Accept'),
|
accept => $req->header('Accept'),
|
||||||
cookie => $req->header('Cookie'),
|
cookie => $req->header('Cookie'),
|
||||||
query => $query,
|
query => $query,
|
||||||
),
|
),
|
||||||
' Execute request'
|
' Execute request'
|
||||||
);
|
);
|
||||||
|
@ -64,120 +65,118 @@ LWP::Protocol::PSGI->register(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
$client = LLNG::Manager::Test->new(
|
$client = LLNG::Manager::Test->new(
|
||||||
{
|
{
|
||||||
ini => {
|
ini => {
|
||||||
logLevel => $debug,
|
logLevel => $debug,
|
||||||
useSafeJail => 1,
|
useSafeJail => 1,
|
||||||
cda => 1,
|
cda => 1,
|
||||||
restSessionServer => 1,
|
restSessionServer => 1,
|
||||||
logger => 'Lemonldap::NG::Common::Logger::Std',
|
logger => 'Lemonldap::NG::Common::Logger::Std',
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
}
|
||||||
$handlerOR{portal} = \@Lemonldap::NG::Handler::Main::_onReload;
|
);
|
||||||
|
$handlerOR{portal} = \@Lemonldap::NG::Handler::Main::_onReload;
|
||||||
|
|
||||||
# CDA with unauthentified user
|
# CDA with unauthentified user
|
||||||
ok(
|
ok(
|
||||||
$res = $client->_get(
|
$res = $client->_get(
|
||||||
'/',
|
'/',
|
||||||
query => 'url=aHR0cDovL3Rlc3QuZXhhbXBsZS5vcmcv',
|
query => 'url=aHR0cDovL3Rlc3QuZXhhbXBsZS5vcmcv',
|
||||||
accept => 'text/html',
|
accept => 'text/html',
|
||||||
),
|
),
|
||||||
'Unauth CDA request'
|
'Unauth CDA request'
|
||||||
);
|
);
|
||||||
my ( $host, $url, $query ) = expectForm( $res, undef, undef, 'url' );
|
my ( $host, $url, $query ) = expectForm( $res, undef, undef, 'url' );
|
||||||
ok( $query =~ /\burl=aHR0cDovL3Rlc3QuZXhhbXBsZS5vcmcv\b/,
|
ok( $query =~ /\burl=aHR0cDovL3Rlc3QuZXhhbXBsZS5vcmcv\b/, ' check url value' );
|
||||||
' check url value' );
|
|
||||||
|
|
||||||
# Authentification
|
# Authentification
|
||||||
$query .= '&user=dwho&password=dwho';
|
$query .= '&user=dwho&password=dwho';
|
||||||
ok(
|
ok(
|
||||||
$res = $client->_post(
|
$res = $client->_post(
|
||||||
'/' => IO::String->new($query),
|
'/' => IO::String->new($query),
|
||||||
length => length($query),
|
length => length($query),
|
||||||
accept => 'text/html',
|
accept => 'text/html',
|
||||||
),
|
),
|
||||||
'Post credentials'
|
'Post credentials'
|
||||||
);
|
);
|
||||||
|
|
||||||
($query) =
|
($query) =
|
||||||
expectRedirection( $res,
|
expectRedirection( $res, qr#^http://test.example.org/\?(lemonldapcda=.*)$# );
|
||||||
qr#^http://test.example.org/\?(lemonldapcda=.*)$# );
|
|
||||||
|
|
||||||
# Handler part
|
# Handler part
|
||||||
use_ok('Lemonldap::NG::Handler::Server');
|
use_ok('Lemonldap::NG::Handler::Server');
|
||||||
use_ok('Lemonldap::NG::Common::PSGI::Cli::Lib');
|
use_ok('Lemonldap::NG::Common::PSGI::Cli::Lib');
|
||||||
|
|
||||||
my ( $cli, $app );
|
my ( $cli, $app );
|
||||||
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
|
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
|
||||||
switch ('app');
|
switch ('app');
|
||||||
ok(
|
ok(
|
||||||
$app = Lemonldap::NG::Handler::Server->run(
|
$app = Lemonldap::NG::Handler::Server->run(
|
||||||
{
|
{
|
||||||
%{ $client->ini },
|
%{ $client->ini },
|
||||||
globalStorage => 'Lemonldap::NG::Common::Apache::Session::REST',
|
globalStorage => 'Lemonldap::NG::Common::Apache::Session::REST',
|
||||||
globalStorageOptions =>
|
globalStorageOptions =>
|
||||||
{ baseUrl => 'http://auth.example.com/sessions/global/' },
|
{ baseUrl => 'http://auth.example.com/sessions/global/' },
|
||||||
localSessionStorage => undef,
|
localSessionStorage => undef,
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
'App'
|
'App'
|
||||||
);
|
);
|
||||||
|
|
||||||
ok(
|
ok(
|
||||||
$res = $app->(
|
$res = $app->(
|
||||||
{
|
{
|
||||||
'HTTP_ACCEPT' => 'text/html',
|
'HTTP_ACCEPT' => 'text/html',
|
||||||
'SCRIPT_NAME' => '/',
|
'SCRIPT_NAME' => '/',
|
||||||
'SERVER_NAME' => '127.0.0.1',
|
'SERVER_NAME' => '127.0.0.1',
|
||||||
'QUERY_STRING' => $query,
|
'QUERY_STRING' => $query,
|
||||||
'HTTP_CACHE_CONTROL' => 'max-age=0',
|
'HTTP_CACHE_CONTROL' => 'max-age=0',
|
||||||
'HTTP_ACCEPT_LANGUAGE' => 'fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3',
|
'HTTP_ACCEPT_LANGUAGE' => 'fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||||
'PATH_INFO' => '/',
|
'PATH_INFO' => '/',
|
||||||
'REQUEST_METHOD' => 'GET',
|
'REQUEST_METHOD' => 'GET',
|
||||||
'REQUEST_URI' => "/?$query",
|
'REQUEST_URI' => "/?$query",
|
||||||
'X_ORIGINAL_URI' => "/?$query",
|
'X_ORIGINAL_URI' => "/?$query",
|
||||||
'SERVER_PORT' => '80',
|
'SERVER_PORT' => '80',
|
||||||
'SERVER_PROTOCOL' => 'HTTP/1.1',
|
'SERVER_PROTOCOL' => 'HTTP/1.1',
|
||||||
'HTTP_USER_AGENT' =>
|
'HTTP_USER_AGENT' =>
|
||||||
'Mozilla/5.0 (VAX-4000; rv:36.0) Gecko/20350101 Firefox',
|
'Mozilla/5.0 (VAX-4000; rv:36.0) Gecko/20350101 Firefox',
|
||||||
'REMOTE_ADDR' => '127.0.0.1',
|
'REMOTE_ADDR' => '127.0.0.1',
|
||||||
'HTTP_HOST' => 'test.example.org',
|
'HTTP_HOST' => 'test.example.org',
|
||||||
'VHOSTTYPE' => 'CDA',
|
'VHOSTTYPE' => 'CDA',
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
'Push cda cookie'
|
'Push cda cookie'
|
||||||
);
|
);
|
||||||
expectRedirection( $res, 'http://test.example.org/' );
|
expectRedirection( $res, 'http://test.example.org/' );
|
||||||
my $cid = expectCookie($res);
|
my $cid = expectCookie($res);
|
||||||
|
|
||||||
ok(
|
ok(
|
||||||
$res = $app->(
|
$res = $app->(
|
||||||
{
|
{
|
||||||
'HTTP_ACCEPT' => 'text/html',
|
'HTTP_ACCEPT' => 'text/html',
|
||||||
'SCRIPT_NAME' => '/',
|
'SCRIPT_NAME' => '/',
|
||||||
'SERVER_NAME' => '127.0.0.1',
|
'SERVER_NAME' => '127.0.0.1',
|
||||||
'HTTP_COOKIE' => "lemonldap=$cid",
|
'HTTP_COOKIE' => "lemonldap=$cid",
|
||||||
'HTTP_CACHE_CONTROL' => 'max-age=0',
|
'HTTP_CACHE_CONTROL' => 'max-age=0',
|
||||||
'HTTP_ACCEPT_LANGUAGE' => 'fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3',
|
'HTTP_ACCEPT_LANGUAGE' => 'fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3',
|
||||||
'PATH_INFO' => '/',
|
'PATH_INFO' => '/',
|
||||||
'REQUEST_METHOD' => 'GET',
|
'REQUEST_METHOD' => 'GET',
|
||||||
'REQUEST_URI' => "/",
|
'REQUEST_URI' => "/",
|
||||||
'X_ORIGINAL_URI' => "/",
|
'X_ORIGINAL_URI' => "/",
|
||||||
'SERVER_PORT' => '80',
|
'SERVER_PORT' => '80',
|
||||||
'SERVER_PROTOCOL' => 'HTTP/1.1',
|
'SERVER_PROTOCOL' => 'HTTP/1.1',
|
||||||
'HTTP_USER_AGENT' =>
|
'HTTP_USER_AGENT' =>
|
||||||
'Mozilla/5.0 (VAX-4000; rv:36.0) Gecko/20350101 Firefox',
|
'Mozilla/5.0 (VAX-4000; rv:36.0) Gecko/20350101 Firefox',
|
||||||
'REMOTE_ADDR' => '127.0.0.1',
|
'REMOTE_ADDR' => '127.0.0.1',
|
||||||
'HTTP_HOST' => 'test.example.org',
|
'HTTP_HOST' => 'test.example.org',
|
||||||
'VHOSTTYPE' => 'CDA',
|
'VHOSTTYPE' => 'CDA',
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
'Authenticated query'
|
'Authenticated query'
|
||||||
);
|
);
|
||||||
expectOK($res);
|
expectOK($res);
|
||||||
expectAuthenticatedAs( $res, 'dwho' );
|
expectAuthenticatedAs( $res, 'dwho' );
|
||||||
|
|
||||||
clean_sessions();
|
clean_sessions();
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ use_ok('Lemonldap::NG::Common::PSGI::Cli::Lib');
|
||||||
count(2);
|
count(2);
|
||||||
|
|
||||||
my ( $cli, $app );
|
my ( $cli, $app );
|
||||||
switch('app');
|
switch ('app');
|
||||||
ok( $app = Lemonldap::NG::Handler::Server->run( $client->ini ), 'App' );
|
ok( $app = Lemonldap::NG::Handler::Server->run( $client->ini ), 'App' );
|
||||||
count(1);
|
count(1);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue