Fix warnings

This commit is contained in:
Christophe Maudoux 2021-07-28 12:10:55 +02:00
parent b2f3d00127
commit 4d2dfe4abc
5 changed files with 11 additions and 16 deletions

View File

@ -134,7 +134,7 @@ sub _register {
if ( $req->data->{register_token} ) {
$self->logger->debug(
"Token given for register: " . $req->data->{register_token} );
"Token provided for register: " . $req->data->{register_token} );
# Get the corresponding session
if ( my $data =

View File

@ -11,7 +11,8 @@ BEGIN {
require 't/saml-lib.pm';
}
my $debug = 'error';
my $debug = 'error';
my $maintests = 132;
my ( $issuer, $sp, $res );
# Redefine LWP methods for tests
@ -19,7 +20,6 @@ LWP::Protocol::PSGI->register(
sub {
my $req = Plack::Request->new(@_);
fail('POST should not launch SOAP requests');
count(1);
return [ 500, [], [] ];
}
);
@ -41,7 +41,6 @@ sub runTest {
),
'Unauth SP request'
);
count(1);
expectOK($res);
my ( $host, $url, $s ) =
@ -64,7 +63,6 @@ sub runTest {
),
'Post SAML request to IdP'
);
count(1);
expectOK($res);
my $pdata = 'lemonldappdata=' . expectCookie( $res, 'lemonldappdata' );
@ -80,20 +78,18 @@ sub runTest {
),
'Post authentication'
);
count(1);
my $idpId = expectCookie($res);
# Expect pdata to be cleared
$pdata = expectCookie( $res, 'lemonldappdata' );
ok( $pdata !~ 'issuerRequestsaml', 'SAML request cleared from pdata' )
or explain( $pdata, 'not issuerRequestsaml' );
count(1);
( $host, $url, $s ) =
expectAutoPost( $res, 'auth.sp.com', '/saml/proxySingleSignOnPost',
'SAMLResponse' );
my ($sr) = expectSamlResponse($s);
$sr = expectSamlResponse($s);
expectXPath(
$sr, '/samlp:Response/saml:Assertion/saml:Subject/saml:NameID/@Format',
$expect_res_nif, 'Found expected NameID Format in response',
@ -114,7 +110,7 @@ sub runTest {
SKIP: {
eval "use Lasso";
if ($@) {
skip 'Lasso not found';
skip( 'Lasso not found', $maintests );
}
# Default settings use the email NIF
@ -221,9 +217,9 @@ SKIP: {
);
}
count($maintests);
clean_sessions();
done_testing();
done_testing( count() );
sub issuer {
my ( $res_nif, $force_attr ) = @_;

View File

@ -120,7 +120,7 @@ is( ref( $payload->{email} ),
is( ref( $payload->{nickname} ),
"ARRAY", "Multi valued attribute exposed as array" );
my $query = "token=$access_token";
$query = "token=$access_token";
ok(
$res = $op->_post(
"/oauth2/introspect",

View File

@ -26,7 +26,7 @@ SKIP: {
authentication => 'Demo',
userDB => 'Same',
registerDB => 'Demo',
registerTimeout => '3600',
#registerTimeout => '600',
registerConfirmSubject => 'Registration demonstration',
registerConfirmBody =>
'Hello $firstname $lastname, follows this link to register your account $url
@ -73,7 +73,7 @@ Go to Portal $url',
m#Hello Fôo Bà Bar, follows this link to register your account http://auth\.example\.com/register#s,
'Found custom body'
) or explain( $mail, 'Custom body (link)' );
ok( $mail =~ /[?&](register_token=.+)[$&]/s, 'Found register_token' );
ok( $mail =~ /[?&](register_token=\w+)[$&]/s, 'Found register_token' );
$query = $1;
ok( $mail =~ /Fôo/, 'UTF-8 works' ) or explain( $mail, 'Fôo' );
ok( $mail =~ m#Expired time: \d{2}/\d{2}/\d{4} \d{2}:\d{2}#s, 'Found time' )

View File

@ -383,7 +383,7 @@ JjTJecOOS+88fK8qL1TrYv5rapIdqUI7aQ==
ok( $code = Lemonldap::NG::Common::TOTP::_code( undef, $key, 0, 30, 6 ),
'Code' );
ok( $code =~ /^\d{6}$/, 'Code contains 6 digits' );
my $s = "code=$code&token=$token&TOTPName=myTOTP";
$s = "code=$code&token=$token&TOTPName=myTOTP";
my $epoch = time();
ok(
$res = $client->_post(
@ -411,7 +411,6 @@ JjTJecOOS+88fK8qL1TrYv5rapIdqUI7aQ==
ok( $res->[2]->[0] =~ /<span id="msg" trspan="choose2f">/,
'Found choose 2F' )
or print STDERR Dumper( $res->[2]->[0] );
my $devices;
ok(
$devices = $res->[2]->[0] =~ s%<span device=\'TOTP\' epoch=\'\d{10}\'%%g,
'2F device found'