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/08/10 09:28:59 UTC
[ranger] branch ranger-2.0 updated (66169d4 -> 10617e3)
This is an automated email from the ASF dual-hosted git repository.
pradeep pushed a change to branch ranger-2.0
in repository https://gitbox.apache.org/repos/asf/ranger.git.
from 66169d4 Revert: RANGER-2852: Add .gitattributes file to prevent CRLF and LF mismatches for source and text files
new 26ce6b8 RANGER-2851: Remove CRLF characters from ranger files
new 10617e3 RANGER-2852: Add .gitattributes file to prevent CRLF and LF mismatches for source and text files
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:
.gitattributes | 16 ++
.../main/java/org/apache/ranger/biz/BaseMgr.java | 158 ++++++------
.../security/context/RangerContextHolder.java | 90 +++----
.../security/context/RangerSecurityContext.java | 116 ++++-----
.../security/listener/SpringEventListener.java | 224 ++++++++--------
.../standalone/StandaloneSecurityHandler.java | 156 +++++------
...RangerUsernamePasswordAuthenticationFilter.java | 104 ++++----
.../resources/META-INF/infinispan-cache-config.xml | 46 ++--
storm-agent/src/test/resources/words.txt | 2 +-
.../unixusersync/poc/InvalidGroupException.java | 76 +++---
.../unixusersync/poc/InvalidUserException.java | 76 +++---
.../ranger/unixusersync/poc/ListRangerUser.java | 232 ++++++++---------
.../unixusersync/poc/ListRangerUserGroup.java | 284 ++++++++++-----------
.../ranger/unixusersync/poc/ListUserGroupTest.java | 76 +++---
.../ranger/unixusersync/poc/ListUserTest.java | 106 ++++----
.../poc/RangerClientUserGroupMapping.java | 142 +++++------
.../ranger/unixusersync/poc/RangerJSONParser.java | 124 ++++-----
.../unixusersync/poc/RangerUserGroupMapping.java | 170 ++++++------
.../ranger/unixusersync/poc/RestClientPost.java | 108 ++++----
19 files changed, 1161 insertions(+), 1145 deletions(-)
create mode 100644 .gitattributes
[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 ranger-2.0
in repository https://gitbox.apache.org/repos/asf/ranger.git
commit 26ce6b822c7657fcb6f9e099c725a0a4eb9ea3c3
Author: pradeep <pr...@apache.org>
AuthorDate: Mon Aug 10 14:56:57 2020 +0530
RANGER-2851: Remove CRLF characters from ranger files
---
.../main/java/org/apache/ranger/biz/BaseMgr.java | 158 ++++++------
.../security/context/RangerContextHolder.java | 90 +++----
.../security/context/RangerSecurityContext.java | 116 ++++-----
.../security/listener/SpringEventListener.java | 224 ++++++++--------
.../standalone/StandaloneSecurityHandler.java | 156 +++++------
...RangerUsernamePasswordAuthenticationFilter.java | 104 ++++----
.../resources/META-INF/infinispan-cache-config.xml | 46 ++--
storm-agent/src/test/resources/words.txt | 2 +-
.../unixusersync/poc/InvalidGroupException.java | 76 +++---
.../unixusersync/poc/InvalidUserException.java | 76 +++---
.../ranger/unixusersync/poc/ListRangerUser.java | 232 ++++++++---------
.../unixusersync/poc/ListRangerUserGroup.java | 284 ++++++++++-----------
.../ranger/unixusersync/poc/ListUserGroupTest.java | 76 +++---
.../ranger/unixusersync/poc/ListUserTest.java | 106 ++++----
.../poc/RangerClientUserGroupMapping.java | 142 +++++------
.../ranger/unixusersync/poc/RangerJSONParser.java | 124 ++++-----
.../unixusersync/poc/RangerUserGroupMapping.java | 170 ++++++------
.../ranger/unixusersync/poc/RestClientPost.java | 108 ++++----
18 files changed, 1145 insertions(+), 1145 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 f9c3b4c..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
@@ -1,79 +1,79 @@
-/*
- * 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.biz;
-
-import org.apache.log4j.Logger;
-import org.apache.ranger.common.MessageEnums;
-import org.apache.ranger.common.RESTErrorUtil;
-import org.apache.ranger.common.RangerConstants;
-import org.apache.ranger.common.db.BaseDao;
-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");
- }
-
-}
+/*
+ * 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.biz;
+
+import org.apache.log4j.Logger;
+import org.apache.ranger.common.MessageEnums;
+import org.apache.ranger.common.RESTErrorUtil;
+import org.apache.ranger.common.RangerConstants;
+import org.apache.ranger.common.db.BaseDao;
+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");
+ }
+
+}
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 9c01881..7a14b61 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
@@ -1,45 +1,45 @@
-/*
- * 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.security.context;
-
-public class RangerContextHolder {
-
- private static final ThreadLocal<RangerSecurityContext> securityContextThreadLocal = new ThreadLocal<RangerSecurityContext>();
-
- private RangerContextHolder() {
-
- }
-
- public static RangerSecurityContext getSecurityContext(){
- return securityContextThreadLocal.get();
- }
-
- public static void setSecurityContext(RangerSecurityContext context){
- securityContextThreadLocal.set(context);
- }
-
- public static void resetSecurityContext(){
- securityContextThreadLocal.remove();
- }
-
-}
+/*
+ * 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.security.context;
+
+public class RangerContextHolder {
+
+ private static final ThreadLocal<RangerSecurityContext> securityContextThreadLocal = new ThreadLocal<RangerSecurityContext>();
+
+ private RangerContextHolder() {
+
+ }
+
+ public static RangerSecurityContext getSecurityContext(){
+ return securityContextThreadLocal.get();
+ }
+
+ public static void setSecurityContext(RangerSecurityContext context){
+ securityContextThreadLocal.set(context);
+ }
+
+ public static void resetSecurityContext(){
+ securityContextThreadLocal.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 9f09d90..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
@@ -1,58 +1,58 @@
-/*
- * 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.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;
- }
-
-
-}
+/*
+ * 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.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;
+ }
+
+
+}
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 de9ee39..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
@@ -1,112 +1,112 @@
-/*
- * 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.security.listener;
-
-import java.util.Calendar;
-import org.apache.log4j.Logger;
-import org.apache.ranger.biz.SessionMgr;
-import org.apache.ranger.entity.XXAuthSession;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationListener;
-import org.springframework.security.authentication.event.AbstractAuthenticationEvent;
-import org.springframework.security.authentication.event.AuthenticationFailureBadCredentialsEvent;
-import org.springframework.security.authentication.event.AuthenticationFailureDisabledEvent;
-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() : "";
-
- 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);
-
- }
-
-}
+/*
+ * 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.security.listener;
+
+import java.util.Calendar;
+import org.apache.log4j.Logger;
+import org.apache.ranger.biz.SessionMgr;
+import org.apache.ranger.entity.XXAuthSession;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationListener;
+import org.springframework.security.authentication.event.AbstractAuthenticationEvent;
+import org.springframework.security.authentication.event.AuthenticationFailureBadCredentialsEvent;
+import org.springframework.security.authentication.event.AuthenticationFailureDisabledEvent;
+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() : "";
+
+ 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);
+
+ }
+
+}
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 2a96c6e..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
@@ -1,78 +1,78 @@
-/*
- * 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.security.standalone;
-
-import java.net.InetAddress;
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.apache.ranger.biz.SessionMgr;
-import org.apache.ranger.common.RangerConstants;
-import org.apache.ranger.entity.XXAuthSession;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationContext;
-import org.springframework.security.access.ConfigAttribute;
-import org.springframework.security.access.SecurityConfig;
-import org.springframework.security.access.vote.AffirmativeBased;
-import org.springframework.security.authentication.AuthenticationManager;
-import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
-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());
- }
-}
+/*
+ * 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.security.standalone;
+
+import java.net.InetAddress;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.ranger.biz.SessionMgr;
+import org.apache.ranger.common.RangerConstants;
+import org.apache.ranger.entity.XXAuthSession;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationContext;
+import org.springframework.security.access.ConfigAttribute;
+import org.springframework.security.access.SecurityConfig;
+import org.springframework.security.access.vote.AffirmativeBased;
+import org.springframework.security.authentication.AuthenticationManager;
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+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());
+ }
+}
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 c3d61bd..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
@@ -1,52 +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.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);
- }
-
-}
+/*
+ * 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.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);
+ }
+
+}
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/storm-agent/src/test/resources/words.txt b/storm-agent/src/test/resources/words.txt
index c7725df..f11eeb1 100644
--- a/storm-agent/src/test/resources/words.txt
+++ b/storm-agent/src/test/resources/words.txt
@@ -1,4 +1,4 @@
-# Licensed to the Apache Software Foundation (ASF) under one
+# 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
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 e3de80a..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
@@ -1,39 +1,39 @@
-/*
- * 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;
-
-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);
- }
+/*
+ * 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;
+
+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 93bee4d..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
@@ -1,39 +1,39 @@
-/*
- * 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;
-
-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);
- }
+/*
+ * 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;
+
+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 d21531d..76a4056 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
@@ -1,116 +1,116 @@
-/*
- * 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;
-
-
-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());
- }
-}
-
+/*
+ * 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;
+
+
+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 43b62cd..397bfbf 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
@@ -1,142 +1,142 @@
-/*
- * 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.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());
- }
-}
-
+/*
+ * 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.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 56d4529..72ada07 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
@@ -1,39 +1,39 @@
-/*
- * 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.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);
- }
+/*
+ * 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.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..1bd5a31 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,53 @@
-/*
- * 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..a10ff25 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 b9063eb..f5fb9a5 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
@@ -1,63 +1,63 @@
-/*
- * 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;
-
-
-
-
-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;
- }
-
- */
-
+/*
+ * 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;
+
+
+
+
+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
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 2498fc2..8b7d9f8 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
@@ -1,85 +1,85 @@
-/*
- * 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;
-
-
-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;
-
- }
- */
-}
-
-
+/*
+ * 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;
+
+
+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 76e6af7..bbb5d96 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
@@ -1,55 +1,55 @@
-/*
- * 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 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();
-
- }
-
- }
+/*
+ * 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 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-2852: Add .gitattributes file to prevent
CRLF and LF mismatches for source and text files
Posted by pr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
pradeep pushed a commit to branch ranger-2.0
in repository https://gitbox.apache.org/repos/asf/ranger.git
commit 10617e3d36e4c5b8716114408648b994afad10a2
Author: pradeep <pr...@apache.org>
AuthorDate: Wed Jun 10 14:30:33 2020 +0530
RANGER-2852: Add .gitattributes file to prevent CRLF and LF mismatches for source and text files
---
.gitattributes | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..783358a
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,16 @@
+# Auto detect text files and perform LF normalization
+* text=auto
+
+*.java text diff=java eol=lf
+*.html text diff=html eol=lf
+*.py text diff=python eol=lf
+*.css text eol=lf
+*.js text eol=lf
+*.sql text eol=lf
+*.sh text eol=lf
+*.xml text eol=lf
+*.txt text eol=lf
+*.json text eol=lf
+*.jsp text eol=lf
+*.csv text eol=lf
+*.properties text eol=lf