Fix the failing test of test_auth_header_not_set

This commit is contained in:
mprahl
2019-03-20 14:22:42 -04:00
committed by mprahl
parent 1528cc52c0
commit f81c25d6dd

View File

@@ -244,7 +244,11 @@ def get_user_kerberos(request):
user = None
if 'Authorization' not in request.headers:
response = Response('Unauthorized', 401, {'WWW-Authenticate': 'Negotiate'})
raise FlaskUnauthorized(response=response)
exc = FlaskUnauthorized()
# For some reason, certain versions of werkzeug raise an exception when passing `response`
# in the constructor. This is a work-around.
exc.response = response
raise exc
header = request.headers.get('Authorization')
token = ''.join(header.strip().split()[1:])
user, kerberos_token = KerberosAuthenticate().process_request(token)