2018-10-23 23:39:28 +02:00
|
|
|
use Test::More;
|
|
|
|
use strict;
|
|
|
|
use IO::String;
|
|
|
|
use Data::Dumper;
|
|
|
|
|
|
|
|
BEGIN {
|
|
|
|
require 't/test-lib.pm';
|
|
|
|
}
|
|
|
|
|
|
|
|
my $res;
|
|
|
|
|
2019-02-07 09:27:56 +01:00
|
|
|
my $client = LLNG::Manager::Test->new( {
|
2018-10-23 23:39:28 +02:00
|
|
|
ini => {
|
2018-11-26 14:40:21 +01:00
|
|
|
logLevel => 'error',
|
|
|
|
authentication => 'Demo',
|
|
|
|
userdb => 'Same',
|
2019-11-04 14:54:41 +01:00
|
|
|
timeout => 72000,
|
2018-11-26 14:40:21 +01:00
|
|
|
handlerInternalCache => 1,
|
2018-10-23 23:39:28 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
ok(
|
|
|
|
$res = $client->_post(
|
|
|
|
'/',
|
|
|
|
IO::String->new('user=dwho&password=dwho'),
|
|
|
|
length => 23
|
|
|
|
),
|
|
|
|
'Auth query'
|
|
|
|
);
|
|
|
|
expectOK($res);
|
|
|
|
my $id1 = expectCookie($res);
|
|
|
|
count(1);
|
|
|
|
|
2019-11-04 14:54:41 +01:00
|
|
|
# Skip ahead in time before session timeout
|
|
|
|
Time::Fake->offset("+5h");
|
2018-10-23 23:39:28 +02:00
|
|
|
|
|
|
|
ok(
|
|
|
|
$res = $client->_get(
|
|
|
|
'/',
|
|
|
|
cookie => "lemonldap=$id1",
|
|
|
|
accept => 'text/html',
|
|
|
|
),
|
|
|
|
'Go to Portal'
|
|
|
|
);
|
|
|
|
ok( $res->[2]->[0] =~ qr%<span trspan="yourApps">Your applications</span>%,
|
|
|
|
'Found applications list' )
|
|
|
|
or print STDERR Dumper( $res->[2]->[0] );
|
|
|
|
count(2);
|
|
|
|
|
2019-11-04 14:54:41 +01:00
|
|
|
# Skip ahead in time after session timeout
|
|
|
|
Time::Fake->offset("+25h");
|
2018-10-23 23:39:28 +02:00
|
|
|
|
|
|
|
ok(
|
|
|
|
$res = $client->_get(
|
|
|
|
'/',
|
|
|
|
cookie => "lemonldap=$id1",
|
|
|
|
accept => 'text/html',
|
|
|
|
),
|
|
|
|
'Form Authentification'
|
|
|
|
);
|
2018-11-26 14:40:21 +01:00
|
|
|
ok(
|
|
|
|
$res->[2]->[0] =~
|
2020-05-23 23:52:09 +02:00
|
|
|
m%<div class="message message-warning alert"><span trmsg="1">%,
|
2018-11-26 14:40:21 +01:00
|
|
|
'Found PE_SESSIONEXPIRED code'
|
|
|
|
) or print STDERR Dumper( $res->[2]->[0] );
|
2018-10-23 23:39:28 +02:00
|
|
|
count(2);
|
|
|
|
|
|
|
|
$client->logout($id1);
|
|
|
|
clean_sessions();
|
|
|
|
|
|
|
|
done_testing( count() );
|