ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From v..@apache.org
Subject incubator-ranger git commit: RANGER-691 : Ranger Admin shouldn't expect users to be sync'ed for authentication
Date Thu, 02 Jun 2016 06:43:01 GMT
Repository: incubator-ranger
Updated Branches:
  refs/heads/master 6e02030ca -> 27a70dd1a


RANGER-691 : Ranger Admin shouldn't expect users to be sync'ed for authentication

Signed-off-by: Velmurugan Periasamy <vel@apache.org>


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

Branch: refs/heads/master
Commit: 27a70dd1a0cc82f7870d857f348ebf1786b65790
Parents: 6e02030
Author: pradeep agrawal <pradeep.agrawal@freestoneinfotech.com>
Authored: Mon May 30 09:15:23 2016 +0530
Committer: Velmurugan Periasamy <vel@apache.org>
Committed: Thu Jun 2 02:42:38 2016 -0400

----------------------------------------------------------------------
 .../src/main/java/org/apache/ranger/biz/XUserMgr.java       | 3 +++
 .../web/authentication/RangerAuthSuccessHandler.java        | 9 +++++++++
 2 files changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/27a70dd1/security-admin/src/main/java/org/apache/ranger/biz/XUserMgr.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/biz/XUserMgr.java b/security-admin/src/main/java/org/apache/ranger/biz/XUserMgr.java
index 5760e9d..e897178 100644
--- a/security-admin/src/main/java/org/apache/ranger/biz/XUserMgr.java
+++ b/security-admin/src/main/java/org/apache/ranger/biz/XUserMgr.java
@@ -98,6 +98,8 @@ import org.apache.ranger.view.VXUserGroupInfo;
 import org.apache.ranger.view.VXUserList;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
 
 import javax.servlet.http.HttpServletResponse;
 
@@ -1815,6 +1817,7 @@ public class XUserMgr extends XUserMgrBase {
 		}
 	}
 
+	@Transactional(readOnly = false, propagation = Propagation.REQUIRED)
     public VXUser createServiceConfigUser(String userName){
         if (userName == null || "null".equalsIgnoreCase(userName) || userName.trim().isEmpty())
{
                 logger.error("User Name: "+userName);

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/27a70dd1/security-admin/src/main/java/org/apache/ranger/security/web/authentication/RangerAuthSuccessHandler.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/security/web/authentication/RangerAuthSuccessHandler.java
b/security-admin/src/main/java/org/apache/ranger/security/web/authentication/RangerAuthSuccessHandler.java
index 877620b..8e41a39 100644
--- a/security-admin/src/main/java/org/apache/ranger/security/web/authentication/RangerAuthSuccessHandler.java
+++ b/security-admin/src/main/java/org/apache/ranger/security/web/authentication/RangerAuthSuccessHandler.java
@@ -30,6 +30,7 @@ import javax.servlet.http.HttpServletResponse;
 
 import org.apache.log4j.Logger;
 import org.apache.ranger.biz.SessionMgr;
+import org.apache.ranger.biz.XUserMgr;
 import org.apache.ranger.common.JSONUtil;
 import org.apache.ranger.common.PropertiesUtil;
 import org.apache.ranger.entity.XXAuthSession;
@@ -55,6 +56,9 @@ SavedRequestAwareAuthenticationSuccessHandler {
     @Autowired
     JSONUtil jsonUtil;
 
+	@Autowired
+	XUserMgr xUserMgr;
+
     public RangerAuthSuccessHandler() {
 	super();
 	if (ajaxLoginSuccessPage == null) {
@@ -85,6 +89,11 @@ SavedRequestAwareAuthenticationSuccessHandler {
     	String sessionId = details != null ? details.getSessionId() : "";
     	
     	boolean isValidUser = sessionMgr.isValidXAUser(authentication.getName());
+    	String rangerAuthenticationMethod=PropertiesUtil.getProperty("ranger.authentication.method","NONE");
+    	if(!isValidUser && !"NONE".equalsIgnoreCase(rangerAuthenticationMethod)){
+    		xUserMgr.createServiceConfigUser(authentication.getName());
+    		isValidUser = sessionMgr.isValidXAUser(authentication.getName());
+    	}
     	
     	response.setContentType("application/json;charset=UTF-8");
 		response.setHeader("Cache-Control", "no-cache");


Mime
View raw message