Support OIDC Token introspection

Description

User Story

As a security administrator,

I want to validate OIDC tokens against an identity provider,

So that I can ensure only valid and non-expired tokens are used for authentication.

Problem Description

Without token validation, Percona Server for MongoDB could accept expired or invalid tokens, leading to security vulnerabilities.

Acceptance Criteria

  • The server verifies OIDC token signature and claims.

  • Token introspection follows the OpenID Connect specification.

  • Invalid or expired tokens result in authentication failure.

  • Public keys (JWKS) should be fetched dynamically from the IdP's OIDC discovery URL.

Out of scope

  • OIDC token permission check - in other words - The server doesn’t verify and map claims into user roles. We can assume it is always the grands Admin role or maps a hardcoded claim role.

  • Testing (QA verification) at this stage

Design / Solution Proposal

  • Use JWT libraries to validate token signatures and claims (e.g., expiration, issuer, audience):

    • 🔹 When a user provides an OIDC token, verify it using jwt-cpp:

      1. Extract token from the request header or authentication payload.

      2. Decode and validate JWT structure:

        • Check the issuer (iss) matches the configured OIDC provider.

        • Validate the audience (aud) to ensure the token was issued for MongoDB.

        • Check expiration (exp) and not-before (nbf) claims.

      3. Verify JWT signature using the public key (JWKS) fetched from the OIDC provider.

  • Introduce a configuration flag for token introspection.

  • Ensure the identity provider’s public keys (JWKS) are fetched and used for verification.

Environment

None

Smart Checklist

hide

Activity

radoslaw.szulgo 4 days ago

See the comment there - it might not necessarily be needed

Roshan Swain 4 days ago

Hi , sorry I didn’t see any notifications on this so pardon for late response.

Yes, I would love to pick one of those. I will start looking on the https://perconadev.atlassian.net/browse/PSMDB-1600. Thanks

radoslaw.szulgo March 20, 2025 at 5:24 PM

Hi ! Nice to meet you. It’s really nice you’d like to contribute and help us. We plan to start this particular task soon, and as it’s critical, we’ll take it on our side. Maybe you’d like to contribute to other tasks such as: https://perconadev.atlassian.net/browse/PSMDB-1600 or https://perconadev.atlassian.net/browse/PSMDB-1607 ?

Roshan Swain March 20, 2025 at 5:02 PM

Would like to work on this. Can you please assign this?

Details

Assignee

Reporter

Labels

Needs QA

No

Smart Checklist Progress

Story Points

Priority

Smart Checklist

Created February 10, 2025 at 1:02 PM
Updated 4 days ago

Flag notifications