Skip to content
oidc_validator

oidc_validator

pg_oidc_validator_rust : PostgreSQL 18 OIDC bearer-token validator plugin written in Rust

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
7180
oidc_validator
pg_oidc_validator_rust
0.1.0
SEC
LicenseRef-Upstream-No-License
Rust
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--sL---
No
Yes
Yes
No
no
no
Relationships
See Also
pg_oidc_validator
pg_session_jwt
pgjwt
login_hook
auth_delay

Configure oauth_validator_libraries=‘oidc_validator’. Built from upstream commit b65bbbe288f84fab91d58b8304e8a526d1326af5; upstream publishes no license grant.

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXT
PIGSTY
0.1.0
18
17
16
15
14
pg_oidc_validator_rust-
RPM
PIGSTY
0.1.0
18
17
16
15
14
pg_oidc_validator_rust_$v-
DEB
PIGSTY
0.1.0
18
17
16
15
14
postgresql-$v-pg-oidc-validator-rust-
Linux / PGPG18PG17PG16PG15PG14
el8.x86_64
PIGSTY 0.1.0
MISS
MISS
MISS
MISS
el8.aarch64
PIGSTY 0.1.0
MISS
MISS
MISS
MISS
el9.x86_64
PIGSTY 0.1.0
MISS
MISS
MISS
MISS
el9.aarch64
PIGSTY 0.1.0
MISS
MISS
MISS
MISS
el10.x86_64
PIGSTY 0.1.0
MISS
MISS
MISS
MISS
el10.aarch64
PIGSTY 0.1.0
MISS
MISS
MISS
MISS
d12.x86_64
PIGSTY 0.1.0
MISS
MISS
MISS
MISS
d12.aarch64
PIGSTY 0.1.0
MISS
MISS
MISS
MISS
d13.x86_64
PIGSTY 0.1.0
MISS
MISS
MISS
MISS
d13.aarch64
PIGSTY 0.1.0
MISS
MISS
MISS
MISS
u22.x86_64
PIGSTY 0.1.0
MISS
MISS
MISS
MISS
u22.aarch64
PIGSTY 0.1.0
MISS
MISS
MISS
MISS
u24.x86_64
PIGSTY 0.1.0
MISS
MISS
MISS
MISS
u24.aarch64
PIGSTY 0.1.0
MISS
MISS
MISS
MISS
u26.x86_64
PIGSTY 0.1.0
MISS
MISS
MISS
MISS
u26.aarch64
PIGSTY 0.1.0
MISS
MISS
MISS
MISS
PackageVersionOSORGSIZEFile URL
pg_oidc_validator_rust_180.1.0el8.x86_64pigsty3.1 MiBpg_oidc_validator_rust_18-0.1.0-1PIGSTY.el8.x86_64.rpm
pg_oidc_validator_rust_180.1.0el8.aarch64pigsty3.0 MiBpg_oidc_validator_rust_18-0.1.0-1PIGSTY.el8.aarch64.rpm
pg_oidc_validator_rust_180.1.0el9.x86_64pigsty3.1 MiBpg_oidc_validator_rust_18-0.1.0-1PIGSTY.el9.x86_64.rpm
pg_oidc_validator_rust_180.1.0el9.aarch64pigsty3.1 MiBpg_oidc_validator_rust_18-0.1.0-1PIGSTY.el9.aarch64.rpm
pg_oidc_validator_rust_180.1.0el10.x86_64pigsty3.1 MiBpg_oidc_validator_rust_18-0.1.0-1PIGSTY.el10.x86_64.rpm
pg_oidc_validator_rust_180.1.0el10.aarch64pigsty3.1 MiBpg_oidc_validator_rust_18-0.1.0-1PIGSTY.el10.aarch64.rpm
postgresql-18-pg-oidc-validator-rust0.1.0d12.x86_64pigsty2.4 MiBpostgresql-18-pg-oidc-validator-rust_0.1.0-1PIGSTY~bookworm_amd64.deb
postgresql-18-pg-oidc-validator-rust0.1.0d12.aarch64pigsty2.1 MiBpostgresql-18-pg-oidc-validator-rust_0.1.0-1PIGSTY~bookworm_arm64.deb
postgresql-18-pg-oidc-validator-rust0.1.0d13.x86_64pigsty2.4 MiBpostgresql-18-pg-oidc-validator-rust_0.1.0-1PIGSTY~trixie_amd64.deb
postgresql-18-pg-oidc-validator-rust0.1.0d13.aarch64pigsty2.1 MiBpostgresql-18-pg-oidc-validator-rust_0.1.0-1PIGSTY~trixie_arm64.deb
postgresql-18-pg-oidc-validator-rust0.1.0u22.x86_64pigsty2.6 MiBpostgresql-18-pg-oidc-validator-rust_0.1.0-1PIGSTY~jammy_amd64.deb
postgresql-18-pg-oidc-validator-rust0.1.0u22.aarch64pigsty2.5 MiBpostgresql-18-pg-oidc-validator-rust_0.1.0-1PIGSTY~jammy_arm64.deb
postgresql-18-pg-oidc-validator-rust0.1.0u24.x86_64pigsty2.6 MiBpostgresql-18-pg-oidc-validator-rust_0.1.0-1PIGSTY~noble_amd64.deb
postgresql-18-pg-oidc-validator-rust0.1.0u24.aarch64pigsty2.5 MiBpostgresql-18-pg-oidc-validator-rust_0.1.0-1PIGSTY~noble_arm64.deb
postgresql-18-pg-oidc-validator-rust0.1.0u26.x86_64pigsty2.6 MiBpostgresql-18-pg-oidc-validator-rust_0.1.0-1PIGSTY~resolute_amd64.deb
postgresql-18-pg-oidc-validator-rust0.1.0u26.aarch64pigsty2.5 MiBpostgresql-18-pg-oidc-validator-rust_0.1.0-1PIGSTY~resolute_arm64.deb

