diff --git a/integration-tests/jaxrs/tests/src/main/java/org/apache/shiro/testing/jaxrs/tests/AbstractShiroJaxRsIT.java b/integration-tests/jaxrs/tests/src/main/java/org/apache/shiro/testing/jaxrs/tests/AbstractShiroJaxRsIT.java index 888074fd44..9758c9d66a 100644 --- a/integration-tests/jaxrs/tests/src/main/java/org/apache/shiro/testing/jaxrs/tests/AbstractShiroJaxRsIT.java +++ b/integration-tests/jaxrs/tests/src/main/java/org/apache/shiro/testing/jaxrs/tests/AbstractShiroJaxRsIT.java @@ -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"}) diff --git a/support/jaxrs/src/main/java/org/apache/shiro/web/jaxrs/ShiroFeature.java b/support/jaxrs/src/main/java/org/apache/shiro/web/jaxrs/ShiroFeature.java index 8274e76455..8de8be8723 100644 --- a/support/jaxrs/src/main/java/org/apache/shiro/web/jaxrs/ShiroFeature.java +++ b/support/jaxrs/src/main/java/org/apache/shiro/web/jaxrs/ShiroFeature.java @@ -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; @@ -30,14 +28,14 @@ * Shiro JAX-RS feature which includes {@link UnauthorizedExceptionExceptionMapper}, {@link SubjectPrincipalRequestFilter}, and * {@link ShiroAnnotationFilterFeature}. *

- * 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: *

  *     public class SampleApplication extends Application {
  *
- *         @Override
- *         public Set> getClasses() {
- *             Set> classes = new HashSet>();
+ *         {@code @Override}
+ *         {@code public Set>} getClasses() {
+ *             {@code Set> classes = new HashSet>();}
  *
  *             // register Shiro
  *             classes.add(ShiroFeature.class);
@@ -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);