Skip to content

Conversation

@cuzzlor
Copy link
Collaborator

@cuzzlor cuzzlor commented Dec 19, 2024

Problem to solve

We want to support access tokens from 2 distinct OIDC endpoints on a single API.

Note: this lib supports different verification options by host name; and additional issuers can be specified in verify options for a single JWKS URIs. The existing middleware and verification does not support multiple JWKS endpoints for the same host.

Proposal

  • Create a new middleware with a slightly different config structure, supporting multiple distinct OIDC endpoints keyed by issuer
  • When an auth header with bearer token is consumed, we:
    1. decode without verifying
    2. use the config for the token issuer
    3. verify the bearer token
  • note: we still support per-host verification options via a (host) => options callback
  • note: we cache JwksClients by the jwks URL

Also

  • Update everything to latest, including applying ts-toolkit, dual output rollup build etc
  • Make the @makerx/node-common Logger import via dev dependency, since we only import the type

Copy link
Member

@mderriey mderriey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it

@cuzzlor cuzzlor force-pushed the support-multiple-oidc-issuers-on-single-endpoint branch from b18fcb7 to 95a5bed Compare December 20, 2024 10:27
@cuzzlor cuzzlor marked this pull request as ready for review December 21, 2024 08:04
@cuzzlor cuzzlor changed the title Early draft WIP for supporting multiple OIDC providers (issuers) on a single endpoint Add support for multiple issuers (OIDC providers with different JWKS URIs) on a single endpoint Dec 21, 2024
@cuzzlor cuzzlor merged commit 176c6bc into main Dec 23, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants