-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(app): Error details missing when user type is unknown #1493
fix(app): Error details missing when user type is unknown #1493
Conversation
📝 WalkthroughWalkthroughThe Changes
Possibly related PRs
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
Quality Gate passedIssues Measures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (2)
src/Digdir.Domain.Dialogporten.WebApi/Common/Authentication/UserTypeValidationMiddleware.cs (2)
24-31
: LGTM! Consider externalizing the error message.The changes correctly address the missing error details issue by properly constructing and writing the response. However, the error message is hardcoded which could make maintenance and localization more difficult.
Consider moving the error message to a resource file or constants class:
- "The request was authenticated, but we were unable to determine valid user type (person or system user) in order to authorize the request." + ErrorMessages.UnknownUserTypeValidation
24-31
: Add tests as mentioned in PR objectives.The PR objectives mention that automated tests haven't been added. Since this is error handling code, it's important to verify that the error details are correctly included in various scenarios.
Would you like me to help generate unit tests for this middleware? We should cover scenarios like:
- Unknown user type returning proper error details
- Valid user type passing through to next middleware
- Unauthenticated requests passing through
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (1)
src/Digdir.Domain.Dialogporten.WebApi/Common/Authentication/UserTypeValidationMiddleware.cs
(1 hunks)
🤖 I have created a release *beep* *boop* --- ## [1.36.0](v1.35.0...v1.36.0) (2024-11-19) ### Features * **azure:** create azure monitor workspace ([#1485](#1485)) ([da0aa8f](da0aa8f)) ### Bug Fixes * **app:** Error details missing when user type is unknown ([#1493](#1493)) ([9fbd2cf](9fbd2cf)) * **azure:** enable public access for azure monitor ([#1496](#1496)) ([b0d5794](b0d5794)) * **azure:** ensure monitor workspace is reachable ([#1494](#1494)) ([dc7fc1f](dc7fc1f)) * **webapi:** Require base service provider scope on search endpoint ([#1476](#1476)) ([8c41f3d](8c41f3d)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Description
Errors list is missing in error details when user type is unknown
Related Issue(s)
Verification
Documentation
docs
-directory, Altinnpedia or a separate linked PR in altinn-studio-docs., if applicable)Summary by CodeRabbit
Bug Fixes
Refactor