public inbox for [email protected]  
help / color / mirror / Atom feed
[PATCH 1/2] pgarchives: Add missing authentication backend to settings.py
3+ messages / 2 participants
[nested] [flat]

* [PATCH 1/2] pgarchives: Add missing authentication backend to settings.py
@ 2021-10-28 17:42  Célestin Matte <[email protected]>
  0 siblings, 2 replies; 3+ messages in thread

From: Célestin Matte @ 2021-10-28 17:42 UTC (permalink / raw)
  To: PostgreSQL WWW <[email protected]>

Hello,

Authentication when using private archives in pgarchives is broken with current settings.py file.
This first patch add a missing backend in settings.py, without which sessions aren't registered and users get redirected indefinitely.
In the second patch of this series, I add missing parameters for configuring PGAUTH, copying the ones from pglister.

Cheers,
-- 
Célestin Matte

Attachments:

  [text/x-patch] 0001-Add-missing-authentication-backend-to-settings.py.patch (838B, 2-0001-Add-missing-authentication-backend-to-settings.py.patch)
  download | inline diff:
From 8359ed3f27dfeecbd981be10fc07cd05804c08d8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9lestin=20Matte?= <[email protected]>
Date: Thu, 28 Oct 2021 19:26:27 +0200
Subject: [PATCH 1/2] Add missing authentication backend to settings.py

---
 django/archives/settings.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/django/archives/settings.py b/django/archives/settings.py
index 906d91b..db09575 100644
--- a/django/archives/settings.py
+++ b/django/archives/settings.py
@@ -161,6 +161,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
-- 
2.33.1



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* [PATCH 2/2] pgarchives: Add missing example pgauth config in settings.py
@ 2021-10-28 17:43  Célestin Matte <[email protected]>
  parent: Célestin Matte <[email protected]>
  1 sibling, 0 replies; 3+ messages in thread

From: Célestin Matte @ 2021-10-28 17:43 UTC (permalink / raw)
  To: [email protected]

> In the second patch of this series, I add missing parameters for configuring PGAUTH, copying the ones from pglister.-- 
Célestin Matte

Attachments:

  [text/x-patch] 0002-Add-missing-example-pgauth-config-in-settings.py.patch (837B, 2-0002-Add-missing-example-pgauth-config-in-settings.py.patch)
  download | inline diff:
From 9ce519750d165d09e0874341e4e2592875d18b8a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9lestin=20Matte?= <[email protected]>
Date: Thu, 28 Oct 2021 19:36:50 +0200
Subject: [PATCH 2/2] Add missing example pgauth config in settings.py

Following the model of pglister
---
 django/archives/settings.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/django/archives/settings.py b/django/archives/settings.py
index db09575..7f4735b 100644
--- a/django/archives/settings.py
+++ b/django/archives/settings.py
@@ -141,6 +141,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
 
 try:
-- 
2.33.1



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: [PATCH 1/2] pgarchives: Add missing authentication backend to settings.py
@ 2022-01-15 17:54  Magnus Hagander <[email protected]>
  parent: Célestin Matte <[email protected]>
  1 sibling, 0 replies; 3+ messages in thread

From: Magnus Hagander @ 2022-01-15 17:54 UTC (permalink / raw)
  To: Célestin Matte <[email protected]>; +Cc: PostgreSQL WWW <[email protected]>

On Thu, Oct 28, 2021 at 7:42 PM Célestin Matte <[email protected]> wrote:
>
> Hello,
>
> Authentication when using private archives in pgarchives is broken with current settings.py file.
> This first patch add a missing backend in settings.py, without which sessions aren't registered and users get redirected indefinitely.
> In the second patch of this series, I add missing parameters for configuring PGAUTH, copying the ones from pglister.

Yeah, technically it's configured to use django auth but then we
override that elsewhere.  It might be worthwhile to remove those
hardcoded redirects and make it possible to use the system with the
built in django auth. But until someone does that, I agree that
putting a working value into AUTHENTICATION_BACKEND is definitely
better.

And also the example file that was in your patch #2.

Both patches squashed and applied. Thanks!

-- 
 Magnus Hagander
 Me: https://www.hagander.net/
 Work: https://www.redpill-linpro.com/






^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2022-01-15 17:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-10-28 17:42 [PATCH 1/2] pgarchives: Add missing authentication backend to settings.py Célestin Matte <[email protected]>
2021-10-28 17:43 ` [PATCH 2/2] pgarchives: Add missing example pgauth config in settings.py Célestin Matte <[email protected]>
2022-01-15 17:54 ` Magnus Hagander <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox