HBASE-12043 REST server should respond with FORBIDDEN(403) code on AccessDeniedException (Aditya Kishore)

This commit is contained in:
Andrew Purtell 2014-09-22 17:37:19 -07:00
parent 7b7648322b
commit e925348979
1 changed files with 5 additions and 2 deletions

View File

@ -50,8 +50,11 @@ public class ResourceBase implements Constants {
//some access denied exceptions are buried //some access denied exceptions are buried
while (curr != null) { while (curr != null) {
if(accessDeniedClazz.isAssignableFrom(curr.getClass())) { if(accessDeniedClazz.isAssignableFrom(curr.getClass())) {
throw new SecurityException("Unauthorized" + CRLF + throw new WebApplicationException(
StringUtils.stringifyException(exp) + CRLF); Response.status(Response.Status.FORBIDDEN)
.type(MIMETYPE_TEXT).entity("Forbidden" + CRLF +
StringUtils.stringifyException(exp) + CRLF)
.build());
} }
curr = curr.getCause(); curr = curr.getCause();
} }