RANGER-2091 : Good coding practice for ranger response codes

Signed-off-by: Mehul Parikh <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/ranger/commit/f21e2b4c
Tree: http://git-wip-us.apache.org/repos/asf/ranger/tree/f21e2b4c
Diff: http://git-wip-us.apache.org/repos/asf/ranger/diff/f21e2b4c

Branch: refs/heads/master
Commit: f21e2b4cfa61b9e2d4f28e35e0a965b99090bf6e
Parents: 666f6f6
Author: Nikhil P <[email protected]>
Authored: Thu May 3 16:27:36 2018 +0530
Committer: Mehul Parikh <[email protected]>
Committed: Fri May 4 17:25:44 2018 +0530

----------------------------------------------------------------------
 .../web/authentication/RangerAuthenticationEntryPoint.java       | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ranger/blob/f21e2b4c/security-admin/src/main/java/org/apache/ranger/security/web/authentication/RangerAuthenticationEntryPoint.java
----------------------------------------------------------------------
diff --git 
a/security-admin/src/main/java/org/apache/ranger/security/web/authentication/RangerAuthenticationEntryPoint.java
 
b/security-admin/src/main/java/org/apache/ranger/security/web/authentication/RangerAuthenticationEntryPoint.java
index de3891e..3e56d9f 100644
--- 
a/security-admin/src/main/java/org/apache/ranger/security/web/authentication/RangerAuthenticationEntryPoint.java
+++ 
b/security-admin/src/main/java/org/apache/ranger/security/web/authentication/RangerAuthenticationEntryPoint.java
@@ -86,8 +86,6 @@ public class RangerAuthenticationEntryPoint extends
                                .getRequestURL().toString() : "";
                String servletPath = PropertiesUtil.getProperty(
                                "ranger.servlet.mapping.url.pattern", 
"service");
-               String reqServletPath = configUtil.getWebAppRootURL() + "/"
-                               + servletPath;
 
                if ("XMLHttpRequest".equals(ajaxRequestHeader)) {
                        try {
@@ -127,7 +125,7 @@ public class RangerAuthenticationEntryPoint extends
                                                + ajaxReturnCode + ". URL=" + 
request.getRequestURI());
                        }
                        response.sendError(ajaxReturnCode, "");
-               } else if (!(requestURL.startsWith(reqServletPath))) {
+               } else if (!(requestURL.contains(servletPath))) {
                        
if(requestURL.contains(RangerSSOAuthenticationFilter.LOCAL_LOGIN_URL)){
                                if (request.getSession() != null){
                                        
request.getSession().setAttribute("locallogin","true");

Reply via email to