triauth for pgAdminOIDC
Let your database team open pgAdmin with one approval on their own device, and no pgAdmin passwords.
- Sign-in through
- OpenID Connect bridge
- Available in
- pgAdmin 4 in server mode
- Set up in
- config_local.py
About pgAdmin
pgAdmin is the administration tool for PostgreSQL databases: it browses schemas, runs queries, shows dashboards, and manages backups. Teams run it in server mode on a shared host, so several people use one installation with their own logins.
Connect pgAdmin to triauth
pgAdmin signs people in through the triauth OpenID Connect bridge. Once connected, the login page shows Login with and your domain's name. People on your team click it, type their username, and approve on their own device. Nobody keeps a pgAdmin password, and when someone leaves, removing their identity records at your domain ends their access to pgAdmin as well.
How it works
Open oidc.triauth.org and enter your domain. Paste pgAdmin's redirect address,
https://pgadmin.example.com/oauth2/authorizewith your own pgAdmin address in place ofpgadmin.example.com, and click Connect app. The bridge gives you a client ID and a client secret.Add the settings below to pgAdmin's
config_local.pyand restart it. Replaceexample.comwith your domain and the two placeholders with the client ID and the client secret from the bridge.pythonAUTHENTICATION_SOURCES = ['oauth2', 'internal'] OAUTH2_AUTO_CREATE_USER = True OAUTH2_CONFIG = [{ 'OAUTH2_NAME': 'triauth', 'OAUTH2_DISPLAY_NAME': 'example.com', 'OAUTH2_CLIENT_ID': '<client ID from the bridge>', 'OAUTH2_CLIENT_SECRET': '<client secret from the bridge>', 'OAUTH2_SERVER_METADATA_URL': 'https://oidc.triauth.org/example.com/.well-known/openid-configuration', 'OAUTH2_SCOPE': 'openid email profile', 'OAUTH2_ICON': 'fa-key', 'OAUTH2_BUTTON_COLOR': '#3253a8', }]Open pgAdmin's login page and click Login with example.com.
Checkpoint
pgAdmin's login page shows Login with example.com next to the password form. Choosing it opens a page from the bridge that asks for the username, and the person's authenticator asks them to approve.
Good to know
- Everyone with an identity at your domain gets a pgAdmin user the first time they sign in, with their identifier as user name. To let only one team in, limit the app to a group when you connect it, or list the allowed groups in
OAUTH2_ADDITIONAL_CLAIMSwith thegroupsscope added. - Administrator rights are given per user in pgAdmin. Create an administrator through the bridge before you turn the internal login off.
- The desktop version of pgAdmin has no sign-in of its own, so this applies to the shared server.
For the person who connects the app
| Setting | Value |
|---|---|
| Redirect address | https://<your-pgadmin>/oauth2/authorize, built from pgAdmin's public address, so a reverse proxy must pass the forwarded headers |
| Where in pgAdmin | config_local.py or config_system.py, or PGADMIN_CONFIG_OAUTH2_CONFIG in a container |
| Metadata URL | the bridge's discovery document. pgAdmin requires it whenever openid is in the scope and reads every address from it |
| Without a secret | if you ticked This app can't keep a secret on the bridge, set OAUTH2_CHALLENGE_METHOD: 'S256' and OAUTH2_RESPONSE_TYPE: 'code' |
| Sign-out | leave OAUTH2_LOGOUT_URL unset, since the bridge has no sign-out endpoint |

pgAdmin keeps the client secret, so leave This app can't keep a secret unticked when you connect it on the bridge. pgAdmin's OAuth2 guide explains every key.
Next steps
- Read the OpenID Connect bridge page for what every connected app gets and what the bridge keeps private.
- Read Roll out to your team to give everyone in your organization an identifier at your domain.
- Read Groups to publish the groups that pgAdmin checks at sign-in.
- Read pgAdmin's OAuth2 guide for every setting pgAdmin offers.
All logos and trademarks belong to their respective owners and do not imply affiliation or endorsement of the organization or product by triauth, nor vice versa. The content provided on this page may include information from third-party sources. We do not assume any responsibility for the completeness, correctness, or applicability of the information. You should independently verify any details before relying on them.
