Use PE_BADCREDENTIALS instead of 403 (#707)

This commit is contained in:
Xavier Guimard 2017-04-05 12:02:02 +00:00
parent 6943c49c05
commit c4b27b9c24

View File

@ -5,6 +5,7 @@ use Mouse;
use GSSAPI;
use MIME::Base64;
use Lemonldap::NG::Portal::Main::Constants qw(
PE_BADCREDENTIALS
PE_ERROR
PE_OK
PE_SENDRESPONSE
@ -26,7 +27,7 @@ sub extractFormInfo {
unless ($auth) {
$req->response(
[
410,
401,
[ 'WWW-Authenticate' => 'Negotiate' ],
['Authentication required']
]
@ -35,14 +36,13 @@ sub extractFormInfo {
}
if ( $auth !~ /^Negotiate (.*)$/ ) {
$self->userLogger->error('Bad authorization header');
$req->response( [ 403, [], ['Forbidden'] ] );
return PE_SENDRESPONSE;
return PE_BADCREDENTIALS;
}
my $data;
eval { $data = MIME::Base64::decode($1) };
if ($@) {
$self->userLogger->error( 'Bad authorization header: ' . $@ );
return PE_ERROR;
return PE_BADCREDENTIALS;
}
my $server_context;
my $status = GSSAPI::Context::accept(