Skip to content
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.FORBIDDEN.getStatusCode(), usersResponse.getStatus());
assertEquals(Status.UNAUTHORIZED.getStatusCode(), usersResponse.getStatus());
}

@SuppressWarnings({"checkstyle:MagicNumber"})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ public Response toResponse(UnauthenticatedException exception) {
LOG.debug("unauthenticated.", exception);
}

return Response.status(Status.FORBIDDEN).build();
return Response.status(Status.UNAUTHORIZED).build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ public class UnauthorizedExceptionExceptionMapper implements ExceptionMapper<Una
public Response toResponse(UnauthorizedException exception) {

if (LOG.isDebugEnabled()) {
LOG.debug("unauthenticated.", exception);
LOG.debug("unauthorized.", exception);
}

return Response.status(Status.UNAUTHORIZED).build();
return Response.status(Status.FORBIDDEN).build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ class UnauthorizedExceptionExceptionMapperTest {

@Test
void testUnauthorizedException() {
doTest(new UnauthorizedException("expected test exception."), Response.Status.UNAUTHORIZED, new UnauthorizedExceptionExceptionMapper())
doTest(new HostUnauthorizedException("expected test exception."), Response.Status.UNAUTHORIZED, new UnauthorizedExceptionExceptionMapper())
doTest(new UnauthenticatedException("expected test exception."), Response.Status.FORBIDDEN, new UnauthenticatedExceptionExceptionMapper())
doTest(new UnauthorizedException("expected test exception."), Response.Status.FORBIDDEN, new UnauthorizedExceptionExceptionMapper())
doTest(new HostUnauthorizedException("expected test exception."), Response.Status.FORBIDDEN, new UnauthorizedExceptionExceptionMapper())
doTest(new UnauthenticatedException("expected test exception."), Response.Status.UNAUTHORIZED, new UnauthenticatedExceptionExceptionMapper())
}

private static void doTest(AuthorizationException exception, Response.StatusType expectedStatus, ExceptionMapper<? extends Throwable> exceptionMapper) {
Expand Down