More documentation needed - Channels with multiple authentication backends

90 views
Skip to first unread message

Laurent De Buyst

unread,
Sep 5, 2022, 3:52:15 PM9/5/22
to Django users
Greetings,

I've started using channels in an existing application (because IDOM requires it), which has two authentication backends (one local, one LDAP):

AUTHENTICATION_BACKENDS = [
    "django_auth_ldap.backend.LDAPBackend",
    "django.contrib.auth.backends.ModelBackend",
]

This results in the following warnings:

IDOM websocket authentication has failed!
Traceback (most recent call last):
  File "/home/ldt/Projects/fedjango/.venv/lib/python3.9/site-packages/channels/auth.py", line 95, in login
    backend = backend or user.backend
[...]
AttributeError: 'User' object has no attribute 'backend'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
[...]
  File "/home/ldt/Projects/fedjango/.venv/lib/python3.9/site-packages/channels/auth.py", line 101, in login
    raise ValueError(
ValueError: You have multiple authentication backends configured and therefore must provide the `backend` argument or set the `backend` attribute on the user.

Unfortunately, the channels documentation has little to no information on how to best solve this. Where should I provide this backend? Which constructor or function takes this as argument? And what should I provide exactly? The backend object, or just the string?


Thanks in advance for any help you can provide,

Laurent De Buyst
Reply all
Reply to author
Forward
0 new messages