percona / percona/pg_oidc_validator
Feature Request: Support for Pre-Obtained JWT Token Validation
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 36
- Forks
- 15
- PR merge metrics
- No merged PRs in 30d
Description
Add support for validating pre-obtained JWT access tokens from external OAuth flows, in addition to the current OAuth 2.0 Device Authorization Grant flow.
Use Case
We have a JupyterHub environment where users authenticate via Keycloak (which federates to ORCID as an identity provider). JupyterHub obtains valid JWT access tokens through the standard authorization code flow and makes these tokens available to user notebooks.
We want to use PostgreSQL's OAuth authentication to:
- Validate these pre-obtained JWT tokens
- Map authenticated identities to PostgreSQL users
- Apply row-level security policies based on the token claims
Current Limitation
The pg_oidc_validator extension currently only supports the OAuth 2.0 Device Authorization Grant flow via libpq. This is incompatible with workflows where valid JWT tokens are already obtained through other OAuth flows (authorization code, implicit, etc.).
Proposed Solution
New connection parameter
Add a connection parameter or configuration option to enable "token validation mode" or
Automatic detection
If password parameter contains a JWT (starts with eyJ), automatically validate it instead of initiating device flow.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the current OAuth 2.0 Device Authorization Grant flow through libpq and the extension's connection-parameter handling. Define how pre-obtained JWTs would be detected or selected, validated, mapped to PostgreSQL users, and exposed for row-level security, then confirm the behavior with tests for externally supplied tokens and the existing device flow.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, postgresql
- Domain
- authentication, database, security
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 38/100