AMBARI-21307 Extracted config keys into an enum. Organized code (created domain package, moved classes)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/02bb25c8 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/02bb25c8 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/02bb25c8 Branch: refs/heads/feature-branch-AMBARI-21307 Commit: 02bb25c8103e70bd5dd8da2629cc8ed7988266c4 Parents: 6dfa765 Author: lpuskas <lpus...@apache.org> Authored: Thu Sep 14 16:33:41 2017 +0200 Committer: lpuskas <lpus...@apache.org> Committed: Thu Oct 26 11:28:50 2017 +0200 ---------------------------------------------------------------------- .../services/ldap/LdapConfigurationService.java | 4 +- .../server/ldap/AmbariLdapConfiguration.java | 232 ------------------- .../server/ldap/LdapConfigurationFactory.java | 34 --- .../apache/ambari/server/ldap/LdapModule.java | 2 + .../ldap/domain/AmbariLdapConfiguration.java | 180 ++++++++++++++ .../ldap/domain/LdapConfigurationFactory.java | 34 +++ .../ldap/service/AmbariLdapConfigKeys.java | 72 ++++++ .../AmbariLdapConfigurationProvider.java | 4 +- .../server/ldap/service/AmbariLdapFacade.java | 2 +- .../service/LdapAttributeDetectionService.java | 2 +- .../ldap/service/LdapConfigurationService.java | 2 +- .../ldap/service/LdapConnectionService.java | 2 +- .../ambari/server/ldap/service/LdapFacade.java | 2 +- .../DefaultLdapAttributeDetectionService.java | 15 +- .../ads/DefaultLdapConfigurationService.java | 2 +- .../ads/DefaultLdapConnectionService.java | 16 +- ...efaultLdapAttributeDetectionServiceTest.java | 21 +- .../DefaultLdapConfigurationServiceTest.java | 31 +-- 18 files changed, 334 insertions(+), 323 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/02bb25c8/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java index ae47a87..ff95066 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java @@ -46,8 +46,8 @@ import org.apache.ambari.server.api.services.ResultImpl; import org.apache.ambari.server.api.services.ResultStatus; import org.apache.ambari.server.controller.internal.ResourceImpl; import org.apache.ambari.server.controller.spi.Resource; -import org.apache.ambari.server.ldap.AmbariLdapConfiguration; -import org.apache.ambari.server.ldap.LdapConfigurationFactory; +import org.apache.ambari.server.ldap.domain.AmbariLdapConfiguration; +import org.apache.ambari.server.ldap.domain.LdapConfigurationFactory; import org.apache.ambari.server.ldap.service.LdapFacade; import org.apache.ambari.server.security.authorization.AuthorizationException; import org.apache.ambari.server.security.authorization.AuthorizationHelper; http://git-wip-us.apache.org/repos/asf/ambari/blob/02bb25c8/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java b/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java deleted file mode 100644 index 5bdda7a..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Licensed 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.ambari.server.ldap; - -import java.util.Map; - -import javax.inject.Inject; -import javax.inject.Singleton; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.google.inject.assistedinject.Assisted; - -/** - * This class is an immutable representation of all the LDAP related configurationMap entries. - */ -@Singleton -public class AmbariLdapConfiguration { - - private static final Logger LOGGER = LoggerFactory.getLogger(AmbariLdapConfiguration.class); - - /** - * Constants representing supported LDAP related property names - */ - public enum AmbariLdapConfig { - - LDAP_ENABLED("ambari.ldap.authentication.enabled"), - SERVER_HOST("ambari.ldap.connectivity.server.host"), - SERVER_PORT("ambari.ldap.connectivity.server.port"), - USE_SSL("ambari.ldap.connectivity.use_ssl"), - - TRUST_STORE("ambari.ldap.connectivity.trust_store"), - TRUST_STORE_TYPE("ambari.ldap.connectivity.trust_store.type"), - TRUST_STORE_PATH("ambari.ldap.connectivity.trust_store.path"), - TRUST_STORE_PASSWORD("ambari.ldap.connectivity.trust_store.password"), - ANONYMOUS_BIND("ambari.ldap.connectivity.anonymous_bind"), - - BIND_DN("ambari.ldap.connectivity.bind_dn"), - BIND_PASSWORD("ambari.ldap.connectivity.bind_password"), - - ATTR_DETECTION("ambari.ldap.attributes.detection"), // manual | auto - - DN_ATTRIBUTE("ambari.ldap.attributes.dn_attr"), - - USER_OBJECT_CLASS("ambari.ldap.attributes.user.object_class"), - USER_NAME_ATTRIBUTE("ambari.ldap.attributes.user.name_attr"), - USER_GROUP_MEMBER_ATTRIBUTE("ambari.ldap.attributes.user.group_member_attr"), - USER_SEARCH_BASE("ambari.ldap.attributes.user.search_base"), - - GROUP_OBJECT_CLASS("ambari.ldap.attributes.group.object_class"), - GROUP_NAME_ATTRIBUTE("ambari.ldap.attributes.group.name_attr"), - GROUP_MEMBER_ATTRIBUTE("ambari.ldap.attributes.group.member_attr"), - GROUP_SEARCH_BASE("ambari.ldap.attributes.group.search_base"), - - USER_SEARCH_FILTER("ambari.ldap.advanced.user_search_filter"), - USER_MEMBER_REPLACE_PATTERN("ambari.ldap.advanced.user_member_replace_pattern"), - USER_MEMBER_FILTER("ambari.ldap.advanced.user_member_filter"), - - GROUP_SEARCH_FILTER("ambari.ldap.advanced.group_search_filter"), - GROUP_MEMBER_REPLACE_PATTERN("ambari.ldap.advanced.group_member_replace_pattern"), - GROUP_MEMBER_FILTER("ambari.ldap.advanced.group_member_filter"), - - FORCE_LOWERCASE_USERNAMES("ambari.ldap.advanced.force_lowercase_usernames"), - REFERRAL_HANDLING("ambari.ldap.advanced.referrals"), // folow - PAGINATION_ENABLED("ambari.ldap.advanced.pagination_enabled"); // true | false - - private String propertyName; - - AmbariLdapConfig(String propName) { - this.propertyName = propName; - } - - public String key() { - return this.propertyName; - } - } - - private final Map<String, Object> configurationMap; - - private Object configValue(AmbariLdapConfig ambariLdapConfig) { - Object value = null; - if (configurationMap.containsKey(ambariLdapConfig.key())) { - value = configurationMap.get(ambariLdapConfig.key()); - } else { - LOGGER.warn("Ldap configuration property [{}] hasn't been set", ambariLdapConfig.key()); - } - return value; - } - - public void setValueFor(AmbariLdapConfig ambariLdapConfig, Object value) { - configurationMap.put(ambariLdapConfig.key(), value); - } - - @Inject - public AmbariLdapConfiguration(@Assisted Map<String, Object> configuration) { - this.configurationMap = configuration; - } - - public boolean ldapEnabled() { - return Boolean.valueOf((String) configValue(AmbariLdapConfig.LDAP_ENABLED)); - } - - public String serverHost() { - return (String) configValue(AmbariLdapConfig.SERVER_HOST); - } - - public int serverPort() { - return Integer.valueOf((String) configValue(AmbariLdapConfig.SERVER_PORT)); - } - - public boolean useSSL() { - return Boolean.valueOf((String) configValue(AmbariLdapConfig.USE_SSL)); - } - - public String trustStore() { - return (String) configValue(AmbariLdapConfig.TRUST_STORE); - } - - public String trustStoreType() { - return (String) configValue(AmbariLdapConfig.TRUST_STORE_TYPE); - } - - public String trustStorePath() { - return (String) configValue(AmbariLdapConfig.TRUST_STORE_PATH); - } - - public String trustStorePassword() { - return (String) configValue(AmbariLdapConfig.TRUST_STORE_PASSWORD); - } - - public boolean anonymousBind() { - return Boolean.valueOf((String) configValue(AmbariLdapConfig.ANONYMOUS_BIND)); - } - - public String bindDn() { - return (String) configValue(AmbariLdapConfig.BIND_DN); - } - - public String bindPassword() { - return (String) configValue(AmbariLdapConfig.BIND_PASSWORD); - } - - public String attributeDetection() { - return (String) configValue(AmbariLdapConfig.ATTR_DETECTION); - } - - public String dnAttribute() { - return (String) configValue(AmbariLdapConfig.DN_ATTRIBUTE); - } - - public String userObjectClass() { - return (String) configValue(AmbariLdapConfig.USER_OBJECT_CLASS); - } - - public String userNameAttribute() { - return (String) configValue(AmbariLdapConfig.USER_NAME_ATTRIBUTE); - } - - public String userSearchBase() { - return (String) configValue(AmbariLdapConfig.USER_SEARCH_BASE); - } - - public String groupObjectClass() { - return (String) configValue(AmbariLdapConfig.GROUP_OBJECT_CLASS); - } - - public String groupNameAttribute() { - return (String) configValue(AmbariLdapConfig.GROUP_NAME_ATTRIBUTE); - } - - public String groupMemberAttribute() { - return (String) configValue(AmbariLdapConfig.GROUP_MEMBER_ATTRIBUTE); - } - - public String groupSearchBase() { - return (String) configValue(AmbariLdapConfig.GROUP_SEARCH_BASE); - } - - public String userSearchFilter() { - return (String) configValue(AmbariLdapConfig.USER_SEARCH_FILTER); - } - - public String userMemberReplacePattern() { - return (String) configValue(AmbariLdapConfig.USER_MEMBER_REPLACE_PATTERN); - } - - public String userMemberFilter() { - return (String) configValue(AmbariLdapConfig.USER_MEMBER_FILTER); - } - - public String groupSearchFilter() { - return (String) configValue(AmbariLdapConfig.GROUP_SEARCH_FILTER); - } - - public String groupMemberReplacePattern() { - return (String) configValue(AmbariLdapConfig.GROUP_MEMBER_REPLACE_PATTERN); - } - - public String groupMemberFilter() { - return (String) configValue(AmbariLdapConfig.GROUP_MEMBER_FILTER); - } - - public boolean forceLowerCaseUserNames() { - return Boolean.valueOf((String) configValue(AmbariLdapConfig.FORCE_LOWERCASE_USERNAMES)); - } - - public boolean paginationEnabled() { - return Boolean.valueOf((String) configValue(AmbariLdapConfig.PAGINATION_ENABLED)); - } - - public String referralHandling() { - return (String) configValue(AmbariLdapConfig.REFERRAL_HANDLING); - } - - - @Override - public String toString() { - return configurationMap.toString(); - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/02bb25c8/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapConfigurationFactory.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapConfigurationFactory.java b/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapConfigurationFactory.java deleted file mode 100644 index 67ac092..0000000 --- a/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapConfigurationFactory.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed 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.ambari.server.ldap; - -import java.util.Map; - -/** - * Factory interface for AmbariLdapConfiguration instances. - * It's registered as a factory in the GUICE context ( so no implementations required) - * - * To be extended with other factory methods upon needs. - */ -public interface LdapConfigurationFactory { - - /** - * Creates an AmbariLdapConfiguration instance with the provided map of configuration settings. - * - * @param configuration a map where keys are the configuration properties and values are the configuration values - * @return an AmbariLdapConfiguration instance - */ - AmbariLdapConfiguration createLdapConfiguration(Map<String, Object> configuration); -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/02bb25c8/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapModule.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapModule.java b/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapModule.java index 0be69d4..83a73d1 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapModule.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapModule.java @@ -15,6 +15,8 @@ package org.apache.ambari.server.ldap; +import org.apache.ambari.server.ldap.domain.AmbariLdapConfiguration; +import org.apache.ambari.server.ldap.domain.LdapConfigurationFactory; import org.apache.ambari.server.ldap.service.AmbariLdapConfigurationProvider; import org.apache.ambari.server.ldap.service.AmbariLdapFacade; import org.apache.ambari.server.ldap.service.LdapAttributeDetectionService; http://git-wip-us.apache.org/repos/asf/ambari/blob/02bb25c8/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfiguration.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfiguration.java b/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfiguration.java new file mode 100644 index 0000000..072393a --- /dev/null +++ b/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfiguration.java @@ -0,0 +1,180 @@ +/* + * Licensed 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.ambari.server.ldap.domain; + +import java.util.Map; + +import javax.inject.Inject; +import javax.inject.Singleton; + +import org.apache.ambari.server.ldap.service.AmbariLdapConfigKeys; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.inject.assistedinject.Assisted; + +/** + * This class is an immutable representation of all the LDAP related configurationMap entries. + */ +@Singleton +public class AmbariLdapConfiguration { + + private static final Logger LOGGER = LoggerFactory.getLogger(AmbariLdapConfiguration.class); + + private final Map<String, Object> configurationMap; + + private Object configValue(AmbariLdapConfigKeys ambariLdapConfigKeys) { + Object value = null; + if (configurationMap.containsKey(ambariLdapConfigKeys.key())) { + value = configurationMap.get(ambariLdapConfigKeys.key()); + } else { + LOGGER.warn("Ldap configuration property [{}] hasn't been set", ambariLdapConfigKeys.key()); + } + return value; + } + + public void setValueFor(AmbariLdapConfigKeys ambariLdapConfigKeys, Object value) { + configurationMap.put(ambariLdapConfigKeys.key(), value); + } + + // intentionally package private, instances to be created through the factory + @Inject + AmbariLdapConfiguration(@Assisted Map<String, Object> configuration) { + this.configurationMap = configuration; + } + + public boolean ldapEnabled() { + return Boolean.valueOf((String) configValue(AmbariLdapConfigKeys.LDAP_ENABLED)); + } + + public String serverHost() { + return (String) configValue(AmbariLdapConfigKeys.SERVER_HOST); + } + + public int serverPort() { + return Integer.valueOf((String) configValue(AmbariLdapConfigKeys.SERVER_PORT)); + } + + public boolean useSSL() { + return Boolean.valueOf((String) configValue(AmbariLdapConfigKeys.USE_SSL)); + } + + public String trustStore() { + return (String) configValue(AmbariLdapConfigKeys.TRUST_STORE); + } + + public String trustStoreType() { + return (String) configValue(AmbariLdapConfigKeys.TRUST_STORE_TYPE); + } + + public String trustStorePath() { + return (String) configValue(AmbariLdapConfigKeys.TRUST_STORE_PATH); + } + + public String trustStorePassword() { + return (String) configValue(AmbariLdapConfigKeys.TRUST_STORE_PASSWORD); + } + + public boolean anonymousBind() { + return Boolean.valueOf((String) configValue(AmbariLdapConfigKeys.ANONYMOUS_BIND)); + } + + public String bindDn() { + return (String) configValue(AmbariLdapConfigKeys.BIND_DN); + } + + public String bindPassword() { + return (String) configValue(AmbariLdapConfigKeys.BIND_PASSWORD); + } + + public String attributeDetection() { + return (String) configValue(AmbariLdapConfigKeys.ATTR_DETECTION); + } + + public String dnAttribute() { + return (String) configValue(AmbariLdapConfigKeys.DN_ATTRIBUTE); + } + + public String userObjectClass() { + return (String) configValue(AmbariLdapConfigKeys.USER_OBJECT_CLASS); + } + + public String userNameAttribute() { + return (String) configValue(AmbariLdapConfigKeys.USER_NAME_ATTRIBUTE); + } + + public String userSearchBase() { + return (String) configValue(AmbariLdapConfigKeys.USER_SEARCH_BASE); + } + + public String groupObjectClass() { + return (String) configValue(AmbariLdapConfigKeys.GROUP_OBJECT_CLASS); + } + + public String groupNameAttribute() { + return (String) configValue(AmbariLdapConfigKeys.GROUP_NAME_ATTRIBUTE); + } + + public String groupMemberAttribute() { + return (String) configValue(AmbariLdapConfigKeys.GROUP_MEMBER_ATTRIBUTE); + } + + public String groupSearchBase() { + return (String) configValue(AmbariLdapConfigKeys.GROUP_SEARCH_BASE); + } + + public String userSearchFilter() { + return (String) configValue(AmbariLdapConfigKeys.USER_SEARCH_FILTER); + } + + public String userMemberReplacePattern() { + return (String) configValue(AmbariLdapConfigKeys.USER_MEMBER_REPLACE_PATTERN); + } + + public String userMemberFilter() { + return (String) configValue(AmbariLdapConfigKeys.USER_MEMBER_FILTER); + } + + public String groupSearchFilter() { + return (String) configValue(AmbariLdapConfigKeys.GROUP_SEARCH_FILTER); + } + + public String groupMemberReplacePattern() { + return (String) configValue(AmbariLdapConfigKeys.GROUP_MEMBER_REPLACE_PATTERN); + } + + public String groupMemberFilter() { + return (String) configValue(AmbariLdapConfigKeys.GROUP_MEMBER_FILTER); + } + + public boolean forceLowerCaseUserNames() { + return Boolean.valueOf((String) configValue(AmbariLdapConfigKeys.FORCE_LOWERCASE_USERNAMES)); + } + + public boolean paginationEnabled() { + return Boolean.valueOf((String) configValue(AmbariLdapConfigKeys.PAGINATION_ENABLED)); + } + + public String referralHandling() { + return (String) configValue(AmbariLdapConfigKeys.REFERRAL_HANDLING); + } + + + @Override + public String toString() { + return configurationMap.toString(); + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/02bb25c8/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/LdapConfigurationFactory.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/LdapConfigurationFactory.java b/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/LdapConfigurationFactory.java new file mode 100644 index 0000000..f9a74da --- /dev/null +++ b/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/LdapConfigurationFactory.java @@ -0,0 +1,34 @@ +/* + * Licensed 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.ambari.server.ldap.domain; + +import java.util.Map; + +/** + * Factory interface for AmbariLdapConfiguration instances. + * It's registered as a factory in the GUICE context ( so no implementations required) + * + * To be extended with other factory methods upon needs. + */ +public interface LdapConfigurationFactory { + + /** + * Creates an AmbariLdapConfiguration instance with the provided map of configuration settings. + * + * @param configuration a map where keys are the configuration properties and values are the configuration values + * @return an AmbariLdapConfiguration instance + */ + AmbariLdapConfiguration createLdapConfiguration(Map<String, Object> configuration); +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/02bb25c8/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapConfigKeys.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapConfigKeys.java b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapConfigKeys.java new file mode 100644 index 0000000..9cf4e56 --- /dev/null +++ b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapConfigKeys.java @@ -0,0 +1,72 @@ +/* + * Licensed 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.ambari.server.ldap.service; + +/** + * Constants representing supported LDAP related property names + * // todo extend this with validation information, description, defaults maybe + */ +public enum AmbariLdapConfigKeys { + + LDAP_ENABLED("ambari.ldap.authentication.enabled"), + SERVER_HOST("ambari.ldap.connectivity.server.host"), + SERVER_PORT("ambari.ldap.connectivity.server.port"), + USE_SSL("ambari.ldap.connectivity.use_ssl"), + + TRUST_STORE("ambari.ldap.connectivity.trust_store"), + TRUST_STORE_TYPE("ambari.ldap.connectivity.trust_store.type"), + TRUST_STORE_PATH("ambari.ldap.connectivity.trust_store.path"), + TRUST_STORE_PASSWORD("ambari.ldap.connectivity.trust_store.password"), + ANONYMOUS_BIND("ambari.ldap.connectivity.anonymous_bind"), + + BIND_DN("ambari.ldap.connectivity.bind_dn"), + BIND_PASSWORD("ambari.ldap.connectivity.bind_password"), + + ATTR_DETECTION("ambari.ldap.attributes.detection"), // manual | auto + + DN_ATTRIBUTE("ambari.ldap.attributes.dn_attr"), + + USER_OBJECT_CLASS("ambari.ldap.attributes.user.object_class"), + USER_NAME_ATTRIBUTE("ambari.ldap.attributes.user.name_attr"), + USER_GROUP_MEMBER_ATTRIBUTE("ambari.ldap.attributes.user.group_member_attr"), + USER_SEARCH_BASE("ambari.ldap.attributes.user.search_base"), + + GROUP_OBJECT_CLASS("ambari.ldap.attributes.group.object_class"), + GROUP_NAME_ATTRIBUTE("ambari.ldap.attributes.group.name_attr"), + GROUP_MEMBER_ATTRIBUTE("ambari.ldap.attributes.group.member_attr"), + GROUP_SEARCH_BASE("ambari.ldap.attributes.group.search_base"), + + USER_SEARCH_FILTER("ambari.ldap.advanced.user_search_filter"), + USER_MEMBER_REPLACE_PATTERN("ambari.ldap.advanced.user_member_replace_pattern"), + USER_MEMBER_FILTER("ambari.ldap.advanced.user_member_filter"), + + GROUP_SEARCH_FILTER("ambari.ldap.advanced.group_search_filter"), + GROUP_MEMBER_REPLACE_PATTERN("ambari.ldap.advanced.group_member_replace_pattern"), + GROUP_MEMBER_FILTER("ambari.ldap.advanced.group_member_filter"), + + FORCE_LOWERCASE_USERNAMES("ambari.ldap.advanced.force_lowercase_usernames"), + REFERRAL_HANDLING("ambari.ldap.advanced.referrals"), // folow + PAGINATION_ENABLED("ambari.ldap.advanced.pagination_enabled"); // true | false + + private String propertyName; + + AmbariLdapConfigKeys(String propName) { + this.propertyName = propName; + } + + public String key() { + return this.propertyName; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/02bb25c8/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapConfigurationProvider.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapConfigurationProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapConfigurationProvider.java index 80ed828..af9f2e7 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapConfigurationProvider.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapConfigurationProvider.java @@ -23,8 +23,8 @@ import javax.inject.Singleton; import org.apache.ambari.server.events.AmbariLdapConfigChangedEvent; import org.apache.ambari.server.events.publishers.AmbariEventPublisher; -import org.apache.ambari.server.ldap.AmbariLdapConfiguration; -import org.apache.ambari.server.ldap.LdapConfigurationFactory; +import org.apache.ambari.server.ldap.domain.AmbariLdapConfiguration; +import org.apache.ambari.server.ldap.domain.LdapConfigurationFactory; import org.apache.ambari.server.orm.dao.AmbariConfigurationDAO; import org.apache.ambari.server.orm.entities.AmbariConfigurationEntity; import org.apache.ambari.server.security.authorization.AmbariLdapAuthenticationProvider; http://git-wip-us.apache.org/repos/asf/ambari/blob/02bb25c8/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java index 689a072..7a6ad5a 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java @@ -21,7 +21,7 @@ import java.util.Set; import javax.inject.Inject; import javax.inject.Singleton; -import org.apache.ambari.server.ldap.AmbariLdapConfiguration; +import org.apache.ambari.server.ldap.domain.AmbariLdapConfiguration; import org.apache.directory.ldap.client.api.LdapConnection; import org.slf4j.Logger; import org.slf4j.LoggerFactory; http://git-wip-us.apache.org/repos/asf/ambari/blob/02bb25c8/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/LdapAttributeDetectionService.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/LdapAttributeDetectionService.java b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/LdapAttributeDetectionService.java index 4cfa81e..90e3b8b 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/LdapAttributeDetectionService.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/LdapAttributeDetectionService.java @@ -14,7 +14,7 @@ package org.apache.ambari.server.ldap.service; -import org.apache.ambari.server.ldap.AmbariLdapConfiguration; +import org.apache.ambari.server.ldap.domain.AmbariLdapConfiguration; /** * Contract defining operations to detect user and group attributes. http://git-wip-us.apache.org/repos/asf/ambari/blob/02bb25c8/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/LdapConfigurationService.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/LdapConfigurationService.java b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/LdapConfigurationService.java index 06566cc..5c376c9 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/LdapConfigurationService.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/LdapConfigurationService.java @@ -17,7 +17,7 @@ package org.apache.ambari.server.ldap.service; import java.util.Set; import org.apache.ambari.server.AmbariException; -import org.apache.ambari.server.ldap.AmbariLdapConfiguration; +import org.apache.ambari.server.ldap.domain.AmbariLdapConfiguration; import org.apache.directory.ldap.client.api.LdapConnection; /** http://git-wip-us.apache.org/repos/asf/ambari/blob/02bb25c8/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/LdapConnectionService.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/LdapConnectionService.java b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/LdapConnectionService.java index b4daeaa..6f1e1ff 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/LdapConnectionService.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/LdapConnectionService.java @@ -14,7 +14,7 @@ package org.apache.ambari.server.ldap.service; -import org.apache.ambari.server.ldap.AmbariLdapConfiguration; +import org.apache.ambari.server.ldap.domain.AmbariLdapConfiguration; import org.apache.directory.ldap.client.api.LdapConnection; /** http://git-wip-us.apache.org/repos/asf/ambari/blob/02bb25c8/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/LdapFacade.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/LdapFacade.java b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/LdapFacade.java index 3ae913c..ef84d1b 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/LdapFacade.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/LdapFacade.java @@ -17,7 +17,7 @@ package org.apache.ambari.server.ldap.service; import java.util.Map; import java.util.Set; -import org.apache.ambari.server.ldap.AmbariLdapConfiguration; +import org.apache.ambari.server.ldap.domain.AmbariLdapConfiguration; /** * The contract defining all the operations required by the application when communicating with an arbitrary LDAP server. http://git-wip-us.apache.org/repos/asf/ambari/blob/02bb25c8/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapAttributeDetectionService.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapAttributeDetectionService.java b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapAttributeDetectionService.java index b499b65..ed24015 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapAttributeDetectionService.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapAttributeDetectionService.java @@ -17,7 +17,8 @@ package org.apache.ambari.server.ldap.service.ads; import javax.inject.Inject; import javax.inject.Singleton; -import org.apache.ambari.server.ldap.AmbariLdapConfiguration; +import org.apache.ambari.server.ldap.domain.AmbariLdapConfiguration; +import org.apache.ambari.server.ldap.service.AmbariLdapConfigKeys; import org.apache.ambari.server.ldap.service.AmbariLdapException; import org.apache.ambari.server.ldap.service.LdapAttributeDetectionService; import org.apache.ambari.server.ldap.service.ads.detectors.GroupMemberAttrDetector; @@ -112,9 +113,9 @@ public class DefaultLdapAttributeDetectionService implements LdapAttributeDetect } } - ambariLdapConfiguration.setValueFor(AmbariLdapConfiguration.AmbariLdapConfig.USER_NAME_ATTRIBUTE, userNameAttrDetector.detect()); - ambariLdapConfiguration.setValueFor(AmbariLdapConfiguration.AmbariLdapConfig.USER_OBJECT_CLASS, userObjectClassDetector.detect()); - ambariLdapConfiguration.setValueFor(AmbariLdapConfiguration.AmbariLdapConfig.USER_GROUP_MEMBER_ATTRIBUTE, userGroupMemberAttrDetector.detect()); + ambariLdapConfiguration.setValueFor(AmbariLdapConfigKeys.USER_NAME_ATTRIBUTE, userNameAttrDetector.detect()); + ambariLdapConfiguration.setValueFor(AmbariLdapConfigKeys.USER_OBJECT_CLASS, userObjectClassDetector.detect()); + ambariLdapConfiguration.setValueFor(AmbariLdapConfigKeys.USER_GROUP_MEMBER_ATTRIBUTE, userGroupMemberAttrDetector.detect()); LOGGER.info("Decorated ambari ldap config : [{}]", ambariLdapConfiguration); @@ -177,9 +178,9 @@ public class DefaultLdapAttributeDetectionService implements LdapAttributeDetect } } - ambariLdapConfiguration.setValueFor(AmbariLdapConfiguration.AmbariLdapConfig.GROUP_NAME_ATTRIBUTE, groupNameAttrDetector.detect()); - ambariLdapConfiguration.setValueFor(AmbariLdapConfiguration.AmbariLdapConfig.GROUP_OBJECT_CLASS, groupObjectClassDetector.detect()); - ambariLdapConfiguration.setValueFor(AmbariLdapConfiguration.AmbariLdapConfig.GROUP_MEMBER_ATTRIBUTE, groupMemberAttrDetector.detect()); + ambariLdapConfiguration.setValueFor(AmbariLdapConfigKeys.GROUP_NAME_ATTRIBUTE, groupNameAttrDetector.detect()); + ambariLdapConfiguration.setValueFor(AmbariLdapConfigKeys.GROUP_OBJECT_CLASS, groupObjectClassDetector.detect()); + ambariLdapConfiguration.setValueFor(AmbariLdapConfigKeys.GROUP_MEMBER_ATTRIBUTE, groupMemberAttrDetector.detect()); LOGGER.info("Decorated ambari ldap config : [{}]", ambariLdapConfiguration); http://git-wip-us.apache.org/repos/asf/ambari/blob/02bb25c8/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapConfigurationService.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapConfigurationService.java b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapConfigurationService.java index 0a309cd..7214fd3 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapConfigurationService.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapConfigurationService.java @@ -20,7 +20,7 @@ import java.util.Set; import javax.inject.Inject; import javax.inject.Singleton; -import org.apache.ambari.server.ldap.AmbariLdapConfiguration; +import org.apache.ambari.server.ldap.domain.AmbariLdapConfiguration; import org.apache.ambari.server.ldap.service.AmbariLdapException; import org.apache.ambari.server.ldap.service.LdapConfigurationService; import org.apache.directory.api.ldap.codec.decorators.SearchResultEntryDecorator; http://git-wip-us.apache.org/repos/asf/ambari/blob/02bb25c8/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapConnectionService.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapConnectionService.java b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapConnectionService.java index 457e23e..1e9c612 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapConnectionService.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapConnectionService.java @@ -12,25 +12,11 @@ * limitations under the License. */ -/* - * Licensed 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.ambari.server.ldap.service.ads; import javax.inject.Singleton; -import org.apache.ambari.server.ldap.AmbariLdapConfiguration; +import org.apache.ambari.server.ldap.domain.AmbariLdapConfiguration; import org.apache.ambari.server.ldap.service.LdapConnectionService; import org.apache.directory.ldap.client.api.LdapConnection; import org.apache.directory.ldap.client.api.LdapConnectionConfig; http://git-wip-us.apache.org/repos/asf/ambari/blob/02bb25c8/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapAttributeDetectionServiceTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapAttributeDetectionServiceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapAttributeDetectionServiceTest.java index 3d335bf..2920588 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapAttributeDetectionServiceTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapAttributeDetectionServiceTest.java @@ -17,7 +17,8 @@ package org.apache.ambari.server.ldap.service.ads; import java.util.Map; -import org.apache.ambari.server.ldap.AmbariLdapConfiguration; +import org.apache.ambari.server.ldap.domain.AmbariLdapConfiguration; +import org.apache.ambari.server.ldap.service.AmbariLdapConfigKeys; import org.apache.ambari.server.ldap.service.LdapConnectionService; import org.apache.directory.api.ldap.model.constants.SchemaConstants; import org.apache.directory.ldap.client.api.LdapConnection; @@ -51,7 +52,7 @@ public class DefaultLdapAttributeDetectionServiceTest { public void before() { Map<String, Object> initialProps = Maps.newHashMap(); - initialProps.put(AmbariLdapConfiguration.AmbariLdapConfig.BIND_DN.key(), ""); + initialProps.put(AmbariLdapConfigKeys.BIND_DN.key(), ""); testLdapConfiguration = new AmbariLdapConfiguration(initialProps); } @@ -92,15 +93,15 @@ public class DefaultLdapAttributeDetectionServiceTest { private Map<String, Object> getTestPropertiesMap() { Map<String, Object> ldapPropsMap = Maps.newHashMap(); - ldapPropsMap.put(AmbariLdapConfiguration.AmbariLdapConfig.ANONYMOUS_BIND.key(), "true"); - ldapPropsMap.put(AmbariLdapConfiguration.AmbariLdapConfig.SERVER_HOST.key(), "ldap.forumsys.com"); - ldapPropsMap.put(AmbariLdapConfiguration.AmbariLdapConfig.SERVER_PORT.key(), "389"); - ldapPropsMap.put(AmbariLdapConfiguration.AmbariLdapConfig.BIND_DN.key(), "cn=read-only-admin,dc=example,dc=com"); - ldapPropsMap.put(AmbariLdapConfiguration.AmbariLdapConfig.BIND_PASSWORD.key(), "password"); - ldapPropsMap.put(AmbariLdapConfiguration.AmbariLdapConfig.DN_ATTRIBUTE.key(), SchemaConstants.CN_AT); + ldapPropsMap.put(AmbariLdapConfigKeys.ANONYMOUS_BIND.key(), "true"); + ldapPropsMap.put(AmbariLdapConfigKeys.SERVER_HOST.key(), "ldap.forumsys.com"); + ldapPropsMap.put(AmbariLdapConfigKeys.SERVER_PORT.key(), "389"); + ldapPropsMap.put(AmbariLdapConfigKeys.BIND_DN.key(), "cn=read-only-admin,dc=example,dc=com"); + ldapPropsMap.put(AmbariLdapConfigKeys.BIND_PASSWORD.key(), "password"); + ldapPropsMap.put(AmbariLdapConfigKeys.DN_ATTRIBUTE.key(), SchemaConstants.CN_AT); - ldapPropsMap.put(AmbariLdapConfiguration.AmbariLdapConfig.USER_SEARCH_BASE.key(), "dc=example,dc=com"); - ldapPropsMap.put(AmbariLdapConfiguration.AmbariLdapConfig.GROUP_SEARCH_BASE.key(), "dc=example,dc=com"); + ldapPropsMap.put(AmbariLdapConfigKeys.USER_SEARCH_BASE.key(), "dc=example,dc=com"); + ldapPropsMap.put(AmbariLdapConfigKeys.GROUP_SEARCH_BASE.key(), "dc=example,dc=com"); return ldapPropsMap; http://git-wip-us.apache.org/repos/asf/ambari/blob/02bb25c8/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapConfigurationServiceTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapConfigurationServiceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapConfigurationServiceTest.java index 1ba6110..449d003 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapConfigurationServiceTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapConfigurationServiceTest.java @@ -18,7 +18,8 @@ import static org.junit.Assert.assertNotNull; import java.util.Map; -import org.apache.ambari.server.ldap.AmbariLdapConfiguration; +import org.apache.ambari.server.ldap.domain.AmbariLdapConfiguration; +import org.apache.ambari.server.ldap.service.AmbariLdapConfigKeys; import org.apache.ambari.server.ldap.service.LdapConfigurationService; import org.apache.ambari.server.ldap.service.LdapConnectionService; import org.apache.directory.api.ldap.model.constants.SchemaConstants; @@ -74,14 +75,14 @@ public class DefaultLdapConfigurationServiceTest { // GIVEN Map<String, Object> ldapPropsMap = Maps.newHashMap(); - ldapPropsMap.put(AmbariLdapConfiguration.AmbariLdapConfig.ANONYMOUS_BIND.key(), "true"); - ldapPropsMap.put(AmbariLdapConfiguration.AmbariLdapConfig.SERVER_HOST.key(), "ldap.forumsys.com"); - ldapPropsMap.put(AmbariLdapConfiguration.AmbariLdapConfig.SERVER_PORT.key(), "389"); - ldapPropsMap.put(AmbariLdapConfiguration.AmbariLdapConfig.BIND_DN.key(), "dc=example,dc=com"); + ldapPropsMap.put(AmbariLdapConfigKeys.ANONYMOUS_BIND.key(), "true"); + ldapPropsMap.put(AmbariLdapConfigKeys.SERVER_HOST.key(), "ldap.forumsys.com"); + ldapPropsMap.put(AmbariLdapConfigKeys.SERVER_PORT.key(), "389"); + ldapPropsMap.put(AmbariLdapConfigKeys.BIND_DN.key(), "dc=example,dc=com"); - ldapPropsMap.put(AmbariLdapConfiguration.AmbariLdapConfig.USER_OBJECT_CLASS.key(), SchemaConstants.PERSON_OC); - ldapPropsMap.put(AmbariLdapConfiguration.AmbariLdapConfig.USER_NAME_ATTRIBUTE.key(), SchemaConstants.UID_AT); - ldapPropsMap.put(AmbariLdapConfiguration.AmbariLdapConfig.USER_SEARCH_BASE.key(), "dc=example,dc=com"); + ldapPropsMap.put(AmbariLdapConfigKeys.USER_OBJECT_CLASS.key(), SchemaConstants.PERSON_OC); + ldapPropsMap.put(AmbariLdapConfigKeys.USER_NAME_ATTRIBUTE.key(), SchemaConstants.UID_AT); + ldapPropsMap.put(AmbariLdapConfigKeys.USER_SEARCH_BASE.key(), "dc=example,dc=com"); AmbariLdapConfiguration ambariLdapConfiguration = new AmbariLdapConfiguration(ldapPropsMap); @@ -96,14 +97,14 @@ public class DefaultLdapConfigurationServiceTest { // GIVEN Map<String, Object> ldapPropsMap = Maps.newHashMap(); - ldapPropsMap.put(AmbariLdapConfiguration.AmbariLdapConfig.ANONYMOUS_BIND.key(), "true"); - ldapPropsMap.put(AmbariLdapConfiguration.AmbariLdapConfig.SERVER_HOST.key(), "ldap.forumsys.com"); - ldapPropsMap.put(AmbariLdapConfiguration.AmbariLdapConfig.SERVER_PORT.key(), "389"); - ldapPropsMap.put(AmbariLdapConfiguration.AmbariLdapConfig.BIND_DN.key(), "dc=example,dc=com"); + ldapPropsMap.put(AmbariLdapConfigKeys.ANONYMOUS_BIND.key(), "true"); + ldapPropsMap.put(AmbariLdapConfigKeys.SERVER_HOST.key(), "ldap.forumsys.com"); + ldapPropsMap.put(AmbariLdapConfigKeys.SERVER_PORT.key(), "389"); + ldapPropsMap.put(AmbariLdapConfigKeys.BIND_DN.key(), "dc=example,dc=com"); - ldapPropsMap.put(AmbariLdapConfiguration.AmbariLdapConfig.USER_OBJECT_CLASS.key(), SchemaConstants.PERSON_OC); - ldapPropsMap.put(AmbariLdapConfiguration.AmbariLdapConfig.USER_NAME_ATTRIBUTE.key(), SchemaConstants.UID_AT); - ldapPropsMap.put(AmbariLdapConfiguration.AmbariLdapConfig.USER_SEARCH_BASE.key(), "dc=example,dc=com"); + ldapPropsMap.put(AmbariLdapConfigKeys.USER_OBJECT_CLASS.key(), SchemaConstants.PERSON_OC); + ldapPropsMap.put(AmbariLdapConfigKeys.USER_NAME_ATTRIBUTE.key(), SchemaConstants.UID_AT); + ldapPropsMap.put(AmbariLdapConfigKeys.USER_SEARCH_BASE.key(), "dc=example,dc=com"); AmbariLdapConfiguration ambariLdapConfiguration = new AmbariLdapConfiguration(ldapPropsMap);