HBASE-12043 REST server should respond with FORBIDDEN(403) code on AccessDeniedException (Aditya Kishore)
This commit is contained in:
parent
7b7648322b
commit
e925348979
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue