Commit 3b1a7d09 by nixonrodrigues Committed by Madhan Neethiraj

ATLAS-1377: fix for Escaping comma in for LDAP properties

parent 05bdbc62
......@@ -114,12 +114,12 @@ atlas.authentication.method.file.filename=${sys:atlas.home}/conf/users-credentia
######## LDAP properties #########
#atlas.authentication.method.ldap.url=ldap://<ldap server url>:389
#atlas.authentication.method.ldap.userDNpattern=uid={0}\,ou=People\,dc=example\,dc=com
#atlas.authentication.method.ldap.groupSearchBase=dc=example\,dc=com
#atlas.authentication.method.ldap.groupSearchFilter=(member=uid={0}\,ou=Users\,dc=example\,dc=com)
#atlas.authentication.method.ldap.userDNpattern=uid={0},ou=People,dc=example,dc=com
#atlas.authentication.method.ldap.groupSearchBase=dc=example,dc=com
#atlas.authentication.method.ldap.groupSearchFilter=(member=uid={0},ou=Users,dc=example,dc=com)
#atlas.authentication.method.ldap.groupRoleAttribute=cn
#atlas.authentication.method.ldap.base.dn=dc=example\,dc=com
#atlas.authentication.method.ldap.bind.dn=cn=Manager\,dc=example\,dc=com
#atlas.authentication.method.ldap.base.dn=dc=example,dc=com
#atlas.authentication.method.ldap.bind.dn=cn=Manager,dc=example,dc=com
#atlas.authentication.method.ldap.bind.password=<password>
#atlas.authentication.method.ldap.referral=ignore
#atlas.authentication.method.ldap.user.searchfilter=(uid={0})
......@@ -130,7 +130,7 @@ atlas.authentication.method.file.filename=${sys:atlas.home}/conf/users-credentia
#atlas.authentication.method.ldap.ad.domain=example.com
#atlas.authentication.method.ldap.ad.url=ldap://<AD server url>:389
#atlas.authentication.method.ldap.ad.base.dn=(sAMAccountName={0})
#atlas.authentication.method.ldap.ad.bind.dn=CN=team\,CN=Users\,DC=example\,DC=com
#atlas.authentication.method.ldap.ad.bind.dn=CN=team,CN=Users,DC=example,DC=com
#atlas.authentication.method.ldap.ad.bind.password=<password>
#atlas.authentication.method.ldap.ad.referral=ignore
#atlas.authentication.method.ldap.ad.user.searchfilter=(sAMAccountName={0})
......
......@@ -19,12 +19,14 @@
package org.apache.atlas.web.security;
import java.util.List;
import java.util.Properties;
import javax.annotation.PostConstruct;
import org.apache.atlas.ApplicationProperties;
import org.apache.atlas.web.model.User;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.ConfigurationConverter;
import org.apache.log4j.Logger;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
......@@ -105,16 +107,32 @@ public class AtlasADAuthenticationProvider extends
try {
Configuration configuration = ApplicationProperties.get();
this.adDomain = configuration.getString("atlas.authentication.method.ldap.ad.domain");
this.adURL = configuration.getString("atlas.authentication.method.ldap.ad.url");
this.adBindDN = configuration.getString("atlas.authentication.method.ldap.ad.bind.dn");
this.adBindPassword = configuration.getString("atlas.authentication.method.ldap.ad.bind.password");
this.adUserSearchFilter = configuration.getString("atlas.authentication.method.ldap.ad.user.searchfilter");
this.adBase = configuration.getString("atlas.authentication.method.ldap.ad.base.dn");
this.adReferral = configuration.getString("atlas.authentication.method.ldap.ad.referral");
this.adDefaultRole = configuration.getString("atlas.authentication.method.ldap.ad.default.role");
Properties properties = ConfigurationConverter.getProperties(configuration.subset("atlas.authentication.method.ldap.ad"));
this.adDomain = properties.getProperty("domain");
this.adURL = properties.getProperty("url");
this.adBindDN = properties.getProperty("bind.dn");
this.adBindPassword = properties.getProperty("bind.password");
this.adUserSearchFilter = properties.getProperty("user.searchfilter");
this.adBase = properties.getProperty("base.dn");
this.adReferral = properties.getProperty("referral");
this.adDefaultRole = properties.getProperty("default.role");
this.groupsFromUGI = configuration.getBoolean("atlas.authentication.method.ldap.ugi-groups", true);
if(LOG.isDebugEnabled()) {
LOG.debug("AtlasADAuthenticationProvider{" +
"adURL='" + adURL + '\'' +
", adDomain='" + adDomain + '\'' +
", adBindDN='" + adBindDN + '\'' +
", adUserSearchFilter='" + adUserSearchFilter + '\'' +
", adBase='" + adBase + '\'' +
", adReferral='" + adReferral + '\'' +
", adDefaultRole='" + adDefaultRole + '\'' +
", groupsFromUGI=" + groupsFromUGI +
'}');
}
} catch (Exception e) {
LOG.error("Exception while setADProperties", e);
}
......
......@@ -19,10 +19,12 @@
package org.apache.atlas.web.security;
import java.util.List;
import java.util.Properties;
import javax.annotation.PostConstruct;
import org.apache.atlas.ApplicationProperties;
import org.apache.atlas.web.model.User;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.ConfigurationConverter;
import org.apache.log4j.Logger;
import org.springframework.ldap.core.support.LdapContextSource;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
......@@ -127,26 +129,36 @@ public class AtlasLdapAuthenticationProvider extends
private void setLdapProperties() {
try {
Configuration configuration = ApplicationProperties.get();
ldapURL = configuration.getString("atlas.authentication.method.ldap.url");
ldapUserDNPattern = configuration.getString(
"atlas.authentication.method.ldap.userDNpattern");
ldapGroupSearchBase = configuration.getString(
"atlas.authentication.method.ldap.groupSearchBase");
ldapGroupSearchFilter = configuration.getString(
"atlas.authentication.method.ldap.groupSearchFilter");
ldapGroupRoleAttribute = configuration.getString(
"atlas.authentication.method.ldap.groupRoleAttribute");
ldapBindDN = configuration.getString("atlas.authentication.method.ldap.bind.dn");
ldapBindPassword = configuration.getString(
"atlas.authentication.method.ldap.bind.password");
ldapDefaultRole = configuration.getString("atlas.authentication.method.ldap.default.role");
ldapUserSearchFilter = configuration.getString(
"atlas.authentication.method.ldap.user.searchfilter");
ldapReferral = configuration.getString("atlas.authentication.method.ldap.ad.referral");
ldapBase = configuration.getString("atlas.authentication.method.ldap.base.dn");
Properties properties = ConfigurationConverter.getProperties(configuration.subset("atlas.authentication.method.ldap"));
ldapURL = properties.getProperty("url");
ldapUserDNPattern = properties.getProperty("userDNpattern");
ldapGroupSearchBase = properties.getProperty("groupSearchBase");
ldapGroupSearchFilter = properties.getProperty("groupSearchFilter");
ldapGroupRoleAttribute = properties.getProperty("groupRoleAttribute");
ldapBindDN = properties.getProperty("bind.dn");
ldapBindPassword = properties.getProperty("bind.password");
ldapDefaultRole = properties.getProperty("default.role");
ldapUserSearchFilter = properties.getProperty("user.searchfilter");
ldapReferral = properties.getProperty("referral");
ldapBase = properties.getProperty("base.dn");
groupsFromUGI = configuration.getBoolean("atlas.authentication.method.ldap.ugi-groups", true);
if(LOG.isDebugEnabled()) {
LOG.debug("AtlasLdapAuthenticationProvider{" +
"ldapURL='" + ldapURL + '\'' +
", ldapUserDNPattern='" + ldapUserDNPattern + '\'' +
", ldapGroupSearchBase='" + ldapGroupSearchBase + '\'' +
", ldapGroupSearchFilter='" + ldapGroupSearchFilter + '\'' +
", ldapGroupRoleAttribute='" + ldapGroupRoleAttribute + '\'' +
", ldapBindDN='" + ldapBindDN + '\'' +
", ldapDefaultRole='" + ldapDefaultRole + '\'' +
", ldapUserSearchFilter='" + ldapUserSearchFilter + '\'' +
", ldapReferral='" + ldapReferral + '\'' +
", ldapBase='" + ldapBase + '\'' +
", groupsFromUGI=" + groupsFromUGI +
'}');
}
} catch (Exception e) {
LOG.error("Exception while setLdapProperties", e);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment