You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2015/09/26 08:33:27 UTC
svn commit: r1705397 -
/manifoldcf/branches/CONNECTORS-1244/connectors/ldap/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/ldap/LDAPAuthority.java
Author: kwright
Date: Sat Sep 26 06:33:27 2015
New Revision: 1705397
URL: http://svn.apache.org/viewvc?rev=1705397&view=rev
Log:
Clean up parameters management
Modified:
manifoldcf/branches/CONNECTORS-1244/connectors/ldap/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/ldap/LDAPAuthority.java
Modified: manifoldcf/branches/CONNECTORS-1244/connectors/ldap/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/ldap/LDAPAuthority.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1244/connectors/ldap/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/ldap/LDAPAuthority.java?rev=1705397&r1=1705396&r2=1705397&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1244/connectors/ldap/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/ldap/LDAPAuthority.java (original)
+++ manifoldcf/branches/CONNECTORS-1244/connectors/ldap/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/ldap/LDAPAuthority.java Sat Sep 26 06:33:27 2015
@@ -49,32 +49,23 @@ public class LDAPAuthority extends org.a
private long sessionExpirationTime = -1L;
- private ConfigParams parameters;
+ //private ConfigParams parameters;
+ private String bindUser;
+ private String bindPass;
+ private String serverProtocol;
private String serverName;
-
private String serverPort;
-
private String serverBase;
-
private String userBase;
-
private String userSearch;
-
private String groupBase;
-
private String groupSearch;
-
private String groupNameAttr;
-
private boolean groupMemberDN;
-
private boolean addUserRecord;
-
private List<String> forcedTokens;
-
private String userNameAttr;
-
private String sslKeystoreData;
private IKeystoreManager sslKeystore;
@@ -112,9 +103,14 @@ public class LDAPAuthority extends org.a
@Override
public void connect(ConfigParams configParams) {
super.connect(configParams);
- parameters = configParams;
+ //parameters = configParams;
+
+ // Credentials
+ bindUser = configParams.getParameter("ldapBindUser");
+ bindPass = configParams.getObfuscatedParameter("ldapBindPass");
// We get the parameters here, so we can check them in case they are missing
+ serverProtocol = configParams.getParameter("ldapProtocol");
serverName = configParams.getParameter("ldapServerName");
serverPort = configParams.getParameter("ldapServerPort");
serverBase = configParams.getParameter("ldapServerBase");
@@ -132,8 +128,8 @@ public class LDAPAuthority extends org.a
forcedTokens = new ArrayList<String>();
int i = 0;
- while (i < parameters.getChildCount()) {
- ConfigNode sn = parameters.getChild(i++);
+ while (i < configParams.getChildCount()) {
+ ConfigNode sn = configParams.getChild(i++);
if (sn.getType().equals("access")) {
String token = "" + sn.getAttributeValue("token");
forcedTokens.add(token);
@@ -187,17 +183,7 @@ public class LDAPAuthority extends org.a
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://" + serverName + ":" + serverPort + "/" + serverBase);
- //get bind credentials
- String bindUser = getParam(parameters, "ldapBindUser", "");
- String bindPass = "";
- try {
- bindPass = ManifoldCF.deobfuscate(getParam(parameters, "ldapBindPass", ""));
- } catch (ManifoldCFException ex) {
- if (!bindUser.isEmpty()) {
- Logger.getLogger(LDAPAuthority.class.getName()).log(Level.SEVERE, "Deobfuscation error", ex);
- }
- }
- if (!bindUser.isEmpty()) {
+ if (bindUser != null && !bindUser.isEmpty()) {
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, bindUser);
env.put(Context.SECURITY_CREDENTIALS, bindPass);