[Devportal] Fix bug in idp authentication flow - #2851
Conversation
📝 WalkthroughWalkthroughThe 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. ChangesDistribution build annotations
IDP organization claim resolution
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
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (4)
portals/ai-workspace/Makefileportals/developer-portal/Makefileportals/developer-portal/src/middlewares/authMiddleware.jsportals/developer-portal/src/middlewares/passportConfig.js
Purpose
$subject
Also fixed a comment issue in the makefile
Approach
Corrected the org claim handling in IDP auth flow