You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by pr...@apache.org on 2020/06/10 07:57:41 UTC

[ranger] branch master updated (8087992 -> 297e8b9)

This is an automated email from the ASF dual-hosted git repository.

pradeep pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/ranger.git.


    from 8087992  RANGER-2839: Assorted improvements for debugging and handling of thread terminations, clean-up of unused data, etc - Part 2
     new f246f43  RANGER-2851: Remove CRLF characters from ranger files
     new 297e8b9  RANGER-2853: fix NPE error in ranger admin when enable ranger kms

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../main/java/org/apache/ranger/biz/BaseMgr.java   | 102 ++++-----
 .../main/java/org/apache/ranger/biz/KmsKeyMgr.java |  31 +--
 .../security/context/RangerContextHolder.java      |  52 ++---
 .../security/context/RangerSecurityContext.java    |  70 +++---
 .../security/listener/SpringEventListener.java     | 154 ++++++-------
 .../standalone/StandaloneSecurityHandler.java      |  84 +++----
 ...RangerUsernamePasswordAuthenticationFilter.java |  60 ++---
 .../resources/META-INF/infinispan-cache-config.xml |  46 ++--
 .../unixusersync/poc/InvalidGroupException.java    |  38 ++--
 .../unixusersync/poc/InvalidUserException.java     |  38 ++--
 .../ranger/unixusersync/poc/ListRangerUser.java    | 193 ++++++++--------
 .../unixusersync/poc/ListRangerUserGroup.java      | 245 ++++++++++-----------
 .../ranger/unixusersync/poc/ListUserGroupTest.java |  38 ++--
 .../ranger/unixusersync/poc/ListUserTest.java      | 105 +++++----
 .../poc/RangerClientUserGroupMapping.java          | 142 ++++++------
 .../ranger/unixusersync/poc/RangerJSONParser.java  |  88 ++++----
 .../unixusersync/poc/RangerUserGroupMapping.java   | 130 ++++++-----
 .../ranger/unixusersync/poc/RestClientPost.java    |  70 +++---
 18 files changed, 841 insertions(+), 845 deletions(-)


[ranger] 01/02: RANGER-2851: Remove CRLF characters from ranger files

Posted by pr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

pradeep pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ranger.git

commit f246f4397f2a2c8bfa596a2b0dada0874c77e6aa
Author: pradeep <pr...@apache.org>
AuthorDate: Wed Jun 10 12:46:52 2020 +0530

    RANGER-2851: Remove CRLF characters from ranger files
---
 .../main/java/org/apache/ranger/biz/BaseMgr.java   | 102 ++++-----
 .../main/java/org/apache/ranger/biz/KmsKeyMgr.java |  30 +--
 .../security/context/RangerContextHolder.java      |  52 ++---
 .../security/context/RangerSecurityContext.java    |  70 +++---
 .../security/listener/SpringEventListener.java     | 154 ++++++-------
 .../standalone/StandaloneSecurityHandler.java      |  84 +++----
 ...RangerUsernamePasswordAuthenticationFilter.java |  60 ++---
 .../resources/META-INF/infinispan-cache-config.xml |  46 ++--
 .../unixusersync/poc/InvalidGroupException.java    |  38 ++--
 .../unixusersync/poc/InvalidUserException.java     |  38 ++--
 .../ranger/unixusersync/poc/ListRangerUser.java    | 193 ++++++++--------
 .../unixusersync/poc/ListRangerUserGroup.java      | 245 ++++++++++-----------
 .../ranger/unixusersync/poc/ListUserGroupTest.java |  38 ++--
 .../ranger/unixusersync/poc/ListUserTest.java      | 105 +++++----
 .../poc/RangerClientUserGroupMapping.java          | 142 ++++++------
 .../ranger/unixusersync/poc/RangerJSONParser.java  |  88 ++++----
 .../unixusersync/poc/RangerUserGroupMapping.java   | 130 ++++++-----
 .../ranger/unixusersync/poc/RestClientPost.java    |  70 +++---
 18 files changed, 840 insertions(+), 845 deletions(-)

diff --git a/security-admin/src/main/java/org/apache/ranger/biz/BaseMgr.java b/security-admin/src/main/java/org/apache/ranger/biz/BaseMgr.java
index 0f5206a..d8b5da3 100644
--- a/security-admin/src/main/java/org/apache/ranger/biz/BaseMgr.java
+++ b/security-admin/src/main/java/org/apache/ranger/biz/BaseMgr.java
@@ -17,11 +17,11 @@
  * under the License.
  */
 
- /**
- *
- */
-package org.apache.ranger.biz;
-
+ /**
+ *
+ */
+package org.apache.ranger.biz;
+
 import org.apache.log4j.Logger;
 import org.apache.ranger.common.MessageEnums;
 import org.apache.ranger.common.RESTErrorUtil;
@@ -31,49 +31,49 @@ import org.apache.ranger.db.RangerDaoManager;
 import org.apache.ranger.entity.XXDBBase;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
-
-@Component
-public abstract class BaseMgr {
-    static final Logger logger = Logger.getLogger(BaseMgr.class);
-
-    @Autowired
-    RangerDaoManager daoManager;
-
-    @Autowired
-    RESTErrorUtil restErrorUtil;
-
-    public RangerDaoManager getDaoManager() {
-	return daoManager;
-    }
-
-    public void deleteEntity(BaseDao<? extends XXDBBase> baseDao, Long id,
-	    String entityName) {
-	XXDBBase entity = baseDao.getById(id);
-	if (entity != null) {
-	    try {
-		baseDao.remove(id);
-	    } catch (Exception e) {
-		logger.error("Error deleting " + entityName + ". Id=" + id, e);
-		throw restErrorUtil.createRESTException("This " + entityName
-			+ " can't be deleted",
-			MessageEnums.OPER_NOT_ALLOWED_FOR_STATE, id, null, ""
-				+ id + ", error=" + e.getMessage());
-	    }
-	} else {
-	    // Return without error
-	    logger.info("Delete ignored for non-existent " + entityName
-		    + " id=" + id);
-	}
-    }
-
-    /**
-     * @param objectClassType
-     */
-    protected void validateClassType(int objectClassType) {
-	// objectClassType
-	restErrorUtil.validateMinMax(objectClassType, 1,
-		RangerConstants.ClassTypes_MAX, "Invalid classType", null,
-		"objectClassType");
-    }
-
-}
+
+@Component
+public abstract class BaseMgr {
+    static final Logger logger = Logger.getLogger(BaseMgr.class);
+
+    @Autowired
+    RangerDaoManager daoManager;
+
+    @Autowired
+    RESTErrorUtil restErrorUtil;
+
+    public RangerDaoManager getDaoManager() {
+	return daoManager;
+    }
+
+    public void deleteEntity(BaseDao<? extends XXDBBase> baseDao, Long id,
+	    String entityName) {
+	XXDBBase entity = baseDao.getById(id);
+	if (entity != null) {
+	    try {
+		baseDao.remove(id);
+	    } catch (Exception e) {
+		logger.error("Error deleting " + entityName + ". Id=" + id, e);
+		throw restErrorUtil.createRESTException("This " + entityName
+			+ " can't be deleted",
+			MessageEnums.OPER_NOT_ALLOWED_FOR_STATE, id, null, ""
+				+ id + ", error=" + e.getMessage());
+	    }
+	} else {
+	    // Return without error
+	    logger.info("Delete ignored for non-existent " + entityName
+		    + " id=" + id);
+	}
+    }
+
+    /**
+     * @param objectClassType
+     */
+    protected void validateClassType(int objectClassType) {
+	// objectClassType
+	restErrorUtil.validateMinMax(objectClassType, 1,
+		RangerConstants.ClassTypes_MAX, "Invalid classType", null,
+		"objectClassType");
+    }
+
+}
diff --git a/security-admin/src/main/java/org/apache/ranger/biz/KmsKeyMgr.java b/security-admin/src/main/java/org/apache/ranger/biz/KmsKeyMgr.java
index 84cee5c..79c7eaf 100755
--- a/security-admin/src/main/java/org/apache/ranger/biz/KmsKeyMgr.java
+++ b/security-admin/src/main/java/org/apache/ranger/biz/KmsKeyMgr.java
@@ -555,27 +555,27 @@ public class KmsKeyMgr {
 		return providers;
 	}
 	