Source

pig build pkg pg_oidc_validator_rust;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgsql -u   # add both repo and update cache

Install this extension with pig:

pig install pg_oidc_validator_rust;		# install via package name, for the active PG version
pig install oidc_validator;		# install by extension name, for the current active PG version

pig install oidc_validator -v 18;   # install for PG 18

Config this extension to shared_preload_libraries:

shared_preload_libraries = 'oidc_validator';

This extension does not need CREATE EXTENSION DDL command

Usage

Sources:

oidc_validator is a PostgreSQL 18 OAuth validator module written in Rust. It validates JWT access tokens against an OpenID Connect issuer and returns the token subject as the authenticated identity. It is a headless authentication library, not a SQL extension, so it creates no SQL objects and does not use CREATE EXTENSION.

Core Workflow

Install oidc_validator.so in PostgreSQL’s library directory, then configure the PostgreSQL 18 validator module:

oauth_validator_libraries = 'oidc_validator'

Add an OAuth rule to pg_hba.conf:

host all all 0.0.0.0/0 oauth issuer="https://issuer.example" scope="openid profile"

Provide the validator configuration to the PostgreSQL server process:

POSTGRES_OIDC_ISSUER=https://issuer.example
POSTGRES_OIDC_CLIENT_ID=postgres
POSTGRES_OIDC_AUDIENCE=postgres

Restart PostgreSQL after changing oauth_validator_libraries or the server-process environment. OAuth clients can then authenticate through a matching pg_hba.conf rule.

Configuration Index

  • POSTGRES_OIDC_ISSUER: issuer URL without the well-known discovery suffix.
  • POSTGRES_OIDC_CLIENT_ID: OIDC application client ID.
  • POSTGRES_OIDC_AUDIENCE: required token audience, commonly the client ID.
  • oauth_validator_libraries: PostgreSQL 18 setting that loads the trusted validator module.

Requirements and Caveats

  • Upstream version 0.1.0 targets PostgreSQL 18 and requires PostgreSQL to be built with OpenSSL and libcurl.
  • Only JWT-shaped bearer tokens are accepted. Opaque access tokens are rejected.
  • Validation performs OIDC discovery and JWKS retrieval, so the PostgreSQL server must be able to reach the issuer over TLS.
  • The callback currently ignores the requested PostgreSQL role and authorizes based on successful token validation. Do not set delegate_ident_mapping=1 with this implementation; keep PostgreSQL’s standard exact-name or pg_ident.conf mapping so the returned token subject is checked against the requested role.
Last updated on