Append ZimbraPreAuth handler test (#1954)

environments/ppa-mbqj77/deployments/822
Christophe Maudoux 6 years ago
parent 892516d55e
commit 32a0d0944a
  1. 1
      lemonldap-ng-handler/MANIFEST
  2. 60
      lemonldap-ng-handler/t/68-Lemonldap-NG-Handler-PSGI-Zimbra.t
  3. 1
      lemonldap-ng-portal/MANIFEST

@ -76,6 +76,7 @@ t/64-Lemonldap-NG-Handler-PSGI-DevOps.t
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/99-pod.t
t/lmConf-1.json
t/sessions/lock/Apache-Session-f5eec18ebb9bc96352595e2d8ce962e8ecf7af7c9a98cb9a43f9cd181cf4b545.lock

@ -0,0 +1,60 @@
use Test::More;
BEGIN {
require 't/test-psgi-lib.pm';
}
my $maintests = 4;
SKIP: {
eval { require Digest::HMAC_SHA1; };
if ($@) {
skip 'Digest::HMAC_SHA1 not found', $maintests;
}
init(
'Lemonldap::NG::Handler::Server',
{
logLevel => 'error',
zimbraPreAuthKey => '1234567890',
vhostOptions => {
'test1.example.com' => {
vhostHttps => 0,
vhostPort => 80,
vhostMaintenance => 0,
vhostServiceTokenTTL => -1,
},
},
exportedHeaders => {
'test1.example.com' => {
'Auth-User' => '$uid',
},
}
}
);
my $timestamp = time() * 1000;
my $value =
Digest::HMAC_SHA1::hmac_sha1_hex( "dwho|id|0|$timestamp", '1234567890' );
ok(
$res = $client->_get(
'/zimbrasso', undef,
'test1.example.com', "lemonldap=$sessionId",
VHOSTTYPE => 'ZimbraPreAuth',
),
'Query'
);
ok( $res->[0] == 302, 'Code is 302' ) or explain( $res->[0], 302 );
# Check headers
%h = @{ $res->[1] };
ok(
$h{'Location'} =~
m%^/service/preauth\?account=dwho&by=id&timestamp=$timestamp&expires=0&preauth=$value$%,
'Header Location is set to Zimbra URL'
) or explain( \%h, 'Location => "Zimbra URL' );
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();

@ -419,6 +419,7 @@ site/templates/common/mail/en.json
site/templates/common/mail/fi.json
site/templates/common/mail/fr.json
site/templates/common/mail/it.json
site/templates/common/mail/ms.json
site/templates/common/mail/vi.json
site/templates/common/mail/zh_CN.json
site/templates/common/mail_2fcode.tpl

Loading…
Cancel
Save