mirror of
https://github.com/ansible/awx.git
synced 2026-08-01 10:29:56 -02:30
Write a thin wrapper around the standard Django auth backend
This commit is contained in:
14
awx/main/backends.py
Normal file
14
awx/main/backends.py
Normal file
@@ -0,0 +1,14 @@
|
||||
import logging
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.backends import ModelBackend
|
||||
|
||||
logger = logging.getLogger('awx.main.backends')
|
||||
|
||||
|
||||
class AWXModelBackend(ModelBackend):
|
||||
def authenticate(self, request, **kwargs):
|
||||
if settings.DISABLE_LOCAL_AUTH:
|
||||
logger.warning(f"User '{kwargs['username']}' attempted login through the disabled local authentication system.")
|
||||
return
|
||||
return super().authenticate(request, **kwargs)
|
||||
Reference in New Issue
Block a user