Set kerberos=0 in form when using Ajax (#1366)

This commit is contained in:
Xavier Guimard 2018-02-08 22:31:41 +01:00
parent 204d851792
commit 584169d88c
3 changed files with 70 additions and 0 deletions

View File

@ -367,6 +367,7 @@ t/35-REST-config-backend.t
t/35-REST-sessions-with-REST-server.t
t/35-SOAP-config-backend.t
t/35-SOAP-sessions-with-SOAP-server.t
t/36-Combination-Kerberos-or-Demo.t
t/36-Combination-with-over.t
t/36-Combination-with-token.t
t/36-Combination.t
@ -388,6 +389,8 @@ t/42-Register-Demo-with-captcha.t
t/42-Register-Demo-with-token.t
t/42-Register-Demo.t
t/42-Register-LDAP.t
t/43-MailReset-DBI.t
t/43-MailReset-LDAP.t
t/43-MailReset-with-captcha.t
t/43-MailReset-with-token.t
t/43-MailReset.t

View File

@ -91,6 +91,7 @@ sub extractFormInfo {
'<script type="text/javascript" src="'
. $self->p->staticPrefix
. '/common/js/kerberos.js"></script>';
$self->p->setHiddenFormValue( $req, kerberos => 0, '', 0 );
return PE_FIRSTACCESS;
}
}

View File

@ -0,0 +1,66 @@
use Test::More;
use strict;
use IO::String;
require 't/test-lib.pm';
my $res;
my $maintests = 2;
my $client;
SKIP: {
eval "require GSSAPI";
if ($@) {
skip 'GSSAPI not found', $maintests;
}
my $client = LLNG::Manager::Test->new(
{
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,
}
}
);
ok( $res = $client->_get( '/', accept => 'text/html' ), 'Simple access' );
ok( $res->[2]->[0] =~ /script.*kerberos\.js/s, 'Found Kerberos JS' );
my ( $host, $url, $query ) = expectForm( $res, '#');
# TODO
}
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;
}