Skip to content

feat: support multiple auth0 issuers for JWT verification#3978

Merged
skwowet merged 5 commits intomainfrom
feat/multi-issuer-oauth2
Mar 30, 2026
Merged

feat: support multiple auth0 issuers for JWT verification#3978
skwowet merged 5 commits intomainfrom
feat/multi-issuer-oauth2

Conversation

@skwowet
Copy link
Copy Markdown
Collaborator

@skwowet skwowet commented Mar 30, 2026

Summary

  • Allows the OAuth2 middleware to accept JWTs from multiple auth0 issuers by splitting a comma-separated CROWD_AUTH0_ISSUER_BASE_URLS env var.
  • Routes each request to the correct auth() handler by peeking at the JWT iss claim (base64 decode, no crypto overhead). Unknown issuers are rejected immediately.
  • Enables staging CDP to accept tokens from staging and dev auth0 domains so both environments can share it without mixing auth credentials.

Note

High Risk
High risk because it changes JWT verification/issuer validation in the public API auth middleware; misconfiguration or parsing edge cases could cause unintended auth failures or issuer acceptance.

Overview
Auth0 JWT verification now supports multiple issuers. The OAuth2 middleware switches from a single issuerBaseURL to a comma-separated issuerBaseURLs list, selecting the correct express-oauth2-jwt-bearer verifier per request by decoding the JWT iss claim.

Configuration is updated accordingly (new CROWD_AUTH0_ISSUER_BASE_URLS env var and Auth0Configuration.issuerBaseURLs), and requests with missing/malformed tokens or unknown issuers are rejected early.

Written by Cursor Bugbot for commit 34ae438. This will update automatically on new commits. Configure here.

Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
@skwowet skwowet self-assigned this Mar 30, 2026
Comment thread backend/src/api/public/middlewares/oauth2Middleware.ts Fixed
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
@skwowet skwowet marked this pull request as ready for review March 30, 2026 16:46
Copilot AI review requested due to automatic review settings March 30, 2026 16:46
@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

1 similar comment
@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds support for validating JWTs from multiple Auth0 issuers by selecting the appropriate express-oauth2-jwt-bearer verifier based on the token’s iss claim.

Changes:

  • Renames Auth0 config from a single issuerBaseURL to comma-separated issuerBaseURLs.
  • Updates OAuth2 middleware to parse issuerBaseURLs, resolve iss from the JWT payload, and dispatch to the matching verifier.
  • Updates environment variable mapping to use CROWD_AUTH0_ISSUER_BASE_URLS.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
backend/src/conf/configTypes.ts Renames Auth0 issuer config field to support multiple issuers.
backend/src/api/public/middlewares/oauth2Middleware.ts Routes verification to the correct Auth0 issuer handler using the JWT iss claim.
backend/config/custom-environment-variables.json Maps new multi-issuer env var name into config.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread backend/src/api/public/middlewares/oauth2Middleware.ts Outdated
Comment thread backend/src/api/public/middlewares/oauth2Middleware.ts
Comment thread backend/src/api/public/middlewares/oauth2Middleware.ts
Comment thread backend/src/api/public/middlewares/oauth2Middleware.ts Outdated
Comment thread backend/config/custom-environment-variables.json
@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

@skwowet skwowet merged commit dc94860 into main Mar 30, 2026
16 checks passed
@skwowet skwowet deleted the feat/multi-issuer-oauth2 branch March 30, 2026 17:05
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