eclipse-ee4j / eclipse-ee4j/jersey
RolesAllowed should throw NotAuthorizedException when no authorisation exists
- Dominant language
- Java
- Stars
- 730
- Forks
- 382
- PR merge metrics
- No merged PRs in 30d
Description
In org.glassfish.jersey.server.filter.RolesAllowedDynamicFeature[line:139] it's throwing a javax.ws.rs.ForbiddenException however this set of my OCD alarm. I believe it should be a javax.ws.rs.NotAuthorizedException as by definition is does not have any authorisation. It even says it in the locale messages.
I believe this is related to #3090 which did recommend a javax.ws.rs.NotAuthorizedException but looks like it has been subsequently overwritten by #3180. There is a recent comment about this as the challenge is incorrect and not modifiable. Therefore this leads me to think we need this to be reverted and a way of setting the permissible challenges implemented.
#### Environment
ALL
#### Affected Versions
[2.22, 2.22.1, 2.22.2]
Contributor guide
Research direction
Start at org.glassfish.jersey.server.filter.RolesAllowedDynamicFeature line 139 and review the discussion in issues #3090 and #3180, including the comment about the incorrect challenge. Done means resolving the exception choice and providing a way to set permissible challenges, with behavior verified by the relevant existing tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- authorization
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100