Am 25. Juli 2019 um 13:16 Uhr -0700 schrieb Abhilash Raj:
So, Hyperkitty itself doesn't concern with authentication and it is handled by django-allauth, which itself hooks into the higher level authentication API provided by Django.
Ah sure. I forgot about that (because I'm not a Pythonista).
You can use the higher level
django.contrib.auth.authenticate()
[2] function with right values in a Python script running in the same virtualenv to authenticate the user to your wiki.
Thank you for the hint. I installed Mailman 3 from Ubuntu's repositories, though. Nevertheless, I managed to write a little test script that works successfully. I used "manage.py runscript" to execute it. For that, I created a scripts/ directory below /usr/share/mailman3-web, added an empty __init__.py and then the script itself, as described in the Django online documentation¹. This is the script I used for testing, adapted from your linked documentation for django.contrib.auth.authenticate:
from django.contrib.auth import authenticate
def run():
user = authenticate(username='johndoe', password='s33cr3t')
if user is not None:
# A backend authenticated the credentials
print "Okay"
else:
print "Not Okay"
# No backend authenticated the credentials
Save it in /usr/share/mailman3-web/scripts/testauth.py and execute
$ python manage.py runscript authtest
as user "www-data" to test it. It'll print "Okay" if the credentials validate and "Not Okay" if not.
Next I'm going to fiddle with it. It's probably possible to move that scripts directory outside /usr into /opt or similar.
Marvin
¹ https://django-extensions.readthedocs.io/en/latest/runscript.html
-- Blog: https://mg.guelker.eu