You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by co...@apache.org on 2017/01/17 10:43:35 UTC
incubator-ranger git commit: Indentation fix
Repository: incubator-ranger
Updated Branches:
refs/heads/master 688f1c09b -> af3b31b53
Indentation fix
Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/af3b31b5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/af3b31b5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/af3b31b5
Branch: refs/heads/master
Commit: af3b31b5319613c82b12cc7bf411a935c03b8c69
Parents: 688f1c0
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Tue Jan 17 10:39:45 2017 +0000
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Tue Jan 17 10:39:45 2017 +0000
----------------------------------------------------------------------
.../config/UserGroupSyncConfig.java | 620 +++++++++----------
1 file changed, 310 insertions(+), 310 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/af3b31b5/ugsync/src/main/java/org/apache/ranger/unixusersync/config/UserGroupSyncConfig.java
----------------------------------------------------------------------
diff --git a/ugsync/src/main/java/org/apache/ranger/unixusersync/config/UserGroupSyncConfig.java b/ugsync/src/main/java/org/apache/ranger/unixusersync/config/UserGroupSyncConfig.java
index 938f6f8..734dc58 100644
--- a/ugsync/src/main/java/org/apache/ranger/unixusersync/config/UserGroupSyncConfig.java
+++ b/ugsync/src/main/java/org/apache/ranger/unixusersync/config/UserGroupSyncConfig.java
@@ -17,7 +17,7 @@
* under the License.
*/
- package org.apache.ranger.unixusersync.config;
+package org.apache.ranger.unixusersync.config;
import java.io.File;
import java.io.FileInputStream;
@@ -49,44 +49,44 @@ import org.apache.log4j.Logger;
public class UserGroupSyncConfig {
public static final String CONFIG_FILE = "ranger-ugsync-site.xml";
- private static final Logger LOG = Logger.getLogger(UserGroupSyncConfig.class);
+ private static final Logger LOG = Logger.getLogger(UserGroupSyncConfig.class);
public static final String DEFAULT_CONFIG_FILE = "ranger-ugsync-default-site.xml";
-
+
private static final String CORE_SITE_CONFIG_FILE = "core-site.xml";
-
+
public static final String UGSYNC_ENABLED_PROP = "ranger.usersync.enabled";
-
+
public static final String UGSYNC_PM_URL_PROP = "ranger.usersync.policymanager.baseURL";
-
+
public static final String UGSYNC_MIN_USERID_PROP = "ranger.usersync.unix.minUserId";
public static final String UGSYNC_MIN_GROUPID_PROP = "ranger.usersync.unix.minGroupId";
- public static final String DEFAULT_UGSYNC_MIN_GROUPID = "0";
+ public static final String DEFAULT_UGSYNC_MIN_GROUPID = "0";
public static final String UGSYNC_MAX_RECORDS_PER_API_CALL_PROP = "ranger.usersync.policymanager.maxrecordsperapicall";
public static final String UGSYNC_MOCK_RUN_PROP = "ranger.usersync.policymanager.mockrun";
-
+
public static final String UGSYNC_SOURCE_FILE_PROC = "ranger.usersync.filesource.file";
public static final String UGSYNC_SOURCE_FILE_DELIMITER = "ranger.usersync.filesource.text.delimiter";
public static final String UGSYNC_SOURCE_FILE_DELIMITERER = "ranger.usersync.filesource.text.delimiterer";
-
+
private static final String SSL_KEYSTORE_PATH_PARAM = "ranger.usersync.keystore.file";
private static final String SSL_KEYSTORE_PATH_PASSWORD_PARAM = "ranger.usersync.keystore.password";
-
+
private static final String SSL_TRUSTSTORE_PATH_PARAM = "ranger.usersync.truststore.file";
-
+
private static final String SSL_TRUSTSTORE_PATH_PASSWORD_PARAM = "ranger.usersync.truststore.password";
-
+
private static final String UGSYNC_SLEEP_TIME_IN_MILLIS_BETWEEN_CYCLE_PARAM = "ranger.usersync.sleeptimeinmillisbetweensynccycle";
-
+
private static final long UGSYNC_SLEEP_TIME_IN_MILLIS_BETWEEN_CYCLE_MIN_VALUE = 60000L;
private static final long UGSYNC_SLEEP_TIME_IN_MILLIS_BETWEEN_CYCLE_UNIX_DEFAULT_VALUE = 60000L;
-
+
private static final long UGSYNC_SLEEP_TIME_IN_MILLIS_BETWEEN_CYCLE_LDAP_DEFAULT_VALUE = 3600000L;
private static final String UGSYNC_SOURCE_CLASS_PARAM = "ranger.usersync.source.impl.class";
@@ -98,88 +98,88 @@ public class UserGroupSyncConfig {
private static final String UGSYNC_SINK_CLASS = "org.apache.ranger.unixusersync.process.PolicyMgrUserGroupBuilder";
private static final String LGSYNC_SOURCE_CLASS = "org.apache.ranger.ldapusersync.process.LdapUserGroupBuilder";
-
+
private static final String LGSYNC_LDAP_URL = "ranger.usersync.ldap.url";
private static final String LGSYNC_LDAP_STARTTLS_ENABLED = "ranger.usersync.ldap.starttls";
private static final boolean DEFAULT_LGSYNC_LDAP_STARTTLS_ENABLED = false;
-
+
private static final String LGSYNC_LDAP_BIND_DN = "ranger.usersync.ldap.binddn";
-
+
private static final String LGSYNC_LDAP_BIND_KEYSTORE = "ranger.usersync.credstore.filename";
-
+
private static final String LGSYNC_LDAP_BIND_ALIAS = "ranger.usersync.ldap.bindalias";
-
+
private static final String LGSYNC_LDAP_BIND_PASSWORD = "ranger.usersync.ldap.ldapbindpassword";
-
+
private static final String LGSYNC_LDAP_AUTHENTICATION_MECHANISM = "ranger.usersync.ldap.authentication.mechanism";
- private static final String DEFAULT_AUTHENTICATION_MECHANISM = "simple";
+ private static final String DEFAULT_AUTHENTICATION_MECHANISM = "simple";
- private static final String LGSYNC_SEARCH_BASE = "ranger.usersync.ldap.searchBase";
+ private static final String LGSYNC_SEARCH_BASE = "ranger.usersync.ldap.searchBase";
- private static final String LGSYNC_USER_SEARCH_BASE = "ranger.usersync.ldap.user.searchbase";
+ private static final String LGSYNC_USER_SEARCH_BASE = "ranger.usersync.ldap.user.searchbase";
- private static final String LGSYNC_USER_SEARCH_SCOPE = "ranger.usersync.ldap.user.searchscope";
+ private static final String LGSYNC_USER_SEARCH_SCOPE = "ranger.usersync.ldap.user.searchscope";
private static final String LGSYNC_USER_OBJECT_CLASS = "ranger.usersync.ldap.user.objectclass";
- private static final String DEFAULT_USER_OBJECT_CLASS = "person";
-
+ private static final String DEFAULT_USER_OBJECT_CLASS = "person";
+
private static final String LGSYNC_USER_SEARCH_FILTER = "ranger.usersync.ldap.user.searchfilter";
-
+
private static final String LGSYNC_USER_NAME_ATTRIBUTE = "ranger.usersync.ldap.user.nameattribute";
- private static final String DEFAULT_USER_NAME_ATTRIBUTE = "cn";
-
+ private static final String DEFAULT_USER_NAME_ATTRIBUTE = "cn";
+
private static final String LGSYNC_USER_GROUP_NAME_ATTRIBUTE = "ranger.usersync.ldap.user.groupnameattribute";
- private static final String DEFAULT_USER_GROUP_NAME_ATTRIBUTE = "memberof,ismemberof";
-
+ private static final String DEFAULT_USER_GROUP_NAME_ATTRIBUTE = "memberof,ismemberof";
+
public static final String UGSYNC_NONE_CASE_CONVERSION_VALUE = "none";
public static final String UGSYNC_LOWER_CASE_CONVERSION_VALUE = "lower";
public static final String UGSYNC_UPPER_CASE_CONVERSION_VALUE = "upper";
-
+
private static final String UGSYNC_USERNAME_CASE_CONVERSION_PARAM = "ranger.usersync.ldap.username.caseconversion";
- private static final String DEFAULT_UGSYNC_USERNAME_CASE_CONVERSION_VALUE = UGSYNC_NONE_CASE_CONVERSION_VALUE;
+ private static final String DEFAULT_UGSYNC_USERNAME_CASE_CONVERSION_VALUE = UGSYNC_NONE_CASE_CONVERSION_VALUE;
private static final String UGSYNC_GROUPNAME_CASE_CONVERSION_PARAM = "ranger.usersync.ldap.groupname.caseconversion";
private static final String DEFAULT_UGSYNC_GROUPNAME_CASE_CONVERSION_VALUE = UGSYNC_NONE_CASE_CONVERSION_VALUE;
-
+
private static final String DEFAULT_USER_GROUP_TEXTFILE_DELIMITER = ",";
- private static final String LGSYNC_PAGED_RESULTS_ENABLED = "ranger.usersync.pagedresultsenabled";
- private static final boolean DEFAULT_LGSYNC_PAGED_RESULTS_ENABLED = true;
+ private static final String LGSYNC_PAGED_RESULTS_ENABLED = "ranger.usersync.pagedresultsenabled";
+ private static final boolean DEFAULT_LGSYNC_PAGED_RESULTS_ENABLED = true;
- private static final String LGSYNC_PAGED_RESULTS_SIZE = "ranger.usersync.pagedresultssize";
- private static final int DEFAULT_LGSYNC_PAGED_RESULTS_SIZE = 500;
+ private static final String LGSYNC_PAGED_RESULTS_SIZE = "ranger.usersync.pagedresultssize";
+ private static final int DEFAULT_LGSYNC_PAGED_RESULTS_SIZE = 500;
- private static final String LGSYNC_GROUP_SEARCH_ENABLED = "ranger.usersync.group.searchenabled";
- private static final boolean DEFAULT_LGSYNC_GROUP_SEARCH_ENABLED = false;
+ private static final String LGSYNC_GROUP_SEARCH_ENABLED = "ranger.usersync.group.searchenabled";
+ private static final boolean DEFAULT_LGSYNC_GROUP_SEARCH_ENABLED = false;
- private static final String LGSYNC_GROUP_SEARCH_FIRST_ENABLED = "ranger.usersync.group.search.first.enabled";
- private static final boolean DEFAULT_LGSYNC_GROUP_SEARCH_FIRST_ENABLED = false;
+ private static final String LGSYNC_GROUP_SEARCH_FIRST_ENABLED = "ranger.usersync.group.search.first.enabled";
+ private static final boolean DEFAULT_LGSYNC_GROUP_SEARCH_FIRST_ENABLED = false;
-/*This flag (ranger.usersync.user.searchenabled) is used only when group search first is enabled to get username either -
- * from the group member attribute of the group or
- * from the additional user search based on the user attribute configuration
- */
- private static final String LGSYNC_USER_SEARCH_ENABLED = "ranger.usersync.user.searchenabled";
- private static final boolean DEFAULT_LGSYNC_USER_SEARCH_ENABLED = false;
+ /*This flag (ranger.usersync.user.searchenabled) is used only when group search first is enabled to get username either -
+ * from the group member attribute of the group or
+ * from the additional user search based on the user attribute configuration
+ */
+ private static final String LGSYNC_USER_SEARCH_ENABLED = "ranger.usersync.user.searchenabled";
+ private static final boolean DEFAULT_LGSYNC_USER_SEARCH_ENABLED = false;
- private static final String LGSYNC_GROUP_USER_MAP_SYNC_ENABLED = "ranger.usersync.group.usermapsyncenabled";
- private static final boolean DEFAULT_LGSYNC_GROUP_USER_MAP_SYNC_ENABLED = false;
+ private static final String LGSYNC_GROUP_USER_MAP_SYNC_ENABLED = "ranger.usersync.group.usermapsyncenabled";
+ private static final boolean DEFAULT_LGSYNC_GROUP_USER_MAP_SYNC_ENABLED = false;
- private static final String LGSYNC_GROUP_SEARCH_BASE = "ranger.usersync.group.searchbase";
+ private static final String LGSYNC_GROUP_SEARCH_BASE = "ranger.usersync.group.searchbase";
- private static final String LGSYNC_GROUP_SEARCH_SCOPE = "ranger.usersync.group.searchscope";
+ private static final String LGSYNC_GROUP_SEARCH_SCOPE = "ranger.usersync.group.searchscope";
- private static final String LGSYNC_GROUP_OBJECT_CLASS = "ranger.usersync.group.objectclass";
- private static final String DEFAULT_LGSYNC_GROUP_OBJECT_CLASS = "groupofnames";
+ private static final String LGSYNC_GROUP_OBJECT_CLASS = "ranger.usersync.group.objectclass";
+ private static final String DEFAULT_LGSYNC_GROUP_OBJECT_CLASS = "groupofnames";
- private static final String LGSYNC_GROUP_SEARCH_FILTER = "ranger.usersync.group.searchfilter";
+ private static final String LGSYNC_GROUP_SEARCH_FILTER = "ranger.usersync.group.searchfilter";
- private static final String LGSYNC_GROUP_NAME_ATTRIBUTE = "ranger.usersync.group.nameattribute";
- private static final String DEFAULT_LGSYNC_GROUP_NAME_ATTRIBUTE = "cn";
+ private static final String LGSYNC_GROUP_NAME_ATTRIBUTE = "ranger.usersync.group.nameattribute";
+ private static final String DEFAULT_LGSYNC_GROUP_NAME_ATTRIBUTE = "cn";
- private static final String LGSYNC_GROUP_MEMBER_ATTRIBUTE_NAME = "ranger.usersync.group.memberattributename";
- private static final String DEFAULT_LGSYNC_GROUP_MEMBER_ATTRIBUTE_NAME = "member";
+ private static final String LGSYNC_GROUP_MEMBER_ATTRIBUTE_NAME = "ranger.usersync.group.memberattributename";
+ private static final String DEFAULT_LGSYNC_GROUP_MEMBER_ATTRIBUTE_NAME = "member";
private static final String UGSYNC_UPDATE_MILLIS_MIN = "ranger.usersync.unix.updatemillismin";
private final static long DEFAULT_UGSYNC_UPDATE_MILLIS_MIN = 1 * 60 * 1000; // ms
@@ -205,21 +205,21 @@ public class UserGroupSyncConfig {
private static final String SYNC_SOURCE = "ranger.usersync.sync.source";
private static final String LGSYNC_REFERRAL = "ranger.usersync.ldap.referral";
private static final String DEFAULT_LGSYNC_REFERRAL = "ignore";
-
+
public static final String SYNC_MAPPING_USERNAME = "ranger.usersync.mapping.username.regex";
- public static final String SYNC_MAPPING_GROUPNAME = "ranger.usersync.mapping.groupname.regex";
+ public static final String SYNC_MAPPING_GROUPNAME = "ranger.usersync.mapping.groupname.regex";
- private static final String SYNC_MAPPING_USERNAME_HANDLER = "ranger.usersync.mapping.username.handler";
- private static final String DEFAULT_SYNC_MAPPING_USERNAME_HANDLER = "org.apache.ranger.usergroupsync.RegEx";
+ private static final String SYNC_MAPPING_USERNAME_HANDLER = "ranger.usersync.mapping.username.handler";
+ private static final String DEFAULT_SYNC_MAPPING_USERNAME_HANDLER = "org.apache.ranger.usergroupsync.RegEx";
- private static final String SYNC_MAPPING_GROUPNAME_HANDLER = "ranger.usersync.mapping.groupname.handler";
- private static final String DEFAULT_SYNC_MAPPING_GROUPNAME_HANDLER = "org.apache.ranger.usergroupsync.RegEx";
+ private static final String SYNC_MAPPING_GROUPNAME_HANDLER = "ranger.usersync.mapping.groupname.handler";
+ private static final String DEFAULT_SYNC_MAPPING_GROUPNAME_HANDLER = "org.apache.ranger.usergroupsync.RegEx";
private Properties prop = new Properties();
-
+
private static volatile UserGroupSyncConfig me = null;
-
+
public static UserGroupSyncConfig getInstance() {
UserGroupSyncConfig result = me;
if (result == null) {
@@ -232,7 +232,7 @@ public class UserGroupSyncConfig {
}
return result;
}
-
+
private UserGroupSyncConfig() {
init();
}
@@ -248,7 +248,7 @@ public class UserGroupSyncConfig {
InputStream in = getFileInputStream(fileName);
if (in != null) {
try {
-// prop.load(in);
+ // prop.load(in);
DocumentBuilderFactory xmlDocumentBuilderFactory = DocumentBuilderFactory
.newInstance();
xmlDocumentBuilderFactory.setIgnoringComments(true);
@@ -287,7 +287,7 @@ public class UserGroupSyncConfig {
if (prop.get(propertyName) != null) {
prop.remove(propertyName);
}
-
+
prop.put(propertyName, propertyValue);
}
@@ -306,8 +306,8 @@ public class UserGroupSyncConfig {
throw new RuntimeException("Unable to load configuration file [" + CONFIG_FILE + "]", e);
}
}
-
-
+
+
private InputStream getFileInputStream(String path) throws FileNotFoundException {
InputStream ret = null;
@@ -318,13 +318,13 @@ public class UserGroupSyncConfig {
ret = new FileInputStream(f);
} else {
ret = getClass().getResourceAsStream(path);
-
+
if (ret == null) {
if (! path.startsWith("/")) {
ret = getClass().getResourceAsStream("/" + path);
}
}
-
+
if (ret == null) {
ret = ClassLoader.getSystemClassLoader().getResourceAsStream(path);
if (ret == null) {
@@ -337,12 +337,12 @@ public class UserGroupSyncConfig {
return ret;
}
-
+
public String getUserSyncFileSource(){
String val = prop.getProperty(UGSYNC_SOURCE_FILE_PROC);
return val;
}
-
+
public String getUserSyncFileSourceDelimiter(){
String val = prop.getProperty(UGSYNC_SOURCE_FILE_DELIMITER);
if (val == null) {
@@ -386,43 +386,43 @@ public class UserGroupSyncConfig {
public String getPolicyManagerBaseURL() {
return prop.getProperty(UGSYNC_PM_URL_PROP);
}
-
-
+
+
public String getMinUserId() {
return prop.getProperty(UGSYNC_MIN_USERID_PROP);
}
public String getMinGroupId() {
- String mgid = prop.getProperty(UGSYNC_MIN_GROUPID_PROP);
- if (mgid == null) {
- mgid = DEFAULT_UGSYNC_MIN_GROUPID;
- }
- return mgid;
- }
-
+ String mgid = prop.getProperty(UGSYNC_MIN_GROUPID_PROP);
+ if (mgid == null) {
+ mgid = DEFAULT_UGSYNC_MIN_GROUPID;
+ }
+ return mgid;
+ }
+
public String getMaxRecordsPerAPICall() {
return prop.getProperty(UGSYNC_MAX_RECORDS_PER_API_CALL_PROP);
}
-
-
+
+
public String getSSLKeyStorePath() {
return prop.getProperty(SSL_KEYSTORE_PATH_PARAM);
}
-
+
public String getSSLKeyStorePathPassword() {
return prop.getProperty(SSL_KEYSTORE_PATH_PASSWORD_PARAM);
}
-
+
public String getSSLTrustStorePath() {
return prop.getProperty(SSL_TRUSTSTORE_PATH_PARAM);
}
-
-
+
+
public String getSSLTrustStorePathPassword() {
return prop.getProperty(SSL_TRUSTSTORE_PATH_PASSWORD_PARAM);
}
-
+
public long getUpdateMillisMin() {
String val = prop.getProperty(UGSYNC_UPDATE_MILLIS_MIN);
if (val == null) {
@@ -464,8 +464,8 @@ public class UserGroupSyncConfig {
return ret;
}
}
-
-
+
+
public UserGroupSource getUserGroupSource() throws Throwable {
String val = prop.getProperty(UGSYNC_SOURCE_CLASS_PARAM);
@@ -494,7 +494,7 @@ public class UserGroupSyncConfig {
return ret;
}
-
+
public UserGroupSink getUserGroupSink() throws Throwable {
String val = prop.getProperty(UGSYNC_SINK_CLASS_PARAM);
@@ -509,7 +509,7 @@ public class UserGroupSyncConfig {
return ret;
}
-
+
public String getLdapUrl() throws Throwable {
String val = prop.getProperty(LGSYNC_LDAP_URL);
if(val == null || val.trim().isEmpty()) {
@@ -518,7 +518,7 @@ public class UserGroupSyncConfig {
return val;
}
-
+
public String getLdapBindDn() throws Throwable {
String val = prop.getProperty(LGSYNC_LDAP_BIND_DN);
if(val == null || val.trim().isEmpty()) {
@@ -526,8 +526,8 @@ public class UserGroupSyncConfig {
}
return val;
}
-
-
+
+
public String getLdapBindPassword() {
//update credential from keystore
if (prop == null) {
@@ -547,8 +547,8 @@ public class UserGroupSyncConfig {
}
return prop.getProperty(LGSYNC_LDAP_BIND_PASSWORD);
}
-
-
+
+
public String getLdapAuthenticationMechanism() {
String val = prop.getProperty(LGSYNC_LDAP_AUTHENTICATION_MECHANISM);
if(val == null || val.trim().isEmpty()) {
@@ -556,26 +556,26 @@ public class UserGroupSyncConfig {
}
return val;
}
-
-
+
+
public String getUserSearchBase() throws Throwable {
String val = prop.getProperty(LGSYNC_USER_SEARCH_BASE);
- if(val == null || val.trim().isEmpty()) {
- val = getSearchBase();
- }
+ if(val == null || val.trim().isEmpty()) {
+ val = getSearchBase();
+ }
if(val == null || val.trim().isEmpty()) {
throw new Exception(LGSYNC_USER_SEARCH_BASE + " for LdapGroupSync is not specified");
}
return val;
}
-
-
+
+
public int getUserSearchScope() {
String val = prop.getProperty(LGSYNC_USER_SEARCH_SCOPE);
if (val == null || val.trim().isEmpty()) {
return 2; //subtree scope
}
-
+
val = val.trim().toLowerCase();
if (val.equals("0") || val.startsWith("base")) {
return 0; // object scope
@@ -585,8 +585,8 @@ public class UserGroupSyncConfig {
return 2; // subtree scope
}
}
-
-
+
+
public String getUserObjectClass() {
String val = prop.getProperty(LGSYNC_USER_OBJECT_CLASS);
if (val == null || val.trim().isEmpty()) {
@@ -594,12 +594,12 @@ public class UserGroupSyncConfig {
}
return val;
}
-
+
public String getUserSearchFilter() {
return prop.getProperty(LGSYNC_USER_SEARCH_FILTER);
}
-
+
public String getUserNameAttribute() {
String val = prop.getProperty(LGSYNC_USER_NAME_ATTRIBUTE);
if(val == null || val.trim().isEmpty()) {
@@ -607,7 +607,7 @@ public class UserGroupSyncConfig {
}
return val;
}
-
+
public String getUserGroupNameAttribute() {
String val = prop.getProperty(LGSYNC_USER_GROUP_NAME_ATTRIBUTE);
if(val == null || val.trim().isEmpty()) {
@@ -615,7 +615,7 @@ public class UserGroupSyncConfig {
}
return val;
}
-
+
public Set<String> getUserGroupNameAttributeSet() {
String uga = getUserGroupNameAttribute();
StringTokenizer st = new StringTokenizer(uga, ",");
@@ -625,152 +625,152 @@ public class UserGroupSyncConfig {
}
return userGroupNameAttributeSet;
}
-
+
public String getUserNameCaseConversion() {
- String ret = prop.getProperty(UGSYNC_USERNAME_CASE_CONVERSION_PARAM, DEFAULT_UGSYNC_USERNAME_CASE_CONVERSION_VALUE);
- return ret.trim().toLowerCase();
- }
-
- public String getGroupNameCaseConversion() {
- String ret = prop.getProperty(UGSYNC_GROUPNAME_CASE_CONVERSION_PARAM, DEFAULT_UGSYNC_GROUPNAME_CASE_CONVERSION_VALUE);
- return ret.trim().toLowerCase();
- }
-
- public String getSearchBase() {
- return prop.getProperty(LGSYNC_SEARCH_BASE);
- }
-
- public boolean isPagedResultsEnabled() {
- boolean pagedResultsEnabled;
- String val = prop.getProperty(LGSYNC_PAGED_RESULTS_ENABLED);
- if(val == null || val.trim().isEmpty()) {
- pagedResultsEnabled = DEFAULT_LGSYNC_PAGED_RESULTS_ENABLED;
- } else {
- pagedResultsEnabled = Boolean.valueOf(val);
- }
- return pagedResultsEnabled;
- }
-
- public int getPagedResultsSize() {
- int pagedResultsSize = DEFAULT_LGSYNC_PAGED_RESULTS_SIZE;
- String val = prop.getProperty(LGSYNC_PAGED_RESULTS_SIZE);
- if(val == null || val.trim().isEmpty()) {
- pagedResultsSize = DEFAULT_LGSYNC_PAGED_RESULTS_SIZE;
- } else {
- pagedResultsSize = Integer.parseInt(val);
- }
- if (pagedResultsSize < 1) {
- pagedResultsSize = DEFAULT_LGSYNC_PAGED_RESULTS_SIZE;
- }
- return pagedResultsSize;
- }
-
- public boolean isGroupSearchEnabled() {
- boolean groupSearchEnabled;
- String val = prop.getProperty(LGSYNC_GROUP_SEARCH_ENABLED);
- if(val == null || val.trim().isEmpty()) {
- groupSearchEnabled = DEFAULT_LGSYNC_GROUP_SEARCH_ENABLED;
- } else {
- groupSearchEnabled = Boolean.valueOf(val);
- }
- return groupSearchEnabled;
- }
-
- public boolean isGroupSearchFirstEnabled() {
- boolean groupSearchFirstEnabled;
- String val = prop.getProperty(LGSYNC_GROUP_SEARCH_FIRST_ENABLED);
- if(val == null || val.trim().isEmpty()) {
- groupSearchFirstEnabled = DEFAULT_LGSYNC_GROUP_SEARCH_FIRST_ENABLED;
- } else {
- groupSearchFirstEnabled = Boolean.valueOf(val);
- }
- return groupSearchFirstEnabled;
- }
-
- public boolean isUserSearchEnabled() {
- boolean userSearchEnabled;
- String val = prop.getProperty(LGSYNC_USER_SEARCH_ENABLED);
- if(val == null || val.trim().isEmpty()) {
- userSearchEnabled = DEFAULT_LGSYNC_USER_SEARCH_ENABLED;
- } else {
- userSearchEnabled = Boolean.valueOf(val);
- }
- return userSearchEnabled;
- }
-
- public boolean isGroupUserMapSyncEnabled() {
- boolean groupUserMapSyncEnabled;
- String val = prop.getProperty(LGSYNC_GROUP_USER_MAP_SYNC_ENABLED);
- if(val == null || val.trim().isEmpty()) {
- groupUserMapSyncEnabled = DEFAULT_LGSYNC_GROUP_USER_MAP_SYNC_ENABLED;
- } else {
- groupUserMapSyncEnabled = Boolean.valueOf(val);
- }
- return groupUserMapSyncEnabled;
- }
-
- public String getGroupSearchBase() throws Throwable {
- String val = prop.getProperty(LGSYNC_GROUP_SEARCH_BASE);
- if(val == null || val.trim().isEmpty()) {
- val = getSearchBase();
- }
- if(val == null || val.trim().isEmpty()) {
- val = getUserSearchBase();
- }
- return val;
- }
-
- public int getGroupSearchScope() {
- String val = prop.getProperty(LGSYNC_GROUP_SEARCH_SCOPE);
- if (val == null || val.trim().isEmpty()) {
- return 2; //subtree scope
- }
-
- val = val.trim().toLowerCase();
- if (val.equals("0") || val.startsWith("base")) {
- return 0; // object scope
- } else if (val.equals("1") || val.startsWith("one")) {
- return 1; // one level scope
- } else {
- return 2; // subtree scope
- }
- }
-
- public String getGroupObjectClass() {
- String val = prop.getProperty(LGSYNC_GROUP_OBJECT_CLASS);
- if (val == null || val.trim().isEmpty()) {
- return DEFAULT_LGSYNC_GROUP_OBJECT_CLASS;
- }
- return val;
- }
-
- public String getGroupSearchFilter() {
- return prop.getProperty(LGSYNC_GROUP_SEARCH_FILTER);
- }
-
- public String getUserGroupMemberAttributeName() {
- String val = prop.getProperty(LGSYNC_GROUP_MEMBER_ATTRIBUTE_NAME);
- if (val == null || val.trim().isEmpty()) {
- return DEFAULT_LGSYNC_GROUP_MEMBER_ATTRIBUTE_NAME;
- }
- return val;
- }
-
- public String getGroupNameAttribute() {
- String val = prop.getProperty(LGSYNC_GROUP_NAME_ATTRIBUTE);
- if (val == null || val.trim().isEmpty()) {
- return DEFAULT_LGSYNC_GROUP_NAME_ATTRIBUTE;
- }
- return val;
- }
-
- public String getProperty(String aPropertyName) {
- return prop.getProperty(aPropertyName);
- }
-
- public String getProperty(String aPropertyName, String aDefaultValue) {
- return prop.getProperty(aPropertyName, aDefaultValue);
- }
+ String ret = prop.getProperty(UGSYNC_USERNAME_CASE_CONVERSION_PARAM, DEFAULT_UGSYNC_USERNAME_CASE_CONVERSION_VALUE);
+ return ret.trim().toLowerCase();
+ }
+
+ public String getGroupNameCaseConversion() {
+ String ret = prop.getProperty(UGSYNC_GROUPNAME_CASE_CONVERSION_PARAM, DEFAULT_UGSYNC_GROUPNAME_CASE_CONVERSION_VALUE);
+ return ret.trim().toLowerCase();
+ }
+
+ public String getSearchBase() {
+ return prop.getProperty(LGSYNC_SEARCH_BASE);
+ }
+
+ public boolean isPagedResultsEnabled() {
+ boolean pagedResultsEnabled;
+ String val = prop.getProperty(LGSYNC_PAGED_RESULTS_ENABLED);
+ if(val == null || val.trim().isEmpty()) {
+ pagedResultsEnabled = DEFAULT_LGSYNC_PAGED_RESULTS_ENABLED;
+ } else {
+ pagedResultsEnabled = Boolean.valueOf(val);
+ }
+ return pagedResultsEnabled;
+ }
+
+ public int getPagedResultsSize() {
+ int pagedResultsSize = DEFAULT_LGSYNC_PAGED_RESULTS_SIZE;
+ String val = prop.getProperty(LGSYNC_PAGED_RESULTS_SIZE);
+ if(val == null || val.trim().isEmpty()) {
+ pagedResultsSize = DEFAULT_LGSYNC_PAGED_RESULTS_SIZE;
+ } else {
+ pagedResultsSize = Integer.parseInt(val);
+ }
+ if (pagedResultsSize < 1) {
+ pagedResultsSize = DEFAULT_LGSYNC_PAGED_RESULTS_SIZE;
+ }
+ return pagedResultsSize;
+ }
+
+ public boolean isGroupSearchEnabled() {
+ boolean groupSearchEnabled;
+ String val = prop.getProperty(LGSYNC_GROUP_SEARCH_ENABLED);
+ if(val == null || val.trim().isEmpty()) {
+ groupSearchEnabled = DEFAULT_LGSYNC_GROUP_SEARCH_ENABLED;
+ } else {
+ groupSearchEnabled = Boolean.valueOf(val);
+ }
+ return groupSearchEnabled;
+ }
+
+ public boolean isGroupSearchFirstEnabled() {
+ boolean groupSearchFirstEnabled;
+ String val = prop.getProperty(LGSYNC_GROUP_SEARCH_FIRST_ENABLED);
+ if(val == null || val.trim().isEmpty()) {
+ groupSearchFirstEnabled = DEFAULT_LGSYNC_GROUP_SEARCH_FIRST_ENABLED;
+ } else {
+ groupSearchFirstEnabled = Boolean.valueOf(val);
+ }
+ return groupSearchFirstEnabled;
+ }
+
+ public boolean isUserSearchEnabled() {
+ boolean userSearchEnabled;
+ String val = prop.getProperty(LGSYNC_USER_SEARCH_ENABLED);
+ if(val == null || val.trim().isEmpty()) {
+ userSearchEnabled = DEFAULT_LGSYNC_USER_SEARCH_ENABLED;
+ } else {
+ userSearchEnabled = Boolean.valueOf(val);
+ }
+ return userSearchEnabled;
+ }
+
+ public boolean isGroupUserMapSyncEnabled() {
+ boolean groupUserMapSyncEnabled;
+ String val = prop.getProperty(LGSYNC_GROUP_USER_MAP_SYNC_ENABLED);
+ if(val == null || val.trim().isEmpty()) {
+ groupUserMapSyncEnabled = DEFAULT_LGSYNC_GROUP_USER_MAP_SYNC_ENABLED;
+ } else {
+ groupUserMapSyncEnabled = Boolean.valueOf(val);
+ }
+ return groupUserMapSyncEnabled;
+ }
+
+ public String getGroupSearchBase() throws Throwable {
+ String val = prop.getProperty(LGSYNC_GROUP_SEARCH_BASE);
+ if(val == null || val.trim().isEmpty()) {
+ val = getSearchBase();
+ }
+ if(val == null || val.trim().isEmpty()) {
+ val = getUserSearchBase();
+ }
+ return val;
+ }
+
+ public int getGroupSearchScope() {
+ String val = prop.getProperty(LGSYNC_GROUP_SEARCH_SCOPE);
+ if (val == null || val.trim().isEmpty()) {
+ return 2; //subtree scope
+ }
+
+ val = val.trim().toLowerCase();
+ if (val.equals("0") || val.startsWith("base")) {
+ return 0; // object scope
+ } else if (val.equals("1") || val.startsWith("one")) {
+ return 1; // one level scope
+ } else {
+ return 2; // subtree scope
+ }
+ }
+
+ public String getGroupObjectClass() {
+ String val = prop.getProperty(LGSYNC_GROUP_OBJECT_CLASS);
+ if (val == null || val.trim().isEmpty()) {
+ return DEFAULT_LGSYNC_GROUP_OBJECT_CLASS;
+ }
+ return val;
+ }
+
+ public String getGroupSearchFilter() {
+ return prop.getProperty(LGSYNC_GROUP_SEARCH_FILTER);
+ }
+
+ public String getUserGroupMemberAttributeName() {
+ String val = prop.getProperty(LGSYNC_GROUP_MEMBER_ATTRIBUTE_NAME);
+ if (val == null || val.trim().isEmpty()) {
+ return DEFAULT_LGSYNC_GROUP_MEMBER_ATTRIBUTE_NAME;
+ }
+ return val;
+ }
+
+ public String getGroupNameAttribute() {
+ String val = prop.getProperty(LGSYNC_GROUP_NAME_ATTRIBUTE);
+ if (val == null || val.trim().isEmpty()) {
+ return DEFAULT_LGSYNC_GROUP_NAME_ATTRIBUTE;
+ }
+ return val;
+ }
+
+ public String getProperty(String aPropertyName) {
+ return prop.getProperty(aPropertyName);
+ }
+
+ public String getProperty(String aPropertyName, String aDefaultValue) {
+ return prop.getProperty(aPropertyName, aDefaultValue);
+ }
public String getPolicyMgrPassword(){
//update credential from keystore
@@ -843,7 +843,7 @@ public class UserGroupSyncConfig {
}
return referral;
}
-
+
public List<String> getAllRegexPatterns(String baseProperty) throws Throwable {
List<String> regexPatterns = new ArrayList<String>();
if (prop != null) {
@@ -894,62 +894,62 @@ public class UserGroupSyncConfig {
}
/* Used only for unit testing */
- public void setUserSearchFilter(String filter) {
- prop.setProperty(LGSYNC_USER_SEARCH_FILTER, filter);
- }
+ public void setUserSearchFilter(String filter) {
+ prop.setProperty(LGSYNC_USER_SEARCH_FILTER, filter);
+ }
- /* Used only for unit testing */
- public void setGroupSearchFilter(String filter) {
- prop.setProperty(LGSYNC_GROUP_SEARCH_FILTER, filter);
- }
+ /* Used only for unit testing */
+ public void setGroupSearchFilter(String filter) {
+ prop.setProperty(LGSYNC_GROUP_SEARCH_FILTER, filter);
+ }
- /* Used only for unit testing */
- public void setGroupSearchEnabled(boolean groupSearchEnabled) {
- prop.setProperty(LGSYNC_GROUP_SEARCH_ENABLED, String.valueOf(groupSearchEnabled));
- }
+ /* Used only for unit testing */
+ public void setGroupSearchEnabled(boolean groupSearchEnabled) {
+ prop.setProperty(LGSYNC_GROUP_SEARCH_ENABLED, String.valueOf(groupSearchEnabled));
+ }
- /* Used only for unit testing */
- public void setPagedResultsEnabled(boolean pagedResultsEnabled) {
- prop.setProperty(LGSYNC_PAGED_RESULTS_ENABLED, String.valueOf(pagedResultsEnabled));
- }
+ /* Used only for unit testing */
+ public void setPagedResultsEnabled(boolean pagedResultsEnabled) {
+ prop.setProperty(LGSYNC_PAGED_RESULTS_ENABLED, String.valueOf(pagedResultsEnabled));
+ }
/* Used only for unit testing */
public void setProperty(String name, String value) {
prop.setProperty(name, value);
}
- /* Used only for unit testing */
- public void setUserSearchBase(String userSearchBase) throws Throwable {
- prop.setProperty(LGSYNC_USER_SEARCH_BASE, userSearchBase);
- }
-
- /* Used only for unit testing */
- public void setGroupSearchBase(String groupSearchBase) throws Throwable {
- prop.setProperty(LGSYNC_GROUP_SEARCH_BASE, groupSearchBase);
- }
-
- /* Used only for unit testing */
- public void setGroupSearchFirstEnabled(boolean groupSearchFirstEnabled) {
- prop.setProperty(LGSYNC_GROUP_SEARCH_FIRST_ENABLED, String.valueOf(groupSearchFirstEnabled));
- }
-
- /* Used only for unit testing */
- public void setUserSearchEnabled(boolean userSearchEnabled) {
- prop.setProperty(LGSYNC_USER_SEARCH_ENABLED, String.valueOf(userSearchEnabled));
- }
-
- /* Used only for unit testing */
- public void setUserGroupMemberAttributeName(String groupMemberAttrName) {
- prop.setProperty(LGSYNC_GROUP_MEMBER_ATTRIBUTE_NAME, groupMemberAttrName);
- }
-
- /* Used only for unit testing */
- public void setUserObjectClass(String userObjectClass) {
- prop.setProperty(LGSYNC_USER_OBJECT_CLASS, userObjectClass);
- }
-
- /* Used only for unit testing */
- public void setGroupObjectClass(String groupObjectClass) {
- prop.setProperty(LGSYNC_GROUP_OBJECT_CLASS, groupObjectClass);
- }
+ /* Used only for unit testing */
+ public void setUserSearchBase(String userSearchBase) throws Throwable {
+ prop.setProperty(LGSYNC_USER_SEARCH_BASE, userSearchBase);
+ }
+
+ /* Used only for unit testing */
+ public void setGroupSearchBase(String groupSearchBase) throws Throwable {
+ prop.setProperty(LGSYNC_GROUP_SEARCH_BASE, groupSearchBase);
+ }
+
+ /* Used only for unit testing */
+ public void setGroupSearchFirstEnabled(boolean groupSearchFirstEnabled) {
+ prop.setProperty(LGSYNC_GROUP_SEARCH_FIRST_ENABLED, String.valueOf(groupSearchFirstEnabled));
+ }
+
+ /* Used only for unit testing */
+ public void setUserSearchEnabled(boolean userSearchEnabled) {
+ prop.setProperty(LGSYNC_USER_SEARCH_ENABLED, String.valueOf(userSearchEnabled));
+ }
+
+ /* Used only for unit testing */
+ public void setUserGroupMemberAttributeName(String groupMemberAttrName) {
+ prop.setProperty(LGSYNC_GROUP_MEMBER_ATTRIBUTE_NAME, groupMemberAttrName);
+ }
+
+ /* Used only for unit testing */
+ public void setUserObjectClass(String userObjectClass) {
+ prop.setProperty(LGSYNC_USER_OBJECT_CLASS, userObjectClass);
+ }
+
+ /* Used only for unit testing */
+ public void setGroupObjectClass(String groupObjectClass) {
+ prop.setProperty(LGSYNC_GROUP_OBJECT_CLASS, groupObjectClass);
+ }
}