Fix default authentication configuration
authorCélestin Matte <gitlab@cmatte.me>
Sat, 15 Jan 2022 17:48:04 +0000 (18:48 +0100)
committerMagnus Hagander <magnus@hagander.net>
Sat, 15 Jan 2022 17:48:04 +0000 (18:48 +0100)
Add the required authentication backend configuration and include an
example for how to set up the pgauth plugin.

django/archives/settings.py

index 4eed26c080c85ba76b10f0943df444477d0395c1..24861a99f330231e99b45ea0c82a08b04f19a75e 100644 (file)
@@ -143,6 +143,9 @@ RESEND_RATE_LIMIT_SECONDS = 30
 SEARCH_CLIENTS = ('127.0.0.1',)
 API_CLIENTS = ('127.0.0.1',)
 PUBLIC_ARCHIVES = False
+# pgauth configuration if using private archives
+PGAUTH_REDIRECT = "http://localhost:8000/account/auth/12/"
+PGAUTH_KEY = "encryption_key"
 ALLOW_RESEND = False
 
 PGWEB_ADDRESS = 'https://www.postgresql.org'
@@ -165,6 +168,10 @@ if ALLOW_RESEND or not PUBLIC_ARCHIVES:
         'django.contrib.sessions',
     ] + INSTALLED_APPS
 
+    AUTHENTICATION_BACKENDS = (
+        'archives.auth.AuthBackend',
+    )
+
     if not PUBLIC_ARCHIVES:
         from archives.util import validate_new_user
         PGAUTH_CREATEUSER_CALLBACK = validate_new_user