Skip to content

[Devportal] Fix bug in idp authentication flow - #2851

Merged
Piumal1999 merged 2 commits into
wso2:mainfrom
Piumal1999:main
Jul 24, 2026
Merged

[Devportal] Fix bug in idp authentication flow#2851
Piumal1999 merged 2 commits into
wso2:mainfrom
Piumal1999:main

Conversation

@Piumal1999

Copy link
Copy Markdown
Contributor

Purpose

$subject
Also fixed a comment issue in the makefile

Approach

Corrected the org claim handling in IDP auth flow

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The pull request revises distribution-build annotations in both portals and changes IDP organization claim resolution to use session constants, configured nested claim mappings, and a fallback bearer-token field.

Changes

Distribution build annotations

Layer / File(s) Summary
Unified configuration build flow
portals/ai-workspace/Makefile, portals/developer-portal/Makefile
Comments and formatting around platform-api staging, configuration validation, unified config merging, template handling, and mount repointing were updated without changing commands.

IDP organization claim resolution

Layer / File(s) Summary
Organization claim extraction and export
portals/developer-portal/src/middlewares/passportConfig.js, portals/developer-portal/src/middlewares/authMiddleware.js
getNestedClaim is exported and used for configured bearer-token organization claims; IDP sessions require the organization claim constant, with HTTP 403 when absent.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant IDPSessionOrBearerToken
  participant authResolver
  participant getNestedClaim
  participant resolveOrgFromClaim
  IDPSessionOrBearerToken->>authResolver: provide session or bearer-token claims
  authResolver->>getNestedClaim: extract configured organization claim
  getNestedClaim-->>authResolver: return mapped claim or fallback
  authResolver->>resolveOrgFromClaim: resolve organization
  resolveOrgFromClaim-->>authResolver: return organization identifier or failure
Loading

Possibly related PRs

Suggested reviewers: renuka-fernando, thivindu, tharindu1st

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description only covers Purpose and Approach and omits most required template sections and details. Fill in Goals, User stories, Documentation, Automation tests, Security checks, Samples, Related PRs, and Test environment.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main IDP auth flow fix and the devportal scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@portals/developer-portal/src/middlewares/authMiddleware.js`:
- Around line 268-274: In
portals/developer-portal/src/middlewares/authMiddleware.js lines 268-274,
replace the missing session organization claim path in resolveOrgFromClaim with
the middleware’s standardized identical 401 Unauthorized JSON response instead
of next(err). Apply the same direct 401 JSON response to the missing
bearer-token claim path at lines 307-313; keep generic direct JSON 500 handling
reserved for organization lookup infrastructure failures.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e4fd30c0-b2f4-4e7d-9ad0-ea91086f3ac5

📥 Commits

Reviewing files that changed from the base of the PR and between a3a4c6f and 5f4a5c5.

📒 Files selected for processing (4)
  • portals/ai-workspace/Makefile
  • portals/developer-portal/Makefile
  • portals/developer-portal/src/middlewares/authMiddleware.js
  • portals/developer-portal/src/middlewares/passportConfig.js

Comment thread portals/developer-portal/src/middlewares/authMiddleware.js
@Piumal1999
Piumal1999 merged commit 9a5dfb3 into wso2:main Jul 24, 2026
10 checks 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.

2 participants