BUG-61224 : Even if service creation is failed then also 200 Response status code is returned
Signed-off-by: Velmurugan Periasamy <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/29faab04 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/29faab04 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/29faab04 Branch: refs/heads/master Commit: 29faab04b0e6d5913f98fabdc3e41fc0d1879d0f Parents: 77b101f Author: Ankita Sinha <[email protected]> Authored: Wed Jul 6 15:27:06 2016 +0530 Committer: Velmurugan Periasamy <[email protected]> Committed: Wed Jul 6 13:11:10 2016 -0400 ---------------------------------------------------------------------- .../security/web/filter/RangerKRBAuthenticationFilter.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/29faab04/security-admin/src/main/java/org/apache/ranger/security/web/filter/RangerKRBAuthenticationFilter.java ---------------------------------------------------------------------- diff --git a/security-admin/src/main/java/org/apache/ranger/security/web/filter/RangerKRBAuthenticationFilter.java b/security-admin/src/main/java/org/apache/ranger/security/web/filter/RangerKRBAuthenticationFilter.java index 0351694..d28608c 100644 --- a/security-admin/src/main/java/org/apache/ranger/security/web/filter/RangerKRBAuthenticationFilter.java +++ b/security-admin/src/main/java/org/apache/ranger/security/web/filter/RangerKRBAuthenticationFilter.java @@ -55,6 +55,7 @@ import javax.servlet.http.HttpServletResponse; import org.apache.commons.collections.iterators.IteratorEnumeration; import org.apache.ranger.biz.UserMgr; import org.apache.ranger.common.PropertiesUtil; +import org.apache.ranger.common.RESTErrorUtil; import org.apache.ranger.security.handler.RangerAuthenticationProvider; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -78,6 +79,9 @@ public class RangerKRBAuthenticationFilter extends RangerKrbFilter { @Autowired UserMgr userMgr; + @Autowired + RESTErrorUtil restErrorUtil; + static final String NAME_RULES = "hadoop.security.auth_to_local"; static final String TOKEN_VALID = "ranger.admin.kerberos.token.valid.seconds"; static final String COOKIE_DOMAIN = "ranger.admin.kerberos.cookie.domain"; @@ -219,7 +223,7 @@ public class RangerKRBAuthenticationFilter extends RangerKrbFilter { try{ super.doFilter(filterChain, request, response); }catch(Exception e){ - LOG.error("Error RangerKRBAuthenticationFilter : "+e.getMessage()); + throw restErrorUtil.createRESTException("RangerKRBAuthenticationFilter Failed : "+e.getMessage()); } } }else{ @@ -280,7 +284,7 @@ public class RangerKRBAuthenticationFilter extends RangerKrbFilter { try{ super.doFilter(request, response, filterChain); }catch(Exception e){ - LOG.error("Error RangerKRBAuthenticationFilter : "+e.getMessage()); + throw restErrorUtil.createRESTException("RangerKRBAuthenticationFilter Failed : "+e.getMessage()); } } }else{
