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 ...@@ -114,12 +114,12 @@ atlas.authentication.method.file.filename=${sys:atlas.home}/conf/users-credentia
######## LDAP properties ######### ######## LDAP properties #########
#atlas.authentication.method.ldap.url=ldap://<ldap server url>:389 #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.userDNpattern=uid={0},ou=People,dc=example,dc=com
#atlas.authentication.method.ldap.groupSearchBase=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.groupSearchFilter=(member=uid={0},ou=Users,dc=example,dc=com)
#atlas.authentication.method.ldap.groupRoleAttribute=cn #atlas.authentication.method.ldap.groupRoleAttribute=cn
#atlas.authentication.method.ldap.base.dn=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.dn=cn=Manager,dc=example,dc=com
#atlas.authentication.method.ldap.bind.password=<password> #atlas.authentication.method.ldap.bind.password=<password>
#atlas.authentication.method.ldap.referral=ignore #atlas.authentication.method.ldap.referral=ignore
#atlas.authentication.method.ldap.user.searchfilter=(uid={0}) #atlas.authentication.method.ldap.user.searchfilter=(uid={0})
...@@ -130,7 +130,7 @@ atlas.authentication.method.file.filename=${sys:atlas.home}/conf/users-credentia ...@@ -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.domain=example.com
#atlas.authentication.method.ldap.ad.url=ldap://<AD server url>:389 #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.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.bind.password=<password>
#atlas.authentication.method.ldap.ad.referral=ignore #atlas.authentication.method.ldap.ad.referral=ignore
#atlas.authentication.method.ldap.ad.user.searchfilter=(sAMAccountName={0}) #atlas.authentication.method.ldap.ad.user.searchfilter=(sAMAccountName={0})
......
...@@ -19,12 +19,14 @@ ...@@ -19,12 +19,14 @@
package org.apache.atlas.web.security; package org.apache.atlas.web.security;
import java.util.List; import java.util.List;
import java.util.Properties;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import org.apache.atlas.ApplicationProperties; import org.apache.atlas.ApplicationProperties;
import org.apache.atlas.web.model.User; import org.apache.atlas.web.model.User;
import org.apache.commons.configuration.Configuration; import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.ConfigurationConverter;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication; import org.springframework.security.core.Authentication;
...@@ -105,16 +107,32 @@ public class AtlasADAuthenticationProvider extends ...@@ -105,16 +107,32 @@ public class AtlasADAuthenticationProvider extends
try { try {
Configuration configuration = ApplicationProperties.get(); Configuration configuration = ApplicationProperties.get();
this.adDomain = configuration.getString("atlas.authentication.method.ldap.ad.domain"); Properties properties = ConfigurationConverter.getProperties(configuration.subset("atlas.authentication.method.ldap.ad"));
this.adURL = configuration.getString("atlas.authentication.method.ldap.ad.url"); this.adDomain = properties.getProperty("domain");
this.adBindDN = configuration.getString("atlas.authentication.method.ldap.ad.bind.dn"); this.adURL = properties.getProperty("url");
this.adBindPassword = configuration.getString("atlas.authentication.method.ldap.ad.bind.password"); this.adBindDN = properties.getProperty("bind.dn");
this.adUserSearchFilter = configuration.getString("atlas.authentication.method.ldap.ad.user.searchfilter"); this.adBindPassword = properties.getProperty("bind.password");
this.adBase = configuration.getString("atlas.authentication.method.ldap.ad.base.dn"); this.adUserSearchFilter = properties.getProperty("user.searchfilter");
this.adReferral = configuration.getString("atlas.authentication.method.ldap.ad.referral"); this.adBase = properties.getProperty("base.dn");
this.adDefaultRole = configuration.getString("atlas.authentication.method.ldap.ad.default.role"); this.adReferral = properties.getProperty("referral");
this.adDefaultRole = properties.getProperty("default.role");
this.groupsFromUGI = configuration.getBoolean("atlas.authentication.method.ldap.ugi-groups", true); 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) { } catch (Exception e) {
LOG.error("Exception while setADProperties", e); LOG.error("Exception while setADProperties", e);
} }
......
...@@ -19,10 +19,12 @@ ...@@ -19,10 +19,12 @@
package org.apache.atlas.web.security; package org.apache.atlas.web.security;
import java.util.List; import java.util.List;
import java.util.Properties;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import org.apache.atlas.ApplicationProperties; import org.apache.atlas.ApplicationProperties;
import org.apache.atlas.web.model.User; import org.apache.atlas.web.model.User;
import org.apache.commons.configuration.Configuration; import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.ConfigurationConverter;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.springframework.ldap.core.support.LdapContextSource; import org.springframework.ldap.core.support.LdapContextSource;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
...@@ -127,26 +129,36 @@ public class AtlasLdapAuthenticationProvider extends ...@@ -127,26 +129,36 @@ public class AtlasLdapAuthenticationProvider extends
private void setLdapProperties() { private void setLdapProperties() {
try { try {
Configuration configuration = ApplicationProperties.get(); Configuration configuration = ApplicationProperties.get();
Properties properties = ConfigurationConverter.getProperties(configuration.subset("atlas.authentication.method.ldap"));
ldapURL = configuration.getString("atlas.authentication.method.ldap.url"); ldapURL = properties.getProperty("url");
ldapUserDNPattern = configuration.getString( ldapUserDNPattern = properties.getProperty("userDNpattern");
"atlas.authentication.method.ldap.userDNpattern"); ldapGroupSearchBase = properties.getProperty("groupSearchBase");
ldapGroupSearchBase = configuration.getString( ldapGroupSearchFilter = properties.getProperty("groupSearchFilter");
"atlas.authentication.method.ldap.groupSearchBase"); ldapGroupRoleAttribute = properties.getProperty("groupRoleAttribute");
ldapGroupSearchFilter = configuration.getString( ldapBindDN = properties.getProperty("bind.dn");
"atlas.authentication.method.ldap.groupSearchFilter"); ldapBindPassword = properties.getProperty("bind.password");
ldapGroupRoleAttribute = configuration.getString( ldapDefaultRole = properties.getProperty("default.role");
"atlas.authentication.method.ldap.groupRoleAttribute"); ldapUserSearchFilter = properties.getProperty("user.searchfilter");
ldapBindDN = configuration.getString("atlas.authentication.method.ldap.bind.dn"); ldapReferral = properties.getProperty("referral");
ldapBindPassword = configuration.getString( ldapBase = properties.getProperty("base.dn");
"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");
groupsFromUGI = configuration.getBoolean("atlas.authentication.method.ldap.ugi-groups", true); 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) { } catch (Exception e) {
LOG.error("Exception while setLdapProperties", 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