You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by co...@apache.org on 2017/01/16 15:34:37 UTC

incubator-ranger git commit: RANGER-1279 - Make static variable RangerCSRFPreventionFilter.IS_CSRF_ENABLED private - Reviewed by Don Bosco Durai.

Repository: incubator-ranger
Updated Branches:
  refs/heads/master 5357e9e5e -> f895f2a52


RANGER-1279 - Make static variable RangerCSRFPreventionFilter.IS_CSRF_ENABLED private
 - Reviewed by Don Bosco Durai.


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

Branch: refs/heads/master
Commit: f895f2a5292a4cd46a5a8f0b69b71682bfe0c1d9
Parents: 5357e9e
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Mon Jan 16 15:28:29 2017 +0000
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Mon Jan 16 15:28:29 2017 +0000

----------------------------------------------------------------------
 .../ranger/security/web/filter/RangerCSRFPreventionFilter.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/f895f2a5/security-admin/src/main/java/org/apache/ranger/security/web/filter/RangerCSRFPreventionFilter.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/security/web/filter/RangerCSRFPreventionFilter.java b/security-admin/src/main/java/org/apache/ranger/security/web/filter/RangerCSRFPreventionFilter.java
index 556e2dc..4942eb3 100644
--- a/security-admin/src/main/java/org/apache/ranger/security/web/filter/RangerCSRFPreventionFilter.java
+++ b/security-admin/src/main/java/org/apache/ranger/security/web/filter/RangerCSRFPreventionFilter.java
@@ -42,7 +42,6 @@ public class RangerCSRFPreventionFilter implements Filter {
 	
 	private static final Logger LOG = Logger.getLogger(RangerCSRFPreventionFilter.class);
 		
-	public static final boolean isCSRF_ENABLED = PropertiesUtil.getBooleanProperty("ranger.rest-csrf.enabled", true);
 	public static final String BROWSER_USER_AGENT_PARAM = "ranger.rest-csrf.browser-useragents-regex";
 	public static final String BROWSER_USER_AGENTS_DEFAULT = "^Mozilla.*,^Opera.*,^Chrome.*";
 	public static final String CUSTOM_METHODS_TO_IGNORE_PARAM = "ranger.rest-csrf.methods-to-ignore";
@@ -50,6 +49,7 @@ public class RangerCSRFPreventionFilter implements Filter {
 	public static final String CUSTOM_HEADER_PARAM = "ranger.rest-csrf.custom-header";
 	public static final String HEADER_DEFAULT = "X-XSRF-HEADER";
 	public static final String HEADER_USER_AGENT = "User-Agent";
+	private static final boolean IS_CSRF_ENABLED = PropertiesUtil.getBooleanProperty("ranger.rest-csrf.enabled", true);
 
 	private String  headerName = HEADER_DEFAULT;
 	private Set<String> methodsToIgnore = null;
@@ -57,7 +57,7 @@ public class RangerCSRFPreventionFilter implements Filter {
 	
 	public RangerCSRFPreventionFilter() {
 		try {
-			if (isCSRF_ENABLED){
+			if (IS_CSRF_ENABLED){
 				init(null);
 			}
 		} catch (Exception e) {
@@ -170,7 +170,7 @@ public class RangerCSRFPreventionFilter implements Filter {
 	}
 	
 	public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
-		if (isCSRF_ENABLED){
+		if (IS_CSRF_ENABLED) {
 			final HttpServletRequest httpRequest = (HttpServletRequest)request;
 		    final HttpServletResponse httpResponse = (HttpServletResponse)response;
 		    handleHttpInteraction(new ServletFilterHttpInteraction(httpRequest, httpResponse, chain));