OAuth 2.0 is now native. Row-Level Security is your firewall. Zero-Trust is no longer optional.
PostgreSQL 18 (released September 2025) finally ships native OAuth 2.0 authentication. No more password sprawl. No more custom JWT middleware. The database itself now validates bearer tokens from Okta, Auth0, Azure AD, Keycloak, or your internal IdP.
Combine that with battle-tested Row-Level Security and true Zero-Trust principles, and you can run multi-tenant SaaS, internal tools, and regulated workloads with confidence.
Say goodbye to database passwords. PostgreSQL now acts as an OAuth resource server using the SASL OAUTHBEARER mechanism.
oauth_validator_libraries = 'okta_validator,auth0_validator'
host all all 0.0.0.0/0 oauth
issuer=https://auth.company.com
scope="openid profile email"
validator=okta_validator
map=oauth_user_map
Tokens are validated via a pluggable validator module (C or Rust). You can verify JWTs offline or call introspection endpoints.
PostgreSQL handles discovery via .well-known/openid-configuration.
ALTER TABLE customers ENABLE ROW LEVEL SECURITY;
CREATE POLICY tenant_isolation ON customers
USING (tenant_id = current_setting('app.tenant_id')::uuid)
WITH CHECK (tenant_id = current_setting('app.tenant_id')::uuid);
CREATE POLICY user_owns_row ON orders
FOR ALL TO authenticated
USING (user_id = current_user::uuid);
Multiple policies = OR (default)
All policies must pass (AND)
Even table owners obey policies
shared_preload_libraries = 'pgaudit'
pgaudit.log = 'all, -misc'
pgaudit.log_parameter = on