Skip to content
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

[#1383] bugfix: fix exception mapper type from registered features #1384

Merged
merged 1 commit into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
lprimak marked this conversation as resolved.
Show resolved Hide resolved
context.register(SubjectPrincipalRequestFilter.class);
context.register(ShiroAnnotationFilterFeature.class);

Expand Down
Loading