Skip to content

Commit

Permalink
bugfix: remove exception from registered features
Browse files Browse the repository at this point in the history
  • Loading branch information
lprimak committed Mar 23, 2024
1 parent 7512358 commit e1d4560
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void testGetUsersUnauthenticated() {
final Response usersResponse = usersTarget.request(MediaType.APPLICATION_JSON_TYPE)
.buildGet()
.invoke();
assertEquals(Status.UNAUTHORIZED.getStatusCode(), usersResponse.getStatus());
assertEquals(Status.FORBIDDEN.getStatusCode(), usersResponse.getStatus());
}

@SuppressWarnings({"checkstyle:MagicNumber"})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
*/
package org.apache.shiro.web.jaxrs;

import org.apache.shiro.authz.UnauthenticatedException;

import javax.ws.rs.core.Application;
import javax.ws.rs.core.Feature;
import javax.ws.rs.core.FeatureContext;
Expand All @@ -30,14 +28,14 @@
* Shiro JAX-RS feature which includes {@link UnauthorizedExceptionExceptionMapper}, {@link SubjectPrincipalRequestFilter}, and
* {@link ShiroAnnotationFilterFeature}.
* <p>
* Typically a JAX-RS {@link Application} class will include this Feature class in the
* Typically, a JAX-RS {@link Application} class will include this Feature class in the
* classes returned from {@link Application#getClasses()} method, for example:
* <blockquote><pre>
* public class SampleApplication extends Application {
*
* @Override
* public Set<Class<?>> getClasses() {
* Set<Class<?>> classes = new HashSet<Class<?>>();
* {@code @Override}
* {@code public Set<Class<?>>} getClasses() {
* {@code Set<Class<?>> classes = new HashSet<Class<?>>();}
*
* // register Shiro
* classes.add(ShiroFeature.class);
Expand All @@ -55,9 +53,8 @@ public class ShiroFeature implements Feature {

@Override
public boolean configure(FeatureContext context) {

context.register(UnauthenticatedExceptionExceptionMapper.class);
context.register(UnauthorizedExceptionExceptionMapper.class);
context.register(UnauthenticatedException.class);
context.register(SubjectPrincipalRequestFilter.class);
context.register(ShiroAnnotationFilterFeature.class);

Expand Down

0 comments on commit e1d4560

Please sign in to comment.