-	private Subject getSubjectForKerberos(String provider) throws Exception{
+	private Subject getSubjectForKerberos(String provider) throws Exception {
 		String userName = getKMSUserName(provider);
 		String password = getKMSPassword(provider);
 		String nameRules = PropertiesUtil.getProperty(NAME_RULES);
-	    if (StringUtils.isEmpty(nameRules)) {
-        	KerberosName.setRules("DEFAULT");
-    	}else{
-    		KerberosName.setRules(nameRules);
-    	}
-	    Subject sub = new Subject();
-	    String rangerPrincipal = SecureClientLogin.getPrincipal(PropertiesUtil.getProperty(ADMIN_USER_PRINCIPAL), PropertiesUtil.getProperty(HOST_NAME));
-	    if (checkKerberos()) {
-	    	if(SecureClientLogin.isKerberosCredentialExists(rangerPrincipal, PropertiesUtil.getProperty(ADMIN_USER_KEYTAB))){
-	    		sub = SecureClientLogin.loginUserFromKeytab(rangerPrincipal, PropertiesUtil.getProperty(ADMIN_USER_KEYTAB), nameRules);
-	    	}else{
-	    		sub = SecureClientLogin.loginUserWithPassword(userName, password);
-	    	}
+		if (StringUtils.isEmpty(nameRules)) {
+			KerberosName.setRules("DEFAULT");
+		} else {
+			KerberosName.setRules(nameRules);
+		}
+		Subject sub = new Subject();
+		String rangerPrincipal = SecureClientLogin.getPrincipal(PropertiesUtil.getProperty(ADMIN_USER_PRINCIPAL), PropertiesUtil.getProperty(HOST_NAME));
+		if (checkKerberos()) {
+			if (SecureClientLogin.isKerberosCredentialExists(rangerPrincipal, PropertiesUtil.getProperty(ADMIN_USER_KEYTAB))) {
+				sub = SecureClientLogin.loginUserFromKeytab(rangerPrincipal, PropertiesUtil.getProperty(ADMIN_USER_KEYTAB), nameRules);
+			} else {
+				sub = SecureClientLogin.loginUserWithPassword(userName, password);
+			}
 		} else {
 			sub = SecureClientLogin.login(userName);
 		}
-        return sub;
+		return sub;
 	}
 
 	private String getKMSPassword(String srvName) throws Exception {
diff --git a/security-admin/src/main/java/org/apache/ranger/security/context/RangerContextHolder.java b/security-admin/src/main/java/org/apache/ranger/security/context/RangerContextHolder.java
index 865a849..e42dc24 100644
--- a/security-admin/src/main/java/org/apache/ranger/security/context/RangerContextHolder.java
+++ b/security-admin/src/main/java/org/apache/ranger/security/context/RangerContextHolder.java
@@ -17,32 +17,32 @@
  * under the License.
  */
 
- /**
- *
- */
-package org.apache.ranger.security.context;
-
-public class RangerContextHolder {
-
-    private static final ThreadLocal<RangerSecurityContext> securityContextThreadLocal = new ThreadLocal<RangerSecurityContext>();
-
+ /**
+ *
+ */
+package org.apache.ranger.security.context;
+
+public class RangerContextHolder {
+
+    private static final ThreadLocal<RangerSecurityContext> securityContextThreadLocal = new ThreadLocal<RangerSecurityContext>();
+
     private static final ThreadLocal<RangerAdminOpContext> operationContextThreadLocal = new ThreadLocal<RangerAdminOpContext>();
 
-    private RangerContextHolder() {
-
-    }
-
-    public static RangerSecurityContext getSecurityContext(){
-	return securityContextThreadLocal.get();
-    }
-
-    public static void setSecurityContext(RangerSecurityContext context){
-	securityContextThreadLocal.set(context);
-    }
-
-    public static void resetSecurityContext(){
-	securityContextThreadLocal.remove();
-    }
+    private RangerContextHolder() {
+
+    }
+
+    public static RangerSecurityContext getSecurityContext(){
+	return securityContextThreadLocal.get();
+    }
+
+    public static void setSecurityContext(RangerSecurityContext context){
+	securityContextThreadLocal.set(context);
+    }
+
+    public static void resetSecurityContext(){
+	securityContextThreadLocal.remove();
+    }
 
 	public static RangerAdminOpContext getOpContext() {
 		return operationContextThreadLocal.get();
@@ -54,5 +54,5 @@ public class RangerContextHolder {
 
 	public static void resetOpContext() {
 		operationContextThreadLocal.remove();
-	}
-}
+	}
+}
diff --git a/security-admin/src/main/java/org/apache/ranger/security/context/RangerSecurityContext.java b/security-admin/src/main/java/org/apache/ranger/security/context/RangerSecurityContext.java
index 4f42521..1cf1ac5 100644
--- a/security-admin/src/main/java/org/apache/ranger/security/context/RangerSecurityContext.java
+++ b/security-admin/src/main/java/org/apache/ranger/security/context/RangerSecurityContext.java
@@ -17,42 +17,42 @@
  * under the License.
  */
 
- /**
- *
- */
-package org.apache.ranger.security.context;
-
+ /**
+ *
+ */
+package org.apache.ranger.security.context;
+
 import java.io.Serializable;
 
 import org.apache.ranger.common.RequestContext;
 import org.apache.ranger.common.UserSessionBase;
-
-public class RangerSecurityContext implements Serializable{
-    private static final long serialVersionUID = 1L;
-    private UserSessionBase userSession;
-    private RequestContext requestContext;
-
-    public UserSessionBase getUserSession() {
-        return userSession;
-    }
-
-    public void setUserSession(UserSessionBase userSession) {
-        this.userSession = userSession;
-    }
-
-    /**
-     * @return the requestContext
-     */
-    public RequestContext getRequestContext() {
-        return requestContext;
-    }
-
-    /**
-     * @param requestContext the requestContext to set
-     */
-    public void setRequestContext(RequestContext requestContext) {
-        this.requestContext = requestContext;
-    }
-
-
-}
+
+public class RangerSecurityContext implements Serializable{
+    private static final long serialVersionUID = 1L;
+    private UserSessionBase userSession;
+    private RequestContext requestContext;
+
+    public UserSessionBase getUserSession() {
+        return userSession;
+    }
+
+    public void setUserSession(UserSessionBase userSession) {
+        this.userSession = userSession;
+    }
+
+    /**
+     * @return the requestContext
+     */
+    public RequestContext getRequestContext() {
+        return requestContext;
+    }
+
+    /**
+     * @param requestContext the requestContext to set
+     */
+    public void setRequestContext(RequestContext requestContext) {
+        this.requestContext = requestContext;
+    }
+
+
+}
diff --git a/security-admin/src/main/java/org/apache/ranger/security/listener/SpringEventListener.java b/security-admin/src/main/java/org/apache/ranger/security/listener/SpringEventListener.java
index 8dd1d8d..a4bed5f 100644
--- a/security-admin/src/main/java/org/apache/ranger/security/listener/SpringEventListener.java
+++ b/security-admin/src/main/java/org/apache/ranger/security/listener/SpringEventListener.java
@@ -17,8 +17,8 @@
  * under the License.
  */
 
- package org.apache.ranger.security.listener;
-
+ package org.apache.ranger.security.listener;
+
 import java.util.Calendar;
 import org.apache.log4j.Logger;
 import org.apache.ranger.biz.SessionMgr;
@@ -31,82 +31,82 @@ import org.springframework.security.authentication.event.AuthenticationFailureDi
 import org.springframework.security.authentication.event.AuthenticationSuccessEvent;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.web.authentication.WebAuthenticationDetails;
-
-
-public class SpringEventListener implements
-	ApplicationListener<AbstractAuthenticationEvent> {
-
-    private static final Logger logger = Logger.getLogger(SpringEventListener.class);
-
-    @Autowired
-    SessionMgr sessionMgr;
-
-    @Override
-    public void onApplicationEvent(AbstractAuthenticationEvent event) {
-	try {
-	    if (event instanceof AuthenticationSuccessEvent) {
-		process((AuthenticationSuccessEvent) event);
-	    } else if (event instanceof AuthenticationFailureBadCredentialsEvent) {
-		process((AuthenticationFailureBadCredentialsEvent) event);
-	    } else if (event instanceof AuthenticationFailureDisabledEvent) {
-		process((AuthenticationFailureDisabledEvent) event);
-	    }
-	    // igonre all other events
-
-	} catch (Exception e) {
-	    logger.error("Exception in Spring Event Listener.", e);
-	}
-    }
-
-    protected void process(AuthenticationSuccessEvent authSuccessEvent) {
-	Authentication auth = authSuccessEvent.getAuthentication();
-	WebAuthenticationDetails details = (WebAuthenticationDetails) auth
-		.getDetails();
-	String remoteAddress = details != null ? details.getRemoteAddress()
-		: "";
-	String sessionId = details != null ? details.getSessionId() : "";
-
+
+
+public class SpringEventListener implements
+	ApplicationListener<AbstractAuthenticationEvent> {
+
+    private static final Logger logger = Logger.getLogger(SpringEventListener.class);
+
+    @Autowired
+    SessionMgr sessionMgr;
+
+    @Override
+    public void onApplicationEvent(AbstractAuthenticationEvent event) {
+	try {
+	    if (event instanceof AuthenticationSuccessEvent) {
+		process((AuthenticationSuccessEvent) event);
+	    } else if (event instanceof AuthenticationFailureBadCredentialsEvent) {
+		process((AuthenticationFailureBadCredentialsEvent) event);
+	    } else if (event instanceof AuthenticationFailureDisabledEvent) {
+		process((AuthenticationFailureDisabledEvent) event);
+	    }
+	    // igonre all other events
+
+	} catch (Exception e) {
+	    logger.error("Exception in Spring Event Listener.", e);
+	}
+    }
+
+    protected void process(AuthenticationSuccessEvent authSuccessEvent) {
+	Authentication auth = authSuccessEvent.getAuthentication();
+	WebAuthenticationDetails details = (WebAuthenticationDetails) auth
+		.getDetails();
+	String remoteAddress = details != null ? details.getRemoteAddress()
+		: "";
+	String sessionId = details != null ? details.getSessionId() : "";
+
 	Calendar cal = Calendar.getInstance();
 	logger.info("Login Successful:" + auth.getName() + " | Ip Address:"
 			+ remoteAddress + " | sessionId=" + sessionId +  " | Epoch=" +cal.getTimeInMillis() );
 
-	// success logins are processed further in
-	// AKASecurityContextFormationFilter
-    }
-
-    protected void process(
-	    AuthenticationFailureBadCredentialsEvent authFailEvent) {
-	Authentication auth = authFailEvent.getAuthentication();
-	WebAuthenticationDetails details = (WebAuthenticationDetails) auth
-		.getDetails();
-	String remoteAddress = details != null ? details.getRemoteAddress()
-		: "";
-	String sessionId = details != null ? details.getSessionId() : "";
-
-	logger.info("Login Unsuccessful:" + auth.getName() + " | Ip Address:"
-		+ remoteAddress + " | Bad Credentials");
-
-	sessionMgr.processFailureLogin(
-		XXAuthSession.AUTH_STATUS_WRONG_PASSWORD,
-		XXAuthSession.AUTH_TYPE_PASSWORD, auth.getName(),
-		remoteAddress, sessionId);
-    }
-
-    protected void process(AuthenticationFailureDisabledEvent authFailEvent) {
-	Authentication auth = authFailEvent.getAuthentication();
-	WebAuthenticationDetails details = (WebAuthenticationDetails) auth
-		.getDetails();
-	String remoteAddress = details != null ? details.getRemoteAddress()
-		: "";
-	String sessionId = details != null ? details.getSessionId() : "";
-
-	logger.info("Login Unsuccessful:" + auth.getName() + " | Ip Address:"
-		+ remoteAddress);
-
-	sessionMgr.processFailureLogin(XXAuthSession.AUTH_STATUS_DISABLED,
-		XXAuthSession.AUTH_TYPE_PASSWORD, auth.getName(),
-		remoteAddress, sessionId);
-
-    }
-
-}
+	// success logins are processed further in
+	// AKASecurityContextFormationFilter
+    }
+
+    protected void process(
+	    AuthenticationFailureBadCredentialsEvent authFailEvent) {
+	Authentication auth = authFailEvent.getAuthentication();
+	WebAuthenticationDetails details = (WebAuthenticationDetails) auth
+		.getDetails();
+	String remoteAddress = details != null ? details.getRemoteAddress()
+		: "";
+	String sessionId = details != null ? details.getSessionId() : "";
+
+	logger.info("Login Unsuccessful:" + auth.getName() + " | Ip Address:"
+		+ remoteAddress + " | Bad Credentials");
+
+	sessionMgr.processFailureLogin(
+		XXAuthSession.AUTH_STATUS_WRONG_PASSWORD,
+		XXAuthSession.AUTH_TYPE_PASSWORD, auth.getName(),
+		remoteAddress, sessionId);
+    }
+
+    protected void process(AuthenticationFailureDisabledEvent authFailEvent) {
+	Authentication auth = authFailEvent.getAuthentication();
+	WebAuthenticationDetails details = (WebAuthenticationDetails) auth
+		.getDetails();
+	String remoteAddress = details != null ? details.getRemoteAddress()
+		: "";
+	String sessionId = details != null ? details.getSessionId() : "";
+
+	logger.info("Login Unsuccessful:" + auth.getName() + " | Ip Address:"
+		+ remoteAddress);
+
+	sessionMgr.processFailureLogin(XXAuthSession.AUTH_STATUS_DISABLED,
+		XXAuthSession.AUTH_TYPE_PASSWORD, auth.getName(),
+		remoteAddress, sessionId);
+
+    }
+
+}
diff --git a/security-admin/src/main/java/org/apache/ranger/security/standalone/StandaloneSecurityHandler.java b/security-admin/src/main/java/org/apache/ranger/security/standalone/StandaloneSecurityHandler.java
index f62f43d..377b1a3 100644
--- a/security-admin/src/main/java/org/apache/ranger/security/standalone/StandaloneSecurityHandler.java
+++ b/security-admin/src/main/java/org/apache/ranger/security/standalone/StandaloneSecurityHandler.java
@@ -17,11 +17,11 @@
  * under the License.
  */
 
- /**
- *
- */
-package org.apache.ranger.security.standalone;
-
+ /**
+ *
+ */
+package org.apache.ranger.security.standalone;
+
 import java.net.InetAddress;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -39,40 +39,40 @@ import org.springframework.security.authentication.UsernamePasswordAuthenticatio
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.context.SecurityContextHolder;
 import org.springframework.stereotype.Component;
-
-@Component
-public class StandaloneSecurityHandler {
-	public static final String AUTH_MANAGER_BEAN_NAME = "authenticationManager";
-	public static final String ACCESS_DECISION_MANAGER_BEAN_NAME = "customAccessDecisionManager";
-
-	@Autowired
-	SessionMgr sessionMgr;
-
-	public void login(String userName, String password,
-			ApplicationContext context) throws Exception {
-		// [1] Create AUTH Token
-		Authentication token = new UsernamePasswordAuthenticationToken(
-				userName, password);
-
-		// [2] Authenticate User
-		AuthenticationManager am = (AuthenticationManager) context
-				.getBean(AUTH_MANAGER_BEAN_NAME);
-		token = am.authenticate(token);
-
-		// [3] Check User Access
-		AffirmativeBased accessDecisionManager = (AffirmativeBased) context
-				.getBean(ACCESS_DECISION_MANAGER_BEAN_NAME);
-		Collection<ConfigAttribute> list = new ArrayList<ConfigAttribute>();
-		SecurityConfig config = new SecurityConfig(RangerConstants.ROLE_SYS_ADMIN);
-		list.add(config);
-		accessDecisionManager.decide(token, null, list);
-
-		// [4] set token in spring context
-		SecurityContextHolder.getContext().setAuthentication(token);
-
-		// [5] Process Success login
-		InetAddress thisIp = InetAddress.getLocalHost();
-		sessionMgr.processStandaloneSuccessLogin(
-				XXAuthSession.AUTH_TYPE_PASSWORD, thisIp.getHostAddress());
-	}
-}
+
+@Component
+public class StandaloneSecurityHandler {
+	public static final String AUTH_MANAGER_BEAN_NAME = "authenticationManager";
+	public static final String ACCESS_DECISION_MANAGER_BEAN_NAME = "customAccessDecisionManager";
+
+	@Autowired
+	SessionMgr sessionMgr;
+
+	public void login(String userName, String password,
+			ApplicationContext context) throws Exception {
+		// [1] Create AUTH Token
+		Authentication token = new UsernamePasswordAuthenticationToken(
+				userName, password);
+
+		// [2] Authenticate User
+		AuthenticationManager am = (AuthenticationManager) context
+				.getBean(AUTH_MANAGER_BEAN_NAME);
+		token = am.authenticate(token);
+
+		// [3] Check User Access
+		AffirmativeBased accessDecisionManager = (AffirmativeBased) context
+				.getBean(ACCESS_DECISION_MANAGER_BEAN_NAME);
+		Collection<ConfigAttribute> list = new ArrayList<ConfigAttribute>();
+		SecurityConfig config = new SecurityConfig(RangerConstants.ROLE_SYS_ADMIN);
+		list.add(config);
+		accessDecisionManager.decide(token, null, list);
+
+		// [4] set token in spring context
+		SecurityContextHolder.getContext().setAuthentication(token);
+
+		// [5] Process Success login
+		InetAddress thisIp = InetAddress.getLocalHost();
+		sessionMgr.processStandaloneSuccessLogin(
+				XXAuthSession.AUTH_TYPE_PASSWORD, thisIp.getHostAddress());
+	}
+}
diff --git a/security-admin/src/main/java/org/apache/ranger/security/web/filter/RangerUsernamePasswordAuthenticationFilter.java b/security-admin/src/main/java/org/apache/ranger/security/web/filter/RangerUsernamePasswordAuthenticationFilter.java
index 62e23c0..b1c977a 100644
--- a/security-admin/src/main/java/org/apache/ranger/security/web/filter/RangerUsernamePasswordAuthenticationFilter.java
+++ b/security-admin/src/main/java/org/apache/ranger/security/web/filter/RangerUsernamePasswordAuthenticationFilter.java
@@ -17,36 +17,36 @@
  * under the License.
  */
 
- /**
- *
- */
-package org.apache.ranger.security.web.filter;
-
+ /**
+ *
+ */
+package org.apache.ranger.security.web.filter;
+
 import org.apache.log4j.Logger;
 import org.springframework.security.web.authentication.RememberMeServices;
 import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
-
-public class RangerUsernamePasswordAuthenticationFilter extends
-	UsernamePasswordAuthenticationFilter {
-
-    private static final Logger logger = Logger
-	    .getLogger(RangerUsernamePasswordAuthenticationFilter.class);
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.springframework.security.web.authentication.
-     * AbstractAuthenticationProcessingFilter
-     * #setRememberMeServices(org.springframework
-     * .security.web.authentication.RememberMeServices)
-     */
-    @Override
-    public void setRememberMeServices(RememberMeServices rememberMeServices) {
-	if (logger.isDebugEnabled()) {
-	    logger.debug("setRememberMeServices() enter: rememberMeServices="
-		    + rememberMeServices.toString());
-	}
-	super.setRememberMeServices(rememberMeServices);
-    }
-
-}
+
+public class RangerUsernamePasswordAuthenticationFilter extends
+	UsernamePasswordAuthenticationFilter {
+
+    private static final Logger logger = Logger
+	    .getLogger(RangerUsernamePasswordAuthenticationFilter.class);
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.springframework.security.web.authentication.
+     * AbstractAuthenticationProcessingFilter
+     * #setRememberMeServices(org.springframework
+     * .security.web.authentication.RememberMeServices)
+     */
+    @Override
+    public void setRememberMeServices(RememberMeServices rememberMeServices) {
+	if (logger.isDebugEnabled()) {
+	    logger.debug("setRememberMeServices() enter: rememberMeServices="
+		    + rememberMeServices.toString());
+	}
+	super.setRememberMeServices(rememberMeServices);
+    }
+
+}
diff --git a/security-admin/src/main/resources/META-INF/infinispan-cache-config.xml b/security-admin/src/main/resources/META-INF/infinispan-cache-config.xml
index 7bb96ad..4175f8c 100644
--- a/security-admin/src/main/resources/META-INF/infinispan-cache-config.xml
+++ b/security-admin/src/main/resources/META-INF/infinispan-cache-config.xml
@@ -1,23 +1,23 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one or more
-  contributor license agreements.  See the NOTICE file distributed with
-  this work for additional information regarding copyright ownership.
-  The ASF licenses this file to You under the Apache License, Version 2.0
-  (the "License"); you may not use this file except in compliance with
-  the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
--->
-<infinispan>
-	<default>
-		<!--  http://docs.jboss.org/infinispan/5.0/apidocs/config.html -->
-		<locking useLockStriping="false" />
-	</default>
-</infinispan>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<infinispan>
+	<default>
+		<!--  http://docs.jboss.org/infinispan/5.0/apidocs/config.html -->
+		<locking useLockStriping="false" />
+	</default>
+</infinispan>
diff --git a/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/InvalidGroupException.java b/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/InvalidGroupException.java
index f68541e..86197bf 100644
--- a/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/InvalidGroupException.java
+++ b/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/InvalidGroupException.java
@@ -17,23 +17,23 @@
  * under the License.
  */
 
- package org.apache.ranger.unixusersync.poc;
-
-public class InvalidGroupException extends Exception
-
-{
-     private static final long serialVersionUID = 1L;
-     private final String line;
-
-     public InvalidGroupException(final String msg, final String ln)
-     {
-         super(msg);
-
-         line = ln;
-     }
-
-     public String getLine()
-     {
-         return (line);
-     }
+ package org.apache.ranger.unixusersync.poc;
+
+public class InvalidGroupException extends Exception
+
+{
+     private static final long serialVersionUID = 1L;
+     private final String line;
+
+     public InvalidGroupException(final String msg, final String ln)
+     {
+         super(msg);
+
+         line = ln;
+     }
+
+     public String getLine()
+     {
+         return (line);
+     }
 }
\ No newline at end of file
diff --git a/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/InvalidUserException.java b/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/InvalidUserException.java
index 225523e..0dca55e 100644
--- a/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/InvalidUserException.java
+++ b/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/InvalidUserException.java
@@ -17,23 +17,23 @@
  * under the License.
  */
 
- package org.apache.ranger.unixusersync.poc;
-
-public class InvalidUserException extends Exception
-
-{
-     private static final long serialVersionUID = 1L;
-     private final String line;
-
-     public InvalidUserException(final String msg, final String ln)
-     {
-         super(msg);
-
-         line = ln;
-     }
-
-     public String getLine()
-     {
-         return (line);
-     }
+ package org.apache.ranger.unixusersync.poc;
+
+public class InvalidUserException extends Exception
+
+{
+     private static final long serialVersionUID = 1L;
+     private final String line;
+
+     public InvalidUserException(final String msg, final String ln)
+     {
+         super(msg);
+
+         line = ln;
+     }
+
+     public String getLine()
+     {
+         return (line);
+     }
 }
\ No newline at end of file
diff --git a/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/ListRangerUser.java b/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/ListRangerUser.java
index 85af261..4fa1ad0 100644
--- a/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/ListRangerUser.java
+++ b/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/ListRangerUser.java
@@ -17,100 +17,99 @@
  * under the License.
  */
 
- package org.apache.ranger.unixusersync.poc;
-
-
-public class ListRangerUser
-{
-    private final String uid;
-    private final String uname;
-    private final String gid;
-    
-    public static ListRangerUser parseUser(final String userLine)
-        throws InvalidUserException
-    {
-        final String   line;
-        final String[] parts;
-
-        if(userLine == null)
-        {
-            throw new IllegalArgumentException("userLine cannot be null");
-        }
-
-        line = userLine.trim();
-
-        if(line.startsWith("#") || line.isEmpty())
-        {
-             return null;
-        }
-
-        parts = line.split(":");
-
-        if(parts.length < 3)
-        {
-            throw new InvalidUserException(userLine + "must be in the format of name:passwd:gid[:userlist]", line);
-        }
-
-        try
-        {
-            final ListRangerUser       xaUser;
-            final String       uname;
-            final String	   uid;
-            final String       gid;
-          
-            uname  = parts[0];
-            uid    = parts[2];
-            gid    = parts[3];
-            
-            xaUser = new ListRangerUser(uname, uid, gid);
-
-            return xaUser;
-        }
-        catch(final NumberFormatException ex)
-        {
-            throw new InvalidUserException(userLine + " uid must be a number", line);
-        }
-    }
-
-    public ListRangerUser(final String nm, final String userid, final String grpid )
-    {
-        uname    = nm;
-        uid      = userid;
-        gid 	 = grpid;
-        
-    }
-
-    public String getGid()
-    {
-        return (gid);
-    }
-
-    public String getName()
-    {
-        return (uname);
-    }
-
-    public String getUid()
-    {
-        return (uid);
-    }
-
-   
-    @Override
-    public String toString()
-    {
-        final StringBuilder sb;
-
-        sb = new StringBuilder();
-        sb.append(uname);
-        sb.append(":");
-        sb.append(uid);
-        sb.append(":");
-        sb.append(gid);
-        
-        sb.setLength(sb.length() - 1);
-
-        return (sb.toString());
-    }
-}
-
+ package org.apache.ranger.unixusersync.poc;
+
+
+public class ListRangerUser
+{
+    private final String uid;
+    private final String uname;
+    private final String gid;
+
+    public static ListRangerUser parseUser(final String userLine)
+        throws InvalidUserException
+    {
+        final String   line;
+        final String[] parts;
+
+        if(userLine == null)
+        {
+            throw new IllegalArgumentException("userLine cannot be null");
+        }
+
+        line = userLine.trim();
+
+        if(line.startsWith("#") || line.isEmpty())
+        {
+             return null;
+        }
+
+        parts = line.split(":");
+
+        if(parts.length < 3)
+        {
+            throw new InvalidUserException(userLine + "must be in the format of name:passwd:gid[:userlist]", line);
+        }
+
+        try
+        {
+            final ListRangerUser       xaUser;
+            final String       uname;
+            final String	   uid;
+            final String       gid;
+
+            uname  = parts[0];
+            uid    = parts[2];
+            gid    = parts[3];
+
+            xaUser = new ListRangerUser(uname, uid, gid);
+
+            return xaUser;
+        }
+        catch(final NumberFormatException ex)
+        {
+            throw new InvalidUserException(userLine + " uid must be a number", line);
+        }
+    }
+
+    public ListRangerUser(final String nm, final String userid, final String grpid )
+    {
+        uname    = nm;
+        uid      = userid;
+        gid 	 = grpid;
+
+    }
+
+    public String getGid()
+    {
+        return (gid);
+    }
+
+    public String getName()
+    {
+        return (uname);
+    }
+
+    public String getUid()
+    {
+        return (uid);
+    }
+
+
+    @Override
+    public String toString()
+    {
+        final StringBuilder sb;
+
+        sb = new StringBuilder();
+        sb.append(uname);
+        sb.append(":");
+        sb.append(uid);
+        sb.append(":");
+        sb.append(gid);
+
+        sb.setLength(sb.length() - 1);
+
+        return (sb.toString());
+    }
+}
diff --git a/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/ListRangerUserGroup.java b/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/ListRangerUserGroup.java
index 8eb9131..8d5bf2a 100644
--- a/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/ListRangerUserGroup.java
+++ b/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/ListRangerUserGroup.java
@@ -17,126 +17,125 @@
  * under the License.
  */
 
- package org.apache.ranger.unixusersync.poc;
-
-import java.util.Arrays;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-public class ListRangerUserGroup
-{
-    private final int gid;
-    private final String name;
-    private final String passwd;
-    private final List<String> userList;
-
-    public static ListRangerUserGroup parseGroup(final String groupLine)
-        throws InvalidGroupException
-    {
-        final String   line;
-        final String[] parts;
-
-        if(groupLine == null)
-        {
-            throw new IllegalArgumentException("groupLine cannot be null");
-        }
-
-        line = groupLine.trim();
-
-        if(line.startsWith("#") || line.isEmpty())
-        {
-             return null;
-        }
-
-        parts = line.split(":");
-
-        if(parts.length < 3)
-        {
-            throw new InvalidGroupException(groupLine + "must be in the format of name:passwd:gid[:userlist]", line);
-        }
-
-        try
-        {
-            final ListRangerUserGroup        group;
-            final String       name;
-            final String       passwd;
-            final int          gid;
-            final List<String> userList;
-
-            name   = parts[0];
-            passwd = parts[1];
-            gid    = Integer.parseInt(parts[2]);
-
-            if(parts.length == 4)
-            {
-                userList = Arrays.asList(parts[3].split(","));
-            }
-            else
-            {
-                userList = Collections.emptyList();
-            }
-
-            group = new ListRangerUserGroup(name, passwd, gid, userList);
-
-            return group;
-        }
-        catch(final NumberFormatException ex)
-        {
-            throw new InvalidGroupException(groupLine + " gid must be a number", line);
-        }
-    }
-
-    public ListRangerUserGroup(final String nm, final String pw, final int id, final List<String> users)
-    {
-        name     = nm;
-        passwd   = pw;
-        gid      = id;
-        userList = Collections.unmodifiableList(new ArrayList<String>(users));
-    }
-
-    public int getGid()
-    {
-        return (gid);
-    }
-
-    public String getName()
-    {
-        return (name);
-    }
-
-    public String getPasswd()
-    {
-        return (passwd);
-    }
-
-    public List<String> getUserList()
-    {
-        return (userList);
-    }
-
-    @Override
-    public String toString()
-    {
-        final StringBuilder sb;
-
-        sb = new StringBuilder();
-        sb.append(name);
-        sb.append(":");
-        sb.append(passwd);
-        sb.append(":");
-        sb.append(gid);
-        sb.append(":");
-
-        for(final String user : userList)
-        {
-            sb.append(user);
-            sb.append(",");
-        }
-
-        sb.setLength(sb.length() - 1);
-
-        return (sb.toString());
-    }
-}
-
+ package org.apache.ranger.unixusersync.poc;
+
+import java.util.Arrays;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public class ListRangerUserGroup
+{
+    private final int gid;
+    private final String name;
+    private final String passwd;
+    private final List<String> userList;
+
+    public static ListRangerUserGroup parseGroup(final String groupLine)
+        throws InvalidGroupException
+    {
+        final String   line;
+        final String[] parts;
+
+        if(groupLine == null)
+        {
+            throw new IllegalArgumentException("groupLine cannot be null");
+        }
+
+        line = groupLine.trim();
+
+        if(line.startsWith("#") || line.isEmpty())
+        {
+             return null;
+        }
+
+        parts = line.split(":");
+
+        if(parts.length < 3)
+        {
+            throw new InvalidGroupException(groupLine + "must be in the format of name:passwd:gid[:userlist]", line);
+        }
+
+        try
+        {
+            final ListRangerUserGroup        group;
+            final String       name;
+            final String       passwd;
+            final int          gid;
+            final List<String> userList;
+
+            name   = parts[0];
+            passwd = parts[1];
+            gid    = Integer.parseInt(parts[2]);
+
+            if(parts.length == 4)
+            {
+                userList = Arrays.asList(parts[3].split(","));
+            }
+            else
+            {
+                userList = Collections.emptyList();
+            }
+
+            group = new ListRangerUserGroup(name, passwd, gid, userList);
+
+            return group;
+        }
+        catch(final NumberFormatException ex)
+        {
+            throw new InvalidGroupException(groupLine + " gid must be a number", line);
+        }
+    }
+
+    public ListRangerUserGroup(final String nm, final String pw, final int id, final List<String> users)
+    {
+        name     = nm;
+        passwd   = pw;
+        gid      = id;
+        userList = Collections.unmodifiableList(new ArrayList<String>(users));
+    }
+
+    public int getGid()
+    {
+        return (gid);
+    }
+
+    public String getName()
+    {
+        return (name);
+    }
+
+    public String getPasswd()
+    {
+        return (passwd);
+    }
+
+    public List<String> getUserList()
+    {
+        return (userList);
+    }
+
+    @Override
+    public String toString()
+    {
+        final StringBuilder sb;
+
+        sb = new StringBuilder();
+        sb.append(name);
+        sb.append(":");
+        sb.append(passwd);
+        sb.append(":");
+        sb.append(gid);
+        sb.append(":");
+
+        for(final String user : userList)
+        {
+            sb.append(user);
+            sb.append(",");
+        }
+
+        sb.setLength(sb.length() - 1);
+
+        return (sb.toString());
+    }
+}
diff --git a/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/ListUserGroupTest.java b/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/ListUserGroupTest.java
index fae0870..6fc4c2d 100644
--- a/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/ListUserGroupTest.java
+++ b/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/ListUserGroupTest.java
@@ -17,23 +17,23 @@
  * under the License.
  */
 
- package org.apache.ranger.unixusersync.poc;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-
-
-public class ListUserGroupTest {
-	
-	//test code for client user group mapping fetch
- 	
-  private static String passwdfile = "C:\\git\\xa_server\\conf\\client\\passwd";
-		   		
-  private static ArrayList<HashMap<String, String>> clientusergroupmapping = null;
-  
-  public static void main(String[] args) {
-
-	clientusergroupmapping = RangerClientUserGroupMapping.buildClientUserGroupMapping(passwdfile);
-	System.out.println(clientusergroupmapping);
-	}
+ package org.apache.ranger.unixusersync.poc;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+
+public class ListUserGroupTest {
+
+	//test code for client user group mapping fetch
+
+  private static String passwdfile = "C:\\git\\xa_server\\conf\\client\\passwd";
+
+  private static ArrayList<HashMap<String, String>> clientusergroupmapping = null;
+
+  public static void main(String[] args) {
+
+	clientusergroupmapping = RangerClientUserGroupMapping.buildClientUserGroupMapping(passwdfile);
+	System.out.println(clientusergroupmapping);
+	}
 }
\ No newline at end of file
diff --git a/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/ListUserTest.java b/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/ListUserTest.java
index fee780e..04f70d0 100644
--- a/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/ListUserTest.java
+++ b/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/ListUserTest.java
@@ -1,53 +1,52 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
- package org.apache.ranger.unixusersync.poc;
-
-import java.io.BufferedReader;
-import java.io.FileReader;
-
-
-public class ListUserTest
-{
- public static String strLine;
-
- public static void main(String args[])
-  {
-	 
-  try{
-  
-	  FileReader file = new FileReader("C:\\git\\xa_server\\conf\\client\\passwd");
-      BufferedReader br = new BufferedReader(file);
-  
-	  while ((strLine = br.readLine()) != null)   {
-		 ListRangerUser userList = ListRangerUser.parseUser(strLine);
-     if (userList != null) {
-		   System.out.println(userList.getName() + " " + userList.getUid() + " " + userList.getGid());
-     } else {
-		   System.out.println("userList is null");
-     }
-	  }
-	
-	  file.close();
-    }catch (Exception e){//Catch exception if any
-    	System.err.println("Error: " + e.getMessage());
-    }
-  }
-}
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+ package org.apache.ranger.unixusersync.poc;
+
+import java.io.BufferedReader;
+import java.io.FileReader;
+
+
+public class ListUserTest
+{
+ public static String strLine;
+
+ public static void main(String args[])
+  {
+
+  try{
+
+	  FileReader file = new FileReader("C:\\git\\xa_server\\conf\\client\\passwd");
+      BufferedReader br = new BufferedReader(file);
+
+	  while ((strLine = br.readLine()) != null)   {
+		 ListRangerUser userList = ListRangerUser.parseUser(strLine);
+     if (userList != null) {
+		   System.out.println(userList.getName() + " " + userList.getUid() + " " + userList.getGid());
+     } else {
+		   System.out.println("userList is null");
+     }
+	  }
+
+	  file.close();
+    }catch (Exception e){//Catch exception if any
+	System.err.println("Error: " + e.getMessage());
+    }
+  }
+}
diff --git a/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/RangerClientUserGroupMapping.java b/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/RangerClientUserGroupMapping.java
index 408e861..88a6c5d 100644
--- a/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/RangerClientUserGroupMapping.java
+++ b/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/RangerClientUserGroupMapping.java
@@ -1,71 +1,71 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
- package org.apache.ranger.unixusersync.poc;
-
-import java.io.BufferedReader;
-import java.io.FileReader;
-import java.util.ArrayList;
-import java.util.HashMap;
-
-public class RangerClientUserGroupMapping {
-	
-	private static String strLine;
-	private static final String TAG_USER_NAME = "name";
-	private static final String TAG_USER_ID = "userId";
-	private static final String TAG_GROUP_ID = "id";
-	
-	public static ArrayList<HashMap<String, String>> buildClientUserGroupMapping(String passwdFile){
-	
-	ArrayList<HashMap<String, String>> ClientUserGroupMapping = new ArrayList<HashMap<String, String>>();
-
-	try{
-		FileReader file = new FileReader(passwdFile);
-		
-	    BufferedReader br = new BufferedReader(file);
-	  
-		
-	    while ((strLine = br.readLine()) != null)  {
-	    	
-	    	ListRangerUser userList = ListRangerUser.parseUser(strLine);
-
-            if (userList == null) {
-                continue;
-            }
-		 
-	    	HashMap<String, String> map = new HashMap<String, String>();
-         
-	    	// adding each child node to HashMap key => value
-	    	map.put(TAG_USER_NAME, userList.getName());
-	    	map.put(TAG_USER_ID, userList.getUid());
-	    	map.put(TAG_GROUP_ID, userList.getGid());
-	    	
-	    	// adding HashList to ArrayList
-            ClientUserGroupMapping.add(map);
-            
-			// System.out.println(userList.getName() + " " + userList.getUid() + " " + userList.getGid());
-		  }
-	
-	    file.close();
-		}catch (Exception e){//Catch exception if any
-			System.err.println("Error: " + e.getMessage());
-		}
-		return ClientUserGroupMapping;
-	}
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+ package org.apache.ranger.unixusersync.poc;
+
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.util.ArrayList;
+import java.util.HashMap;
+
+public class RangerClientUserGroupMapping {
+
+	private static String strLine;
+	private static final String TAG_USER_NAME = "name";
+	private static final String TAG_USER_ID = "userId";
+	private static final String TAG_GROUP_ID = "id";
+
+	public static ArrayList<HashMap<String, String>> buildClientUserGroupMapping(String passwdFile){
+
+	ArrayList<HashMap<String, String>> ClientUserGroupMapping = new ArrayList<HashMap<String, String>>();
+
+	try{
+		FileReader file = new FileReader(passwdFile);
+
+	    BufferedReader br = new BufferedReader(file);
+
+
+	    while ((strLine = br.readLine()) != null)  {
+
+		ListRangerUser userList = ListRangerUser.parseUser(strLine);
+
+            if (userList == null) {
+                continue;
+            }
+
+		HashMap<String, String> map = new HashMap<String, String>();
+
+		// adding each child node to HashMap key => value
+		map.put(TAG_USER_NAME, userList.getName());
+		map.put(TAG_USER_ID, userList.getUid());
+		map.put(TAG_GROUP_ID, userList.getGid());
+
+		// adding HashList to ArrayList
+            ClientUserGroupMapping.add(map);
+
+			// System.out.println(userList.getName() + " " + userList.getUid() + " " + userList.getGid());
+		  }
+
+	    file.close();
+		}catch (Exception e){//Catch exception if any
+			System.err.println("Error: " + e.getMessage());
+		}
+		return ClientUserGroupMapping;
+	}
+}
diff --git a/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/RangerJSONParser.java b/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/RangerJSONParser.java
index 6c8205e..0a3d6d7 100644
--- a/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/RangerJSONParser.java
+++ b/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/RangerJSONParser.java
@@ -17,47 +17,47 @@
  * under the License.
  */
 
- package org.apache.ranger.unixusersync.poc;
-
-
-
-
-public class RangerJSONParser {
-
-	/*
- private static final Log LOG = LogFactory.getLog(RangerJSONParser.class);
- 
- private static JSONObject jObj = null;
- 
- private static String jsonstr = "";
-
- 
- public  JSONObject getJSONFromUrl(String url) {
-	
-     try {
-		
-		Client client = Client.create();
-	 	WebResource webResource = client
-		   .resource(url);
-		
-	 	ClientResponse response = webResource.accept("application/json")
-                  .get(ClientResponse.class);
-
-		if (response.getStatus() != 200) {
-		   throw new RuntimeException("Failed : HTTP error code : "
-			+ response.getStatus());
-		}
-
-		jsonstr = response.getEntity(String.class);
-		jObj = new JSONObject(jsonstr);
-		
-	    } catch (Exception e) {
-	    	LOG.error("XaSecure JSON Parser:Error parsing data" , e);
-		}
-     	
-     	return jObj;
-    }
-    
-    */
- 
-}
\ No newline at end of file
+ package org.apache.ranger.unixusersync.poc;
+
+
+
+
+public class RangerJSONParser {
+
+	/*
+ private static final Log LOG = LogFactory.getLog(RangerJSONParser.class);
+
+ private static JSONObject jObj = null;
+
+ private static String jsonstr = "";
+
+
+ public  JSONObject getJSONFromUrl(String url) {
+
+     try {
+
+		Client client = Client.create();
+		WebResource webResource = client
+		   .resource(url);
+
+		ClientResponse response = webResource.accept("application/json")
+                  .get(ClientResponse.class);
+
+		if (response.getStatus() != 200) {
+		   throw new RuntimeException("Failed : HTTP error code : "
+			+ response.getStatus());
+		}
+
+		jsonstr = response.getEntity(String.class);
+		jObj = new JSONObject(jsonstr);
+
+	    } catch (Exception e) {
+		LOG.error("XaSecure JSON Parser:Error parsing data" , e);
+		}
+
+	return jObj;
+    }
+
+    */
+
+}
diff --git a/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/RangerUserGroupMapping.java b/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/RangerUserGroupMapping.java
index 5aa60f0..d185127 100644
--- a/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/RangerUserGroupMapping.java
+++ b/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/RangerUserGroupMapping.java
@@ -17,69 +17,67 @@
  * under the License.
  */
 
- package org.apache.ranger.unixusersync.poc;
-
-
-public class RangerUserGroupMapping {
-
-	/*
-private static final String TAG_XGROUP_USERS ="vXGroupUsers";
-private static final String TAG_USER_NAME = "name";
-private static final String TAG_USER_ID = "userId";
-//private static final String TAG_GROUP_NAME = "name";
-private static final String TAG_GROUP_ID = "id";
-
-public static JSONArray vXGroupUsers = null;
-
-public static ArrayList<HashMap<String, String>> buildUserGroupMapping(String url){
-
-	//HashMap for UserGroupMapping
-	
-	ArrayList<HashMap<String, String>> UserGroupMapping = new ArrayList<HashMap<String, String>>();
-	 
-    // Creating JSON Parser instance
-    RangerJSONParser jParser = new RangerJSONParser();
-    
-    // getting JSON string from URL
-    JSONObject json = jParser.getJSONFromUrl(url);
-    
-    try {
-        // Getting Array of vXGroupUsers
-    	
-    	vXGroupUsers = json.getJSONArray(TAG_XGROUP_USERS);
-         
-        // looping through All vXGroupUsers
-    	
-        for(int i = 0; i < vXGroupUsers.length(); i++) {
-        	
-            JSONObject xausergroup = vXGroupUsers.getJSONObject(i);
-             
-            // Storing each json item in variable
-            String uname = xausergroup.getString(TAG_USER_NAME);
-            String uid = xausergroup.getString(TAG_USER_ID);
-            String gid = xausergroup.getString(TAG_GROUP_ID);
-           
-            
-            // creating new HashMap
-            HashMap<String, String> map = new HashMap<String, String>();
-             
-            // adding each child node to HashMap key => value
-            map.put(TAG_USER_NAME, uname);
-            map.put(TAG_USER_ID, uid);
-            map.put(TAG_GROUP_ID, gid);
-
-            // adding HashList to ArrayList
-            UserGroupMapping.add(map);
-            }
-        
-        } catch (JSONException e) {
-        e.printStackTrace();
-       	}
-    
-     return UserGroupMapping;
-    
-    }
-    */
-}
-
-
+ package org.apache.ranger.unixusersync.poc;
+
+
+public class RangerUserGroupMapping {
+
+	/*
+private static final String TAG_XGROUP_USERS ="vXGroupUsers";
+private static final String TAG_USER_NAME = "name";
+private static final String TAG_USER_ID = "userId";
+//private static final String TAG_GROUP_NAME = "name";
+private static final String TAG_GROUP_ID = "id";
+
+public static JSONArray vXGroupUsers = null;
+
+public static ArrayList<HashMap<String, String>> buildUserGroupMapping(String url){
+
+	//HashMap for UserGroupMapping
+
+	ArrayList<HashMap<String, String>> UserGroupMapping = new ArrayList<HashMap<String, String>>();
+
+    // Creating JSON Parser instance
+    RangerJSONParser jParser = new RangerJSONParser();
+
+    // getting JSON string from URL
+    JSONObject json = jParser.getJSONFromUrl(url);
+
+    try {
+        // Getting Array of vXGroupUsers
+
+	vXGroupUsers = json.getJSONArray(TAG_XGROUP_USERS);
+
+        // looping through All vXGroupUsers
+
+        for(int i = 0; i < vXGroupUsers.length(); i++) {
+
+            JSONObject xausergroup = vXGroupUsers.getJSONObject(i);
+
+            // Storing each json item in variable
+            String uname = xausergroup.getString(TAG_USER_NAME);
+            String uid = xausergroup.getString(TAG_USER_ID);
+            String gid = xausergroup.getString(TAG_GROUP_ID);
+
+
+            // creating new HashMap
+            HashMap<String, String> map = new HashMap<String, String>();
+
+            // adding each child node to HashMap key => value
+            map.put(TAG_USER_NAME, uname);
+            map.put(TAG_USER_ID, uid);
+            map.put(TAG_GROUP_ID, gid);
+
+            // adding HashList to ArrayList
+            UserGroupMapping.add(map);
+            }
+
+        } catch (JSONException e) {
+        e.printStackTrace();
+	}
+
+     return UserGroupMapping;
+
+    }
+    */
+}
diff --git a/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/RestClientPost.java b/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/RestClientPost.java
index bbe9f1a..b4b69ec 100644
--- a/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/RestClientPost.java
+++ b/ugsync/src/main/java/org/apache/ranger/unixusersync/poc/RestClientPost.java
@@ -17,39 +17,39 @@
  * under the License.
  */
 
- package org.apache.ranger.unixusersync.poc;
-
-import com.sun.jersey.api.client.Client;
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.api.client.WebResource;
- 
-public class RestClientPost {
- 
-  public static void main(String[] args) {
- 
-	try {
- 
-		Client client = Client.create();
- 
-		WebResource webResource = client
-				   .resource("http://domain/service/xusers/group/testGroup/user/testUser");
-		ClientResponse response = webResource.type("application/json")
-				.post(ClientResponse.class);
-		 
-		if (response.getStatus() != 200) {
-			throw new RuntimeException("Failed : HTTP error code : "
-			     + response.getStatus());
-		}
- 
-		System.out.println("Output from Server .... \n");
-		String output = response.getEntity(String.class);
-		System.out.println(output);
- 
-	  } catch (Exception e) {
- 
-		e.printStackTrace();
- 
-	  }
- 
-	}
+ package org.apache.ranger.unixusersync.poc;
+
+import com.sun.jersey.api.client.Client;
+import com.sun.jersey.api.client.ClientResponse;
+import com.sun.jersey.api.client.WebResource;
+
+public class RestClientPost {
+
+  public static void main(String[] args) {
+
+	try {
+
+		Client client = Client.create();
+
+		WebResource webResource = client
+				   .resource("http://domain/service/xusers/group/testGroup/user/testUser");
+		ClientResponse response = webResource.type("application/json")
+				.post(ClientResponse.class);
+
+		if (response.getStatus() != 200) {
+			throw new RuntimeException("Failed : HTTP error code : "
+			     + response.getStatus());
+		}
+
+		System.out.println("Output from Server .... \n");
+		String output = response.getEntity(String.class);
+		System.out.println(output);
+
+	  } catch (Exception e) {
+
+		e.printStackTrace();
+
+	  }
+
+	}
 }
\ No newline at end of file


[ranger] 02/02: RANGER-2853: fix NPE error in ranger admin when enable ranger kms

Posted by pr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

pradeep pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ranger.git

commit 297e8b909a405b7448c699d535299aaf7a2c4d93
Author: gaozhan.ding <ga...@envision-digital.com>
AuthorDate: Tue Jun 9 21:05:47 2020 +0800

    RANGER-2853: fix NPE error in ranger admin when enable ranger kms
    
    Signed-off-by: pradeep <pr...@apache.org>
---
 security-admin/src/main/java/org/apache/ranger/biz/KmsKeyMgr.java | 1 +
 1 file changed, 1 insertion(+)

diff --git a/security-admin/src/main/java/org/apache/ranger/biz/KmsKeyMgr.java b/security-admin/src/main/java/org/apache/ranger/biz/KmsKeyMgr.java
index 79c7eaf..8582eeb 100755
--- a/security-admin/src/main/java/org/apache/ranger/biz/KmsKeyMgr.java
+++ b/security-admin/src/main/java/org/apache/ranger/biz/KmsKeyMgr.java
@@ -561,6 +561,7 @@ public class KmsKeyMgr {
 		String nameRules = PropertiesUtil.getProperty(NAME_RULES);
 		if (StringUtils.isEmpty(nameRules)) {
 			KerberosName.setRules("DEFAULT");
+			nameRules = "DEFAULT";
 		} else {
 			KerberosName.setRules(nameRules);
 		}