pgadmin4 icon indicating copy to clipboard operation
pgadmin4 copied to clipboard

webserver and internal authentication setup

Open conmarti opened this issue 4 years ago • 1 comments

Tried to setup webserver authentication and internal authentication in parallel. When not providing the REMOTE_USER Header I'm ending up in an endless redirect loop.

Started pgadmin using

docker run -d -e [email protected] -e PGADMIN_DEFAULT_PASSWORD=xxxxxx -e PGADMIN_CONFIG_AUTHENTICATION_SOURCES="['webserver','internal']" dpage/pgadmin4:6.16

using curl to inspect the response

curl -c /tmp/c -b /tmp/c -v 172.17.0.2:80/
*   Trying 172.17.0.2...
* TCP_NODELAY set
* Connected to 172.17.0.2 (172.17.0.2) port 80 (#0)
> GET / HTTP/1.1
> Host: 172.17.0.2
> User-Agent: curl/7.60.0
> Accept: */*
> Cookie: pga4_session=fa62aced-ee9d-4de8-a50b-64fbd603064e!fIWnrqnTsVA+n7OTEI9jDku1YVarKnvax9r+FtXKDe4=
> 
< HTTP/1.1 302 FOUND
< Server: gunicorn
< Date: Mon, 28 Nov 2022 19:06:50 GMT
< Connection: keep-alive
< Content-Type: text/html; charset=utf-8
< Content-Length: 189
< Location: /
< Vary: Accept-Encoding
< X-Frame-Options: SAMEORIGIN
< Content-Security-Policy: default-src ws: http: data: blob: 'unsafe-inline' 'unsafe-eval';
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
* Replaced cookie pga4_session="fa62aced-ee9d-4de8-a50b-64fbd603064e!fIWnrqnTsVA+n7OTEI9jDku1YVarKnvax9r+FtXKDe4=" for domain 172.17.0.2, path /, expire 1669748810
< Set-Cookie: pga4_session=fa62aced-ee9d-4de8-a50b-64fbd603064e!fIWnrqnTsVA+n7OTEI9jDku1YVarKnvax9r+FtXKDe4=; Expires=Tue, 29 Nov 2022 19:06:50 GMT; HttpOnly; Path=/; SameSite=Lax
< 
<!doctype html>
<html lang=en>
<title>Redirecting...</title>
<h1>Redirecting...</h1>
<p>You should be redirected automatically to the target URL: <a href="/">/</a>. If not, click the link.
* Connection #0 to host 172.17.0.2 left intact

Expected behaviour is a redirect to /login?next=%2F, which in turn displays the login page.

conmarti avatar Nov 28 '22 19:11 conmarti

If user did not pass 'REMOTE_USER' parameter in the request, user will be redirected to login page. Authentication source parameter should have values in order 'webserver','internal only as user is not allowed to proceed without webserver authentication. Tested with build 21 Dec

yogeshmahajan-1903 avatar Dec 21 '22 10:12 yogeshmahajan-1903