Append SecureToken handler unit test
This commit is contained in:
parent
b969f5b876
commit
d1d6b4f192
|
@ -77,6 +77,7 @@ t/65-Lemonldap-NG-Handler-PSGI-ServiceToken.t
|
|||
t/66-Lemonldap-NG-Handler-PSGI-wildcard.t
|
||||
t/67-Lemonldap-NG-Handler-PSGI-vhostoptions.t
|
||||
t/68-Lemonldap-NG-Handler-PSGI-Zimbra.t
|
||||
t/69-Lemonldap-NG-Handler-PSGI-SecureToken.t
|
||||
t/99-pod.t
|
||||
t/lmConf-1.json
|
||||
t/sessions/lock/Apache-Session-f5eec18ebb9bc96352595e2d8ce962e8ecf7af7c9a98cb9a43f9cd181cf4b545.lock
|
||||
|
|
|
@ -16,6 +16,7 @@ SKIP: {
|
|||
{
|
||||
logLevel => 'error',
|
||||
zimbraPreAuthKey => '1234567890',
|
||||
zimbraSsoUrl => 'testsso',
|
||||
vhostOptions => {
|
||||
'test1.example.com' => {
|
||||
vhostHttps => 0,
|
||||
|
@ -36,7 +37,7 @@ SKIP: {
|
|||
Digest::HMAC_SHA1::hmac_sha1_hex( "dwho|id|0|$timestamp", '1234567890' );
|
||||
ok(
|
||||
$res = $client->_get(
|
||||
'/zimbrasso', undef,
|
||||
'/testsso', undef,
|
||||
'test1.example.com', "lemonldap=$sessionId",
|
||||
VHOSTTYPE => 'ZimbraPreAuth',
|
||||
),
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
use Test::More;
|
||||
|
||||
BEGIN {
|
||||
require 't/test-psgi-lib.pm';
|
||||
}
|
||||
|
||||
my $maintests = 4;
|
||||
|
||||
SKIP: {
|
||||
eval { require Cache::Memcached; };
|
||||
if ($@) {
|
||||
skip 'Cache::Memcached not found', $maintests;
|
||||
}
|
||||
eval { require Apache::Session::Generate::MD5; };
|
||||
if ($@) {
|
||||
skip 'Apache::Session::Generate::MD5 not found', $maintests;
|
||||
}
|
||||
init(
|
||||
'Lemonldap::NG::Handler::Server',
|
||||
{
|
||||
logLevel => 'error',
|
||||
secureTokenUrls => ['/secured'],
|
||||
vhostOptions => {
|
||||
'test1.example.com' => {
|
||||
vhostHttps => 0,
|
||||
vhostPort => 80,
|
||||
vhostMaintenance => 0,
|
||||
vhostServiceTokenTTL => -1,
|
||||
},
|
||||
},
|
||||
exportedHeaders => {
|
||||
'test1.example.com' => {
|
||||
'Auth-User' => '$uid',
|
||||
},
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
ok(
|
||||
$res = $client->_get(
|
||||
'/secured', undef,
|
||||
'test1.example.com', "lemonldap=$sessionId",
|
||||
VHOSTTYPE => 'SecureToken',
|
||||
),
|
||||
'Auth query'
|
||||
);
|
||||
ok( $res->[0] == 200, 'Code is 200' ) or explain( $res->[0], 200 );
|
||||
|
||||
# Check headers
|
||||
%h = @{ $res->[1] };
|
||||
ok( $h{'Auth-Token'} =~ m%[0-9a-f]{32}%, 'Header "Auth-Token" found' )
|
||||
or explain( \%h, 'Auth-Token => "md5 value"' );
|
||||
ok( $h{'Auth-User'} eq 'dwho', 'Header Auth-User is set to "dwho"' )
|
||||
or explain( \%h, 'Auth-User => "dwho"' );
|
||||
count(4);
|
||||
}
|
||||
|
||||
done_testing( count() );
|
||||
clean();
|
Loading…
Reference in New Issue
Block a user