misc: add more logging and fix logger name
This commit is contained in:
parent
93b4b5410e
commit
88dabdcddb
|
@ -25,7 +25,7 @@ import gssapi.exceptions
|
|||
from django import http
|
||||
from django.contrib.auth import authenticate
|
||||
|
||||
logger = logging.getLogger('django_kerberos')
|
||||
logger = logging.getLogger('django_gssapi')
|
||||
|
||||
|
||||
class NegotiateContinue(Exception):
|
||||
|
@ -43,7 +43,7 @@ def negotiate(request, name=None, store=None):
|
|||
try:
|
||||
server_creds = gssapi.Credentials(usage='accept', name=name, store=store)
|
||||
except gssapi.exceptions.GSSError as e:
|
||||
logging.debug('GSSAPI credentials failure: %s', e)
|
||||
logger.debug('GSSAPI credentials failure: %s', e)
|
||||
return None, None
|
||||
|
||||
if not request.META.get('HTTP_AUTHORIZATION', '').startswith('Negotiate '):
|
||||
|
@ -54,15 +54,18 @@ def negotiate(request, name=None, store=None):
|
|||
in_token = base64.b64decode(authstr)
|
||||
except (TypeError, ValueError):
|
||||
return None, None
|
||||
else:
|
||||
logger.debug('GSSAPI received in_token %r', in_token)
|
||||
|
||||
server_ctx = gssapi.SecurityContext(creds=server_creds, usage='accept')
|
||||
try:
|
||||
out_token = server_ctx.step(in_token)
|
||||
except gssapi.exceptions.GSSError as e:
|
||||
logging.debug('GSSAPI security context failure: %s', e)
|
||||
logger.debug('GSSAPI security context failure: %s', e)
|
||||
return None, None
|
||||
|
||||
if not server_ctx.complete:
|
||||
logger.debug('GSSAPI returning out_token %r', out_token)
|
||||
raise NegotiateContinue(out_token)
|
||||
|
||||
return server_ctx.initiator_name, out_token
|
||||
|
|
|
@ -27,7 +27,7 @@ from django.contrib.auth import login as auth_login, REDIRECT_FIELD_NAME
|
|||
|
||||
from . import utils
|
||||
|
||||
logger = logging.getLogger('django_kerberos')
|
||||
logger = logging.getLogger('django_gssapi')
|
||||
|
||||
|
||||
class NegotiateFailed(Exception):
|
||||
|
|
Loading…
Reference in New Issue