https://github.com/dvob/pg_dummy_validator
Postgres OAuth Dummy Validator Module
https://github.com/dvob/pg_dummy_validator
Last synced: 4 months ago
JSON representation
Postgres OAuth Dummy Validator Module
- Host: GitHub
- URL: https://github.com/dvob/pg_dummy_validator
- Owner: dvob
- License: mit
- Created: 2025-10-11T22:24:21.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-10-11T22:28:30.000Z (8 months ago)
- Last Synced: 2025-10-19T14:57:55.241Z (8 months ago)
- Language: Makefile
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PostgreSQL Dummy OAuth Validator Module
This repo contains a OAuth validator module to test and play around with the new OAuth feature in PostgreSQL 18.
A OAuth validator module is the shared library which performs the actual verification of the OAuth token. As a result it returns the authenticated user/role.
This dummy validator doesn't validate anything at all and authenticats all tokens. It returns the value of the token as user to PostgreSQL (e.g. if a client sends token `myapp` it will be authenticated as user/role `myapp`).
See:
- PostgreSQL OAuth Client Authentication: https://www.postgresql.org/docs/18/auth-oauth.html
- Implementation of OAuth Validator Modules: https://www.postgresql.org/docs/current/oauth-validators.html
Drivers:
- Go pgx: https://github.com/jackc/pgx/pull/2400
# Build
## Local
To build it you need a Postgres installation with header files (e.g. packge `postgresql-server-dev-18`). Alternatively you can build Postgres yourself (see below).
```
make
make install
```
## Docker
```
make docker-build
```
# Test
Run a test server.
## Local
Prepare cluster directory:
```
initdb -D mytest
cat <mytest/pg_hba.conf
local all all trust
host all all all oauth validator=dummy_validator issuer=https://example.com scope=
EOF
cat <>mytest/postgresql.conf
oauth_validator_libraries = 'dummy_validator'
EOF
```
Make sure dummy_validator.so is installed (`make install`).
Run:
```
pg_ctl -D mytest -l mytest.log start
```
Create user and database:
```
psql postgres <