|
|
|
@ -8,16 +8,16 @@ BEGIN { |
|
|
|
|
|
|
|
|
|
my $res; |
|
|
|
|
|
|
|
|
|
my $client = LLNG::Manager::Test->new( |
|
|
|
|
{ ini => { |
|
|
|
|
logLevel => 'error', |
|
|
|
|
authentication => 'Demo', |
|
|
|
|
userDB => 'Same', |
|
|
|
|
loginHistoryEnabled => 0, |
|
|
|
|
brutForceProtection => 0, |
|
|
|
|
portalMainLogo => 'common/logos/logo_llng_old.png', |
|
|
|
|
checkUser => 1, |
|
|
|
|
requireToken => 0, |
|
|
|
|
my $client = LLNG::Manager::Test->new( { |
|
|
|
|
ini => { |
|
|
|
|
logLevel => 'error', |
|
|
|
|
authentication => 'Demo', |
|
|
|
|
userDB => 'Same', |
|
|
|
|
loginHistoryEnabled => 0, |
|
|
|
|
brutForceProtection => 0, |
|
|
|
|
portalMainLogo => 'common/logos/logo_llng_old.png', |
|
|
|
|
checkUser => 1, |
|
|
|
|
requireToken => 0, |
|
|
|
|
checkUserDisplayPersistentInfo => 1, |
|
|
|
|
checkUserDisplayEmptyValues => 1, |
|
|
|
|
} |
|
|
|
@ -25,7 +25,8 @@ my $client = LLNG::Manager::Test->new( |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
## Try to authenticate |
|
|
|
|
ok( $res = $client->_post( |
|
|
|
|
ok( |
|
|
|
|
$res = $client->_post( |
|
|
|
|
'/', |
|
|
|
|
IO::String->new('user=rtyler&password=rtyler'), |
|
|
|
|
length => 27, |
|
|
|
@ -38,7 +39,8 @@ count(1); |
|
|
|
|
my $id = expectCookie($res); |
|
|
|
|
expectRedirection( $res, 'http://auth.example.com/' ); |
|
|
|
|
|
|
|
|
|
ok( $res = $client->_get( |
|
|
|
|
ok( |
|
|
|
|
$res = $client->_get( |
|
|
|
|
'/checkuser', |
|
|
|
|
cookie => "lemonldap=$id", |
|
|
|
|
accept => 'text/html' |
|
|
|
@ -47,17 +49,16 @@ ok( $res = $client->_get( |
|
|
|
|
); |
|
|
|
|
count(1); |
|
|
|
|
|
|
|
|
|
ok( $res->[2]->[0] =~ m%<img src="/static/common/logos/logo_llng_old.png"%, |
|
|
|
|
'Found custom Main Logo' ) |
|
|
|
|
or explain( $res->[2]->[0], 'custom Main logo not found"' ); |
|
|
|
|
ok( $res->[2]->[0] =~ m%<span trspan="accessDenied">%, |
|
|
|
|
'Found trspan="accessDenied"' ) |
|
|
|
|
or explain( $res->[2]->[0], 'trspan="accessDenied"' ); |
|
|
|
|
count(2); |
|
|
|
|
ok( $res->[2]->[0] =~ m%An error occurs, you're going to be redirected to%, |
|
|
|
|
'Found redirection page' ) |
|
|
|
|
or explain( $res->[2]->[0], |
|
|
|
|
"An error occurs, you're going to be redirected to" ); |
|
|
|
|
count(1); |
|
|
|
|
$client->logout($id); |
|
|
|
|
|
|
|
|
|
## Try to authenticate |
|
|
|
|
ok( $res = $client->_post( |
|
|
|
|
ok( |
|
|
|
|
$res = $client->_post( |
|
|
|
|
'/', |
|
|
|
|
IO::String->new('user=dwho&password=dwho'), |
|
|
|
|
length => 23, |
|
|
|
@ -72,7 +73,8 @@ expectRedirection( $res, 'http://auth.example.com/' ); |
|
|
|
|
|
|
|
|
|
# CheckUser form -> granted |
|
|
|
|
# ------------------------ |
|
|
|
|
ok( $res = $client->_get( |
|
|
|
|
ok( |
|
|
|
|
$res = $client->_get( |
|
|
|
|
'/checkuser', |
|
|
|
|
cookie => "lemonldap=$id", |
|
|
|
|
accept => 'text/html' |
|
|
|
@ -82,16 +84,16 @@ ok( $res = $client->_get( |
|
|
|
|
count(1); |
|
|
|
|
|
|
|
|
|
# Request with bad VH |
|
|
|
|
my ( $host, $url, $query ) |
|
|
|
|
= expectForm( $res, undef, '/checkuser', 'user', 'url' ); |
|
|
|
|
ok( $res->[2]->[0] =~ m%<span trspan="checkUser">%, |
|
|
|
|
'Found trspan="checkUser"' ) |
|
|
|
|
or explain( $res->[2]->[0], 'trspan="checkUser"' ); |
|
|
|
|
my ( $host, $url, $query ) = |
|
|
|
|
expectForm( $res, undef, '/checkuser', 'user', 'url' ); |
|
|
|
|
ok( $res->[2]->[0] =~ m%<span trspan="checkUser">%, 'Found trspan="checkUser"' ) |
|
|
|
|
or explain( $res->[2]->[0], 'trspan="checkUser"' ); |
|
|
|
|
count(1); |
|
|
|
|
|
|
|
|
|
$query =~ s/user=dwho/user=rtyler/; |
|
|
|
|
$query =~ s/url=/url=http%3A%2F%2Ftry.example.com/; |
|
|
|
|
ok( $res = $client->_post( |
|
|
|
|
ok( |
|
|
|
|
$res = $client->_post( |
|
|
|
|
'/checkuser', |
|
|
|
|
IO::String->new($query), |
|
|
|
|
cookie => "lemonldap=$id", |
|
|
|
@ -102,22 +104,23 @@ ok( $res = $client->_post( |
|
|
|
|
); |
|
|
|
|
count(1); |
|
|
|
|
|
|
|
|
|
( $host, $url, $query ) |
|
|
|
|
= expectForm( $res, undef, '/checkuser', 'user', 'url' ); |
|
|
|
|
( $host, $url, $query ) = |
|
|
|
|
expectForm( $res, undef, '/checkuser', 'user', 'url' ); |
|
|
|
|
ok( $res->[2]->[0] =~ m%<span trspan="VHnotFound">%, |
|
|
|
|
'Found trspan="VHnotFound"' ) |
|
|
|
|
or explain( $res->[2]->[0], 'trspan="VHnotFound"' ); |
|
|
|
|
or explain( $res->[2]->[0], 'trspan="VHnotFound"' ); |
|
|
|
|
count(1); |
|
|
|
|
|
|
|
|
|
( $host, $url, $query ) |
|
|
|
|
= expectForm( $res, undef, '/checkuser', 'user', 'url' ); |
|
|
|
|
ok( $res->[2]->[0] =~ m%<span trspan="checkUser">%, |
|
|
|
|
'Found trspan="checkUser"' ) |
|
|
|
|
or explain( $res->[2]->[0], 'trspan="checkUser"' ); |
|
|
|
|
( $host, $url, $query ) = |
|
|
|
|
expectForm( $res, undef, '/checkuser', 'user', 'url' ); |
|
|
|
|
ok( $res->[2]->[0] =~ m%<span trspan="checkUser">%, 'Found trspan="checkUser"' ) |
|
|
|
|
or explain( $res->[2]->[0], 'trspan="checkUser"' ); |
|
|
|
|
count(1); |
|
|
|
|
|
|
|
|
|
$query =~ s/url=http%3A%2F%2Ftry.example.com/url=http%3A%2F%2Ftest1.example.com/; |
|
|
|
|
ok( $res = $client->_post( |
|
|
|
|
$query =~ |
|
|
|
|
s/url=http%3A%2F%2Ftry.example.com/url=http%3A%2F%2Ftest1.example.com/; |
|
|
|
|
ok( |
|
|
|
|
$res = $client->_post( |
|
|
|
|
'/checkuser', |
|
|
|
|
IO::String->new($query), |
|
|
|
|
cookie => "lemonldap=$id", |
|
|
|
@ -128,49 +131,48 @@ ok( $res = $client->_post( |
|
|
|
|
); |
|
|
|
|
count(1); |
|
|
|
|
|
|
|
|
|
( $host, $url, $query ) |
|
|
|
|
= expectForm( $res, undef, '/checkuser', 'user', 'url' ); |
|
|
|
|
ok( $res->[2]->[0] =~ m%<span trspan="checkUser">%, |
|
|
|
|
'Found trspan="checkUser"' ) |
|
|
|
|
or explain( $res->[2]->[0], 'trspan="checkUser"' ); |
|
|
|
|
( $host, $url, $query ) = |
|
|
|
|
expectForm( $res, undef, '/checkuser', 'user', 'url' ); |
|
|
|
|
ok( $res->[2]->[0] =~ m%<span trspan="checkUser">%, 'Found trspan="checkUser"' ) |
|
|
|
|
or explain( $res->[2]->[0], 'trspan="checkUser"' ); |
|
|
|
|
count(1); |
|
|
|
|
|
|
|
|
|
ok( $res->[2]->[0] =~ m%<span trspan="checkUser">%, |
|
|
|
|
'Found trspan="checkUser"' ) |
|
|
|
|
or explain( $res->[2]->[0], 'trspan="checkUser"' ); |
|
|
|
|
ok( $res->[2]->[0] |
|
|
|
|
=~ m%<div class="alert alert-success"><b><span trspan="allowed"></span></b></div>%, |
|
|
|
|
ok( $res->[2]->[0] =~ m%<span trspan="checkUser">%, 'Found trspan="checkUser"' ) |
|
|
|
|
or explain( $res->[2]->[0], 'trspan="checkUser"' ); |
|
|
|
|
ok( |
|
|
|
|
$res->[2]->[0] =~ |
|
|
|
|
m%<div class="alert alert-success"><b><span trspan="allowed"></span></b></div>%, |
|
|
|
|
'Found trspan="allowed"' |
|
|
|
|
) or explain( $res->[2]->[0], 'trspan="allowed"' ); |
|
|
|
|
ok( $res->[2]->[0] =~ m%<span trspan="headers">%, 'Found trspan="headers"' ) |
|
|
|
|
or explain( $res->[2]->[0], 'trspan="headers"' ); |
|
|
|
|
or explain( $res->[2]->[0], 'trspan="headers"' ); |
|
|
|
|
ok( $res->[2]->[0] =~ m%<span trspan="groups_sso">%, |
|
|
|
|
'Found trspan="groups_sso"' ) |
|
|
|
|
or explain( $res->[2]->[0], 'trspan="groups_sso"' ); |
|
|
|
|
or explain( $res->[2]->[0], 'trspan="groups_sso"' ); |
|
|
|
|
ok( $res->[2]->[0] =~ m%<span trspan="macros">%, 'Found trspan="macros"' ) |
|
|
|
|
or explain( $res->[2]->[0], 'trspan="macros"' ); |
|
|
|
|
or explain( $res->[2]->[0], 'trspan="macros"' ); |
|
|
|
|
ok( $res->[2]->[0] =~ m%<span trspan="attributes">%, |
|
|
|
|
'Found trspan="attributes"' ) |
|
|
|
|
or explain( $res->[2]->[0], 'trspan="attributes"' ); |
|
|
|
|
or explain( $res->[2]->[0], 'trspan="attributes"' ); |
|
|
|
|
ok( $res->[2]->[0] =~ m%<td class="align-middle">Auth-User</td>%, |
|
|
|
|
'Found Auth-User' ) |
|
|
|
|
or explain( $res->[2]->[0], 'Header Key: Auth-User' ); |
|
|
|
|
ok( $res->[2]->[0] =~ m%<td class="align-middle">rtyler</td>%, |
|
|
|
|
'Found rtyler' ) |
|
|
|
|
or explain( $res->[2]->[0], 'Header Value: rtyler' ); |
|
|
|
|
or explain( $res->[2]->[0], 'Header Key: Auth-User' ); |
|
|
|
|
ok( $res->[2]->[0] =~ m%<td class="align-middle">rtyler</td>%, 'Found rtyler' ) |
|
|
|
|
or explain( $res->[2]->[0], 'Header Value: rtyler' ); |
|
|
|
|
ok( $res->[2]->[0] =~ m%<td class="align-middle">su</td>%, 'Found su' ) |
|
|
|
|
or explain( $res->[2]->[0], 'SSO Groups: su' ); |
|
|
|
|
or explain( $res->[2]->[0], 'SSO Groups: su' ); |
|
|
|
|
ok( $res->[2]->[0] =~ m%<td class="align-middle">_whatToTrace</td>%, |
|
|
|
|
'Found _whatToTrace' ) |
|
|
|
|
or explain( $res->[2]->[0], 'Macro Key _whatToTrace' ); |
|
|
|
|
or explain( $res->[2]->[0], 'Macro Key _whatToTrace' ); |
|
|
|
|
ok( $res->[2]->[0] =~ m%<td class="text-left">uid</td>%, 'Found uid' ) |
|
|
|
|
or explain( $res->[2]->[0], 'Attribute Value uid' ); |
|
|
|
|
or explain( $res->[2]->[0], 'Attribute Value uid' ); |
|
|
|
|
count(11); |
|
|
|
|
|
|
|
|
|
$query =~ s/user=dwho/user=msmith/; |
|
|
|
|
$query |
|
|
|
|
=~ s/url=http%3A%2F%2Ftest1.example.com/url=http%3A%2F%2Fmanager.example.com%2Fmanager.html/; |
|
|
|
|
ok( $res = $client->_post( |
|
|
|
|
$query =~ |
|
|
|
|
s/url=http%3A%2F%2Ftest1.example.com/url=http%3A%2F%2Fmanager.example.com%2Fmanager.html/; |
|
|
|
|
ok( |
|
|
|
|
$res = $client->_post( |
|
|
|
|
'/checkuser', |
|
|
|
|
IO::String->new($query), |
|
|
|
|
cookie => "lemonldap=$id", |
|
|
|
@ -179,8 +181,9 @@ ok( $res = $client->_post( |
|
|
|
|
), |
|
|
|
|
'POST checkuser' |
|
|
|
|
); |
|
|
|
|
ok( $res->[2]->[0] |
|
|
|
|
=~ m%<div class="alert alert-danger"><b><span trspan="forbidden"></span></b></div>%, |
|
|
|
|
ok( |
|
|
|
|
$res->[2]->[0] =~ |
|
|
|
|
m%<div class="alert alert-danger"><b><span trspan="forbidden"></span></b></div>%, |
|
|
|
|
'Found trspan="forbidden"' |
|
|
|
|
) or explain( $res->[2]->[0], 'trspan="forbidden"' ); |
|
|
|
|
count(2); |
|
|
|
@ -188,4 +191,4 @@ count(2); |
|
|
|
|
$client->logout($id); |
|
|
|
|
clean_sessions(); |
|
|
|
|
|
|
|
|
|
done_testing( count() ); |
|
|
|
|
done_testing( count() ); |
|
|
|
|