2018-02-08 22:31:41 +01:00
|
|
|
use Test::More;
|
|
|
|
use strict;
|
|
|
|
use IO::String;
|
|
|
|
|
2019-02-05 10:34:39 +01:00
|
|
|
BEGIN {
|
|
|
|
require 't/test-lib.pm';
|
|
|
|
eval "use GSSAPI";
|
|
|
|
}
|
2018-02-08 22:31:41 +01:00
|
|
|
|
|
|
|
my $res;
|
|
|
|
my $maintests = 2;
|
|
|
|
my $client;
|
|
|
|
|
|
|
|
SKIP: {
|
|
|
|
eval "require GSSAPI";
|
|
|
|
if ($@) {
|
|
|
|
skip 'GSSAPI not found', $maintests;
|
|
|
|
}
|
2019-02-07 09:27:56 +01:00
|
|
|
my $client = LLNG::Manager::Test->new( {
|
2018-02-08 22:31:41 +01:00
|
|
|
ini => {
|
|
|
|
logLevel => 'error',
|
|
|
|
useSafeJail => 1,
|
|
|
|
authentication => 'Combination',
|
|
|
|
userDB => 'Same',
|
|
|
|
|
|
|
|
combination => '[K,Dm] or [Dm]',
|
|
|
|
combModules => {
|
|
|
|
K => {
|
|
|
|
for => 1,
|
|
|
|
type => 'Kerberos',
|
|
|
|
},
|
|
|
|
Dm => {
|
|
|
|
for => 0,
|
|
|
|
type => 'Demo',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
demoExportedVars => {},
|
|
|
|
krbKeytab => '/etc/keytab',
|
|
|
|
krbByJs => 1,
|
|
|
|
}
|
|
|
|
}
|
2018-03-13 07:14:01 +01:00
|
|
|
);
|
|
|
|
ok( $res = $client->_get( '/', accept => 'text/html' ), 'Simple access' );
|
2019-08-29 10:04:06 +02:00
|
|
|
ok( $res->[2]->[0] =~ /script.*kerberos\.js/s, 'Found Kerberos JS' )
|
|
|
|
or explain( $res->[2]->[0], 'script.*kerberos.js' );
|
2018-03-13 07:14:01 +01:00
|
|
|
my ( $host, $url, $query ) = expectForm( $res, '#' );
|
|
|
|
|
|
|
|
# TODO
|
2018-02-08 22:31:41 +01:00
|
|
|
}
|
|
|
|
count($maintests);
|
|
|
|
clean_sessions();
|
|
|
|
done_testing( count() );
|
|
|
|
|
|
|
|
# Redefine GSSAPI method for test
|
|
|
|
no warnings 'redefine';
|
|
|
|
|
|
|
|
sub GSSAPI::Context::accept ($$$$$$$$$$) {
|
|
|
|
my $a = \@_;
|
|
|
|
$a->[4] = bless {}, 'LLNG::GSSR';
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
package LLNG::GSSR;
|
|
|
|
|
|
|
|
sub display {
|
|
|
|
my $a = \@_;
|
|
|
|
$a->[1] = 'dwho';
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|