Skip to content

[Customer Portal] Fix unauthorized access response status - #78

Merged
Rashmika998 merged 1 commit into
wso2-open-operations:customer-portal-milestone-1from
Rashmika998:customer-portal-milestone-1-dev-1
Feb 2, 2026
Merged

Rashmika998 merged 1 commit into
wso2-open-operations:customer-portal-milestone-1from
Rashmika998:customer-portal-milestone-1-dev-1

Conversation

@Rashmika998

@Rashmika998 Rashmika998 commented Jan 31, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR updates the access validation logic to return 401 Unauthorized instead of 403 Forbidden when a user is not authorized to access the Customer Portal.

Previously, unauthorized access attempts were incorrectly handled as forbidden responses.

Changes

  • Updated access validation to return 401 Unauthorized for unauthorized users.
  • Updated error message for unauthorized access responses.

Impact

  • Improves correctness of HTTP status codes with entity response.

Related Issues

Summary by CodeRabbit

  • Bug Fixes
    • Corrected HTTP status codes and error messaging for authentication failures in the user profile endpoint to accurately reflect unauthorized access attempts.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Jan 31, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The GET users/me endpoint's error response handling is updated to return http:Unauthorized instead of http:Forbidden when user details retrieval fails, with corresponding log messages and error body text modified to reflect this change.

Changes

Cohort / File(s) Summary
Authorization Response Update
apps/customer-portal/backend/service.bal
Modified users/me endpoint to return http:Unauthorized (401) instead of http:Forbidden (403) on failed user details retrieval; updated error status check, log message, and response body text accordingly.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

Type/Improvement

Suggested reviewers

  • suhand
  • shayanmalinda

Poem

🐰 A status code swap, so neat and tidy,
From Forbidden's walls to Unauthorized's entry,
The portal now speaks with clarity bright,
Distinguishing who lacks the right,
401 instead of 403—oh what a delight! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request description provides a clear purpose, changes summary, and impact statement, but lacks several required template sections. Add missing sections: Goals, Approach, User stories, Release note, Documentation, Training, Certification, Marketing, Automation tests, Security checks, Samples, Related PRs, Migrations, Test environment, and Learning. At minimum, provide N/A with explanations for sections not applicable.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: fixing the HTTP response status for unauthorized access from 403 to 401 in the Customer Portal.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 and usage tips.

Copilot AI 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.

Pull request overview

Updates the Customer Portal /users/me endpoint to respond with 401 Unauthorized (instead of 403 Forbidden) for unauthorized access attempts, aligning behavior with the expected HTTP status semantics described in Issue #79.

Changes:

  • Updated /users/me resource return type to include http:Unauthorized instead of http:Forbidden.
  • Updated the status-code mapping logic and the returned error message for unauthorized access.

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

Comment thread apps/customer-portal/backend/service.bal
Comment thread apps/customer-portal/backend/service.bal
@Rashmika998
Rashmika998 merged commit ba76bc1 into wso2-open-operations:customer-portal-milestone-1 Feb 2, 2026
7 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Customer Portal Development Feb 2, 2026
@Rashmika998 Rashmika998 moved this from Done to Staging Deployed in Customer Portal Development Feb 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Staging Deployed

Development

Successfully merging this pull request may close these issues.

4 participants