Files
WYGIWYH/app/apps/users/backends.py
T
fariskazmi 161fc19721 feat(auth): add OIDC_DISABLE_LOCAL_LOGIN to turn off password logins
When the flag is on and an OIDC provider is configured, every e-mail and
password check is refused: the login page, the admin and the API's basic
auth. OIDC logins, API tokens, OAuth apps and permission checks keep working.
The login page hides the password form.
2026-11-02 09:08:30 -06:00

15 lines
588 B
Python

from allauth.account.auth_backends import AuthenticationBackend
class SocialOnlyAuthenticationBackend(AuthenticationBackend):
"""Replaces the default backends when OIDC_DISABLE_LOCAL_LOGIN is on.
Every e-mail and password is refused, wherever it's checked: the login
page, the admin and the API's basic auth. OIDC logins still work, because
allauth picks its own backend class, which this is, for those sessions.
Permission checks keep working too, since they come from ModelBackend.
"""
def authenticate(self, request, **credentials):
return None