Author: mlizewski
Date: Tue Jun 25 22:05:04 2013
New Revision: 1496653
URL: http://svn.apache.org/r1496653
Log:
polish translation for LDAP authority
fix for proper handling usernames as username@domain
code beautify
Added:
manifoldcf/trunk/connectors/ldap/connector/src/main/native2ascii/org/apache/manifoldcf/authorities/authorities/ldap/common_pl_PL.properties
Modified:
manifoldcf/trunk/connectors/ldap/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/ldap/LDAPAuthority.java
Modified:
manifoldcf/trunk/connectors/ldap/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/ldap/LDAPAuthority.java
URL:
http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/ldap/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/ldap/LDAPAuthority.java?rev=1496653&r1=1496652&r2=1496653&view=diff
==============================================================================
---
manifoldcf/trunk/connectors/ldap/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/ldap/LDAPAuthority.java
(original)
+++
manifoldcf/trunk/connectors/ldap/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/ldap/LDAPAuthority.java
Tue Jun 25 22:05:04 2013
@@ -6,9 +6,9 @@
* licenses this file to You 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
@@ -40,23 +40,20 @@ public class LDAPAuthority extends org.a
public static final String _rcsid = "@(#)$Id$";
/**
- * Session information for all DC's we talk with.
- */
+ * Session information for all DC's we talk with.
+ */
private LdapContext session = null;
private long sessionExpirationTime = -1L;
-
/**
- * This is the active directory global deny token. This should be ingested
- * with all documents.
- */
+ * This is the active directory global deny token. This should be ingested
+ * with all documents.
+ */
private static final String globalDenyToken = "DEAD_AUTHORITY";
private static final AuthorizationResponse unreachableResponse = new
AuthorizationResponse(new String[]{globalDenyToken},
AuthorizationResponse.RESPONSE_UNREACHABLE);
private static final AuthorizationResponse userNotFoundResponse = new
AuthorizationResponse(new String[]{globalDenyToken},
AuthorizationResponse.RESPONSE_USERNOTFOUND);
-
private ConfigParams parameters;
-
private String serverName;
private String serverPort;
private String serverBase;
@@ -68,10 +65,11 @@ public class LDAPAuthority extends org.a
private boolean groupMemberDN;
private boolean addUserRecord;
private String userNameAttr;
-
private long responseLifetime = 60000L; //60sec
private int LRUsize = 1000;
- /** Cache manager. */
+ /**
+ * Cache manager.
+ */
private ICacheManager cacheManager = null;
/**
@@ -101,30 +99,28 @@ public class LDAPAuthority extends org.a
parameters = configParams;
// We get the parameters here, so we can check them in case they are
missing
- serverName = configParams.getParameter( "ldapServerName" );
- serverPort = configParams.getParameter( "ldapServerPort" );
- serverBase = configParams.getParameter( "ldapServerBase" );
-
- userBase = configParams.getParameter( "ldapUserBase" );
- userSearch = configParams.getParameter( "ldapUserSearch" );
- groupBase = configParams.getParameter( "ldapGroupBase" );
- groupSearch = configParams.getParameter( "ldapGroupSearch" );
- groupNameAttr = configParams.getParameter( "ldapGroupNameAttr" );
- userNameAttr = configParams.getParameter( "ldapUserNameAttr" );
-
+ serverName = configParams.getParameter("ldapServerName");
+ serverPort = configParams.getParameter("ldapServerPort");
+ serverBase = configParams.getParameter("ldapServerBase");
+
+ userBase = configParams.getParameter("ldapUserBase");
+ userSearch = configParams.getParameter("ldapUserSearch");
+ groupBase = configParams.getParameter("ldapGroupBase");
+ groupSearch = configParams.getParameter("ldapGroupSearch");
+ groupNameAttr = configParams.getParameter("ldapGroupNameAttr");
+ userNameAttr = configParams.getParameter("ldapUserNameAttr");
groupMemberDN = "1".equals(getParam(configParams, "ldapGroupMemberDn",
""));
addUserRecord = "1".equals(getParam(configParams, "ldapAddUserRecord",
""));
}
// All methods below this line will ONLY be called if a connect() call
succeeded
// on this instance!
-
- /** Session setup. Anything that might need to throw an exception should go
- * here.
- */
+ /**
+ * Session setup. Anything that might need to throw an exception should go
+ * here.
+ */
protected LdapContext getSession()
- throws ManifoldCFException
- {
+ throws ManifoldCFException {
if (serverName == null || serverName.length() == 0) {
throw new ManifoldCFException("Server name parameter missing but
required");
}
@@ -155,13 +151,19 @@ public class LDAPAuthority extends org.a
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
- env.put(Context.PROVIDER_URL,
"ldap://"+serverName+":"+serverPort+"/"+serverBase);
+ env.put(Context.PROVIDER_URL, "ldap://" + serverName + ":" + serverPort +
"/" + serverBase);
//get bind credentials
- String bindUser = getParam(parameters, "ldapBindUser", null);
- String bindPass = getParam(parameters, "ldapBindPass", null);
- if (bindPass != null && bindUser != null) {
- bindPass = ManifoldCF.deobfuscate(bindPass);
+ 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()) {
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, bindUser);
env.put(Context.SECURITY_CREDENTIALS, bindPass);
@@ -178,26 +180,26 @@ public class LDAPAuthority extends org.a
} catch (AuthenticationException e) {
session = null;
sessionExpirationTime = -1L;
- throw new ManifoldCFException("Authentication error: "+e.getMessage(),e);
+ throw new ManifoldCFException("Authentication error: " + e.getMessage()
+ ", explanation: " + e.getExplanation(), e);
} catch (CommunicationException e) {
session = null;
sessionExpirationTime = -1L;
- throw new ManifoldCFException("Communication error: "+e.getMessage(),e);
+ throw new ManifoldCFException("Communication error: " + e.getMessage(),
e);
} catch (NamingException e) {
session = null;
sessionExpirationTime = -1L;
- throw new ManifoldCFException("Naming error: "+e.getMessage(),e);
+ throw new ManifoldCFException("Naming error: " + e.getMessage(), e);
}
}
-
+
/**
- * Check connection for sanity.
- */
+ * Check connection for sanity.
+ */
@Override
public String check()
throws ManifoldCFException {
disconnectSession();
- LdapContext fSession = getSession();
+ getSession();
// MHL for a real check of all the search etc.
return super.check();
}
@@ -214,8 +216,9 @@ public class LDAPAuthority extends org.a
super.poll();
}
- /** Disconnect a session.
- */
+ /**
+ * Disconnect a session.
+ */
protected void disconnectSession() {
if (session != null) {
try {
@@ -225,14 +228,12 @@ public class LDAPAuthority extends org.a
}
session = null;
sessionExpirationTime = -1L;
-
}
}
-
+
/**
- * Close the connection. Call this before discarding the repository
- * connector.
- */
+ * Close the connection. Call this before discarding the repository
connector.
+ */
@Override
public void disconnect()
throws ManifoldCFException {
@@ -248,7 +249,6 @@ public class LDAPAuthority extends org.a
groupSearch = null;
groupNameAttr = null;
userNameAttr = null;
-
}
protected String createCacheConnectionString() {
@@ -268,19 +268,19 @@ public class LDAPAuthority extends org.a
sb.append(groupBase).append("|").append(groupSearch).append("|").append(groupNameAttr).append("|").append(groupMemberDN
? 'Y' : 'N');
return sb.toString();
}
-
+
/**
- * Obtain the access tokens for a given user name.
- *
- * @param userName is the user name or identifier.
- * @return the response tokens (according to the current authority). (Should
- * throws an exception only when a condition cannot be properly described
- * within the authorization response object.)
- */
+ * Obtain the access tokens for a given user name.
+ *
+ * @param userName is the user name or identifier.
+ * @return the response tokens (according to the current authority). (Should
+ * throws an exception only when a condition cannot be properly described
+ * within the authorization response object.)
+ */
@Override
public AuthorizationResponse getAuthorizationResponse(String userName)
throws ManifoldCFException {
-
+
getSession();
// Construct a cache description object
ICacheDescription objectDescription = new
LdapAuthorizationResponseDescription(userName,
@@ -312,7 +312,7 @@ public class LDAPAuthority extends org.a
protected AuthorizationResponse getAuthorizationResponseUncached(String
userName)
throws ManifoldCFException {
- LdapContext session = getSession();
+ getSession();
try {
//find user in LDAP tree
SearchResult usrRecord = getUserEntry(session, userName);
@@ -322,34 +322,41 @@ public class LDAPAuthority extends org.a
ArrayList theGroups = new ArrayList();
- String usrName = userName;
+ String usrName = userName.split("@")[0];
if (userNameAttr != null && !"".equals(userNameAttr)) {
if (usrRecord.getAttributes() != null) {
Attribute attr = usrRecord.getAttributes().get(userNameAttr);
if (attr != null) {
usrName = attr.get().toString();
+ if (addUserRecord) {
+ NamingEnumeration values = attr.getAll();
+ while (values.hasMore()) {
+ theGroups.add(values.next().toString());
+ }
+ }
}
}
}
- if (addUserRecord) {
- theGroups.add(usrName);
- }
- //specify the LDAP search filter
- String searchFilter = groupSearch.replaceAll("\\{0\\}",
escapeLDAPSearchFilter(groupMemberDN ? usrRecord.getNameInNamespace() :
usrName));
- SearchControls searchCtls = new SearchControls();
- searchCtls.setSearchScope(SearchControls.SUBTREE_SCOPE);
- String returnedAtts[] = {groupNameAttr};
- searchCtls.setReturningAttributes(returnedAtts);
-
- //Search for tokens. Since every user *must* have a SID, the "no user"
detection should be safe.
- NamingEnumeration answer = session.search(groupBase, searchFilter,
searchCtls);
-
- while (answer.hasMoreElements()) {
- SearchResult sr = (SearchResult) answer.next();
- Attributes attrs = sr.getAttributes();
- if (attrs != null) {
- theGroups.add(attrs.get(groupNameAttr).get().toString());
+ if (groupSearch != null && !groupSearch.isEmpty()) {
+ //specify the LDAP search filter
+ String searchFilter = groupSearch.replaceAll("\\{0\\}",
escapeLDAPSearchFilter(groupMemberDN ? usrRecord.getNameInNamespace() :
usrName));
+ SearchControls searchCtls = new SearchControls();
+ searchCtls.setSearchScope(SearchControls.SUBTREE_SCOPE);
+ String returnedAtts[] = {groupNameAttr};
+ searchCtls.setReturningAttributes(returnedAtts);
+
+ NamingEnumeration answer = session.search(groupBase, searchFilter,
searchCtls);
+
+ while (answer.hasMoreElements()) {
+ SearchResult sr = (SearchResult) answer.next();
+ Attributes attrs = sr.getAttributes();
+ if (attrs != null) {
+ NamingEnumeration values = attrs.get(groupNameAttr).getAll();
+ while (values.hasMore()) {
+ theGroups.add(values.next().toString());
+ }
+ }
}
}
@@ -372,12 +379,12 @@ public class LDAPAuthority extends org.a
}
/**
- * Obtain the default access tokens for a given user name.
- *
- * @param userName is the user name or identifier.
- * @return the default response tokens, presuming that the connect method
- * fails.
- */
+ * Obtain the default access tokens for a given user name.
+ *
+ * @param userName is the user name or identifier.
+ * @return the default response tokens, presuming that the connect method
+ * fails.
+ */
@Override
public AuthorizationResponse getDefaultAuthorizationResponse(String
userName) {
// The default response if the getConnection method fails
@@ -388,235 +395,218 @@ public class LDAPAuthority extends org.a
//
// These support methods are involved in setting up authority connection
configuration information. The configuration methods cannot assume that the
// current authority object is connected. That is why they receive a thread
context argument.
-
/**
- * Output the configuration header section. This method is called in the
- * head section of the connector's configuration page. Its purpose is to add
- * the required tabs to the list, and to output any javascript methods that
- * might be needed by the configuration editing HTML.
- *
- * @param threadContext is the local thread context.
- * @param out is the output to which any HTML should be sent.
- * @param parameters are the configuration parameters, as they currently
- * exist, for this connection being configured.
- * @param tabsArray is an array of tab names. Add to this array any tab
- * names that are specific to the connector.
- */
+ * Output the configuration header section. This method is called in the head
+ * section of the connector's configuration page. Its purpose is to add the
+ * required tabs to the list, and to output any javascript methods that might
+ * be needed by the configuration editing HTML.
+ *
+ * @param threadContext is the local thread context.
+ * @param out is the output to which any HTML should be sent.
+ * @param parameters are the configuration parameters, as they currently
+ * exist, for this connection being configured.
+ * @param tabsArray is an array of tab names. Add to this array any tab names
+ * that are specific to the connector.
+ */
@Override
public void outputConfigurationHeader(IThreadContext threadContext,
IHTTPOutput out, Locale locale, ConfigParams parameters, List<String> tabsArray)
throws ManifoldCFException, IOException {
- tabsArray.add(Messages.getString(locale,"LDAP.LDAP"));
+ tabsArray.add(Messages.getString(locale, "LDAP.LDAP"));
out.print(
-"<script type=\"text/javascript\">\n"+
-"<!--\n"+
-"function checkConfig() {\n"+
-" if (editconnection.ldapServerName.value.indexOf(\"/\") != -1) {\n"+
-"
alert(\""+Messages.getBodyJavascriptString(locale,"LDAP.ServerNameCannotIncludeSlash")+"\");\n"+
-" editconnection.ldapServerName.focus();\n"+
-" return false;\n"+
-" }\n"+
-" if (editconnection.ldapServerPort.value != \"\" &&
!isInteger(editconnection.ldapServerPort.value)) {\n"+
-"
alert(\""+Messages.getBodyJavascriptString(locale,"LDAP.ServerPortMustBeAnInteger")+"\");\n"+
-" editconnection.ldapServerPort.focus();\n"+
-" return false;\n"+
-" }\n"+
-" if (editconnection.ldapServerBase.value.indexOf(\"/\") != -1) {\n"+
-"
alert(\""+Messages.getBodyJavascriptString(locale,"LDAP.ServerBaseCannotIncludeSlash")+"\");\n"+
-" editconnection.ldapServerBase.focus();\n"+
-" return false;\n"+
-" }\n"+
-" if (editconnection.ldapUserSearch.value != \"\" &&
editconnection.ldapUserSearch.value.indexOf(\"{0}\") == -1) {\n"+
-"
alert(\""+Messages.getBodyJavascriptString(locale,"LDAP.UserSearchMustIncludeSubstitution")+"\");\n"+
-" editconnection.ldapUserSearch.focus();\n"+
-" return false;\n"+
-" }\n"+
-" if (editconnection.ldapGroupSearch.value != \"\" &&
editconnection.ldapGroupSearch.value.indexOf(\"{0}\") == -1) {\n"+
-"
alert(\""+Messages.getBodyJavascriptString(locale,"LDAP.GroupSearchMustIncludeSubstitution")+"\");\n"+
-" editconnection.ldapGroupSearch.focus();\n"+
-" return false;\n"+
-" }\n"+
-" return true;\n"+
-"}\n"+
-"\n"+
-"function checkConfigForSave() {\n"+
-" if (editconnection.ldapServerName.value == \"\") {\n"+
-"
alert(\""+Messages.getBodyJavascriptString(locale,"LDAP.ServerNameCannotBeBlank")+"\");\n"+
-"
SelectTab(\""+Messages.getBodyJavascriptString(locale,"LDAP.LDAP")+"\");\n"+
-" editconnection.ldapServerName.focus();\n"+
-" return false;\n"+
-" }\n"+
-" if (editconnection.ldapServerPort.value == \"\") {\n"+
-"
alert(\""+Messages.getBodyJavascriptString(locale,"LDAP.ServerPortCannotBeBlank")+"\");\n"+
-"
SelectTab(\""+Messages.getBodyJavascriptString(locale,"LDAP.LDAP")+"\");\n"+
-" editconnection.ldapServerPort.focus();\n"+
-" return false;\n"+
-" }\n"+
-" if (editconnection.ldapUserSearch.value == \"\") {\n"+
-"
alert(\""+Messages.getBodyJavascriptString(locale,"LDAP.UserSearchCannotBeBlank")+"\");\n"+
-"
SelectTab(\""+Messages.getBodyJavascriptString(locale,"LDAP.LDAP")+"\");\n"+
-" editconnection.ldapUserSearch.focus();\n"+
-" return false;\n"+
-" }\n"+
-" if (editconnection.ldapGroupSearch.value == \"\") {\n"+
-"
alert(\""+Messages.getBodyJavascriptString(locale,"LDAP.GroupSearchCannotBeBlank")+"\");\n"+
-"
SelectTab(\""+Messages.getBodyJavascriptString(locale,"LDAP.LDAP")+"\");\n"+
-" editconnection.ldapGroupSearch.focus();\n"+
-" return false;\n"+
-" }\n"+
-" if (editconnection.ldapGroupNameAttr.value == \"\") {\n"+
-"
alert(\""+Messages.getBodyJavascriptString(locale,"LDAP.GroupNameAttrCannotBeBlank")+"\");\n"+
-"
SelectTab(\""+Messages.getBodyJavascriptString(locale,"LDAP.LDAP")+"\");\n"+
-" editconnection.ldapGroupNameAttr.focus();\n"+
-" return false;\n"+
-" }\n"+
-" if (editconnection.ldapUserSearch.value != \"\" &&
editconnection.ldapUserSearch.value.indexOf(\"{0}\") == -1) {\n"+
-"
alert(\""+Messages.getBodyJavascriptString(locale,"LDAP.UserSearchMustIncludeSubstitution")+"\");\n"+
-"
SelectTab(\""+Messages.getBodyJavascriptString(locale,"LDAP.LDAP")+"\");\n"+
-" editconnection.ldapUserSearch.focus();\n"+
-" return false;\n"+
-" }\n"+
-" if (editconnection.ldapGroupSearch.value != \"\" &&
editconnection.ldapGroupSearch.value.indexOf(\"{0}\") == -1) {\n"+
-"
alert(\""+Messages.getBodyJavascriptString(locale,"LDAP.GroupSearchMustIncludeSubstitution")+"\");\n"+
-"
SelectTab(\""+Messages.getBodyJavascriptString(locale,"LDAP.LDAP")+"\");\n"+
-" editconnection.ldapGroupSearch.focus();\n"+
-" return false;\n"+
-" }\n"+
-" if (editconnection.ldapServerPort.value != \"\" &&
!isInteger(editconnection.ldapServerPort.value)) {\n"+
-"
alert(\""+Messages.getBodyJavascriptString(locale,"LDAP.ServerPortMustBeAnInteger")+"\");\n"+
-"
SelectTab(\""+Messages.getBodyJavascriptString(locale,"LDAP.LDAP")+"\");\n"+
-" editconnection.ldapServerPort.focus();\n"+
-" return false;\n"+
-" }\n"+
-" if (editconnection.ldapServerName.value.indexOf(\"/\") != -1) {\n"+
-"
alert(\""+Messages.getBodyJavascriptString(locale,"LDAP.ServerNameCannotIncludeSlash")+"\");\n"+
-"
SelectTab(\""+Messages.getBodyJavascriptString(locale,"LDAP.LDAP")+"\");\n"+
-" editconnection.ldapServerName.focus();\n"+
-" return false;\n"+
-" }\n"+
-" if (editconnection.ldapServerBase.value.indexOf(\"/\") != -1) {\n"+
-"
alert(\""+Messages.getBodyJavascriptString(locale,"LDAP.ServerBaseCannotIncludeSlash")+"\");\n"+
-" editconnection.ldapServerBase.focus();\n"+
-" return false;\n"+
-" }\n"+
-" return true;\n"+
-"}\n"+
-"//-->\n"+
-"</script>\n"
- );
- }
-
- /**
- * Output the configuration body section. This method is called in the body
- * section of the authority connector's configuration page. Its purpose is
- * to present the required form elements for editing. The coder can presume
- * that the HTML that is output from this configuration will be within
- * appropriate <html>, <body>, and <form> tags. The name of the form is
- * "editconnection".
- *
- * @param threadContext is the local thread context.
- * @param out is the output to which any HTML should be sent.
- * @param parameters are the configuration parameters, as they currently
- * exist, for this connection being configured.
- * @param tabName is the current tab name.
- */
+ "<script type=\"text/javascript\">\n"
+ + "<!--\n"
+ + "function checkConfig() {\n"
+ + " if (editconnection.ldapServerName.value.indexOf(\"/\") != -1) {\n"
+ + " alert(\"" + Messages.getBodyJavascriptString(locale,
"LDAP.ServerNameCannotIncludeSlash") + "\");\n"
+ + " editconnection.ldapServerName.focus();\n"
+ + " return false;\n"
+ + " }\n"
+ + " if (editconnection.ldapServerPort.value != \"\" &&
!isInteger(editconnection.ldapServerPort.value)) {\n"
+ + " alert(\"" + Messages.getBodyJavascriptString(locale,
"LDAP.ServerPortMustBeAnInteger") + "\");\n"
+ + " editconnection.ldapServerPort.focus();\n"
+ + " return false;\n"
+ + " }\n"
+ + " if (editconnection.ldapServerBase.value.indexOf(\"/\") != -1) {\n"
+ + " alert(\"" + Messages.getBodyJavascriptString(locale,
"LDAP.ServerBaseCannotIncludeSlash") + "\");\n"
+ + " editconnection.ldapServerBase.focus();\n"
+ + " return false;\n"
+ + " }\n"
+ + " if (editconnection.ldapUserSearch.value != \"\" &&
editconnection.ldapUserSearch.value.indexOf(\"{0}\") == -1) {\n"
+ + " alert(\"" + Messages.getBodyJavascriptString(locale,
"LDAP.UserSearchMustIncludeSubstitution") + "\");\n"
+ + " editconnection.ldapUserSearch.focus();\n"
+ + " return false;\n"
+ + " }\n"
+ + " if (editconnection.ldapGroupSearch.value != \"\" &&
editconnection.ldapGroupSearch.value.indexOf(\"{0}\") == -1) {\n"
+ + " alert(\"" + Messages.getBodyJavascriptString(locale,
"LDAP.GroupSearchMustIncludeSubstitution") + "\");\n"
+ + " editconnection.ldapGroupSearch.focus();\n"
+ + " return false;\n"
+ + " }\n"
+ + " return true;\n"
+ + "}\n"
+ + "\n"
+ + "function checkConfigForSave() {\n"
+ + " if (editconnection.ldapServerName.value == \"\") {\n"
+ + " alert(\"" + Messages.getBodyJavascriptString(locale,
"LDAP.ServerNameCannotBeBlank") + "\");\n"
+ + " SelectTab(\"" + Messages.getBodyJavascriptString(locale,
"LDAP.LDAP") + "\");\n"
+ + " editconnection.ldapServerName.focus();\n"
+ + " return false;\n"
+ + " }\n"
+ + " if (editconnection.ldapServerPort.value == \"\") {\n"
+ + " alert(\"" + Messages.getBodyJavascriptString(locale,
"LDAP.ServerPortCannotBeBlank") + "\");\n"
+ + " SelectTab(\"" + Messages.getBodyJavascriptString(locale,
"LDAP.LDAP") + "\");\n"
+ + " editconnection.ldapServerPort.focus();\n"
+ + " return false;\n"
+ + " }\n"
+ + " if (editconnection.ldapUserSearch.value == \"\") {\n"
+ + " alert(\"" + Messages.getBodyJavascriptString(locale,
"LDAP.UserSearchCannotBeBlank") + "\");\n"
+ + " SelectTab(\"" + Messages.getBodyJavascriptString(locale,
"LDAP.LDAP") + "\");\n"
+ + " editconnection.ldapUserSearch.focus();\n"
+ + " return false;\n"
+ + " }\n"
+ + " if (editconnection.ldapGroupSearch.value == \"\") {\n"
+ + " alert(\"" + Messages.getBodyJavascriptString(locale,
"LDAP.GroupSearchCannotBeBlank") + "\");\n"
+ + " SelectTab(\"" + Messages.getBodyJavascriptString(locale,
"LDAP.LDAP") + "\");\n"
+ + " editconnection.ldapGroupSearch.focus();\n"
+ + " return false;\n"
+ + " }\n"
+ + " if (editconnection.ldapGroupNameAttr.value == \"\") {\n"
+ + " alert(\"" + Messages.getBodyJavascriptString(locale,
"LDAP.GroupNameAttrCannotBeBlank") + "\");\n"
+ + " SelectTab(\"" + Messages.getBodyJavascriptString(locale,
"LDAP.LDAP") + "\");\n"
+ + " editconnection.ldapGroupNameAttr.focus();\n"
+ + " return false;\n"
+ + " }\n"
+ + " if (editconnection.ldapUserSearch.value != \"\" &&
editconnection.ldapUserSearch.value.indexOf(\"{0}\") == -1) {\n"
+ + " alert(\"" + Messages.getBodyJavascriptString(locale,
"LDAP.UserSearchMustIncludeSubstitution") + "\");\n"
+ + " SelectTab(\"" + Messages.getBodyJavascriptString(locale,
"LDAP.LDAP") + "\");\n"
+ + " editconnection.ldapUserSearch.focus();\n"
+ + " return false;\n"
+ + " }\n"
+ + " if (editconnection.ldapGroupSearch.value != \"\" &&
editconnection.ldapGroupSearch.value.indexOf(\"{0}\") == -1) {\n"
+ + " alert(\"" + Messages.getBodyJavascriptString(locale,
"LDAP.GroupSearchMustIncludeSubstitution") + "\");\n"
+ + " SelectTab(\"" + Messages.getBodyJavascriptString(locale,
"LDAP.LDAP") + "\");\n"
+ + " editconnection.ldapGroupSearch.focus();\n"
+ + " return false;\n"
+ + " }\n"
+ + " if (editconnection.ldapServerPort.value != \"\" &&
!isInteger(editconnection.ldapServerPort.value)) {\n"
+ + " alert(\"" + Messages.getBodyJavascriptString(locale,
"LDAP.ServerPortMustBeAnInteger") + "\");\n"
+ + " SelectTab(\"" + Messages.getBodyJavascriptString(locale,
"LDAP.LDAP") + "\");\n"
+ + " editconnection.ldapServerPort.focus();\n"
+ + " return false;\n"
+ + " }\n"
+ + " if (editconnection.ldapServerName.value.indexOf(\"/\") != -1) {\n"
+ + " alert(\"" + Messages.getBodyJavascriptString(locale,
"LDAP.ServerNameCannotIncludeSlash") + "\");\n"
+ + " SelectTab(\"" + Messages.getBodyJavascriptString(locale,
"LDAP.LDAP") + "\");\n"
+ + " editconnection.ldapServerName.focus();\n"
+ + " return false;\n"
+ + " }\n"
+ + " if (editconnection.ldapServerBase.value.indexOf(\"/\") != -1) {\n"
+ + " alert(\"" + Messages.getBodyJavascriptString(locale,
"LDAP.ServerBaseCannotIncludeSlash") + "\");\n"
+ + " editconnection.ldapServerBase.focus();\n"
+ + " return false;\n"
+ + " }\n"
+ + " return true;\n"
+ + "}\n"
+ + "//-->\n"
+ + "</script>\n");
+ }
+
+ /**
+ * Output the configuration body section. This method is called in the body
+ * section of the authority connector's configuration page. Its purpose is to
+ * present the required form elements for editing. The coder can presume that
+ * the HTML that is output from this configuration will be within appropriate
+ * <html>, <body>, and <form> tags. The name of the form is "editconnection".
+ *
+ * @param threadContext is the local thread context.
+ * @param out is the output to which any HTML should be sent.
+ * @param parameters are the configuration parameters, as they currently
+ * exist, for this connection being configured.
+ * @param tabName is the current tab name.
+ */
@Override
public void outputConfigurationBody(IThreadContext threadContext,
IHTTPOutput out, Locale locale, ConfigParams parameters, String tabName)
throws ManifoldCFException, IOException {
- String fServerName = getParam( parameters, "ldapServerName", "");
- String fServerPort = getParam( parameters, "ldapServerPort", "389");
- String fServerBase = getParam( parameters, "ldapServerBase", "");
-
- String fUserBase = getParam( parameters, "ldapUserBase", "ou=People" );
- String fUserSearch = getParam( parameters, "ldapUserSearch",
"(&(objectClass=inetOrgPerson)(uid={0}))" );
+ String fServerName = getParam(parameters, "ldapServerName", "");
+ String fServerPort = getParam(parameters, "ldapServerPort", "389");
+ String fServerBase = getParam(parameters, "ldapServerBase", "");
+
+ String fUserBase = getParam(parameters, "ldapUserBase", "ou=People");
+ String fUserSearch = getParam(parameters, "ldapUserSearch",
"(&(objectClass=inetOrgPerson)(uid={0}))");
String fUserNameAttr = getParam(parameters, "ldapUserNameAttr", "uid");
boolean fAddUserRecord = "1".equals(getParam(parameters,
"ldapAddUserRecord", ""));
-
- String fGroupBase = getParam( parameters, "ldapGroupBase", "ou=Groups" );
- String fGroupSearch = getParam( parameters, "ldapGroupSearch",
"(&(objectClass=groupOfNames)(member={0}))" );
- String fGroupNameAttr = getParam( parameters, "ldapGroupNameAttr", "cn" );
+
+ String fGroupBase = getParam(parameters, "ldapGroupBase", "ou=Groups");
+ String fGroupSearch = getParam(parameters, "ldapGroupSearch",
"(&(objectClass=groupOfNames)(member={0}))");
+ String fGroupNameAttr = getParam(parameters, "ldapGroupNameAttr", "cn");
boolean fGroupMemberDN = "1".equals(getParam(parameters,
"ldapGroupMemberDn", ""));
-
+
String fBindUser = getParam(parameters, "ldapBindUser", "");
- String fBindPass = getParam(parameters, "ldapBindPass", null);
- if (fBindPass != null)
- fBindPass = ManifoldCF.deobfuscate(fBindPass);
- else
- fBindPass = "";
+ String fBindPass = "";
+ try {
+ fBindPass = ManifoldCF.deobfuscate(getParam(parameters, "ldapBindPass",
""));
+ } catch (ManifoldCFException ex) {
+ //ignore
+ }
- if (tabName.equals(Messages.getString(locale,"LDAP.LDAP"))) {
+ if (tabName.equals(Messages.getString(locale, "LDAP.LDAP"))) {
out.print(
-"<table class=\"displaytable\">\n"+
-" <tr><td class=\"separator\" colspan=\"2\"><hr/></td></tr>\n"+
-
-" <tr>\n"+
-" <td
class=\"description\"><nobr>"+Messages.getBodyString(locale,"LDAP.LDAPServerNameColon")+"</nobr></td>\n"+
-" <td class=\"value\"><input type=\"text\" size=\"32\"
name=\"ldapServerName\"
value=\""+Encoder.attributeEscape(fServerName)+"\"/></td>\n"+
-" </tr>\n"+
-
-" <tr>\n"+
-" <td
class=\"description\"><nobr>"+Messages.getBodyString(locale,"LDAP.LDAPServerPortColon")+"</nobr></td>\n"+
-" <td class=\"value\"><input type=\"text\" size=\"5\" name=\"ldapServerPort\"
value=\""+Encoder.attributeEscape(fServerPort)+"\"/></td>\n"+
-" </tr>\n"+
-
-" <tr>\n"+
-" <td
class=\"description\"><nobr>"+Messages.getBodyString(locale,"LDAP.LDAPServerBaseColon")+"</nobr></td>\n"+
-" <td class=\"value\"><input type=\"text\" size=\"64\"
name=\"ldapServerBase\"
value=\""+Encoder.attributeEscape(fServerBase)+"\"/></td>\n"+
-" </tr>\n"+
-
-" <tr>\n"+
-" <td
class=\"description\"><nobr>"+Messages.getBodyString(locale,"LDAP.LDAPBindUserColon")+"</nobr></td>\n"+
-" <td class=\"value\"><input type=\"text\" size=\"64\" name=\"ldapBindUser\"
value=\""+Encoder.attributeEscape(fBindUser)+"\"/></td>\n"+
-" </tr>\n"+
-
-" <tr>\n"+
-" <td
class=\"description\"><nobr>"+Messages.getBodyString(locale,"LDAP.LDAPBindPasswordColon")+"</nobr></td>\n"+
-" <td class=\"value\"><input type=\"password\" size=\"64\"
name=\"ldapBindPass\"
value=\""+Encoder.attributeEscape(fBindPass)+"\"/></td>\n"+
-" </tr>\n"+
-
-" <tr><td class=\"separator\" colspan=\"2\"><hr/></td></tr>\n"+
-" <tr>\n"+
-" <td
class=\"description\"><nobr>"+Messages.getBodyString(locale,"LDAP.UserSearchBaseColon")+"</nobr></td>\n"+
-" <td class=\"value\"><input type=\"text\" size=\"64\" name=\"ldapUserBase\"
value=\""+Encoder.attributeEscape(fUserBase)+"\"/></td>\n"+
-" </tr>\n"+
-
-" <tr>\n"+
-" <td
class=\"description\"><nobr>"+Messages.getBodyString(locale,"LDAP.UserSearchFilterColon")+"</nobr></td>\n"+
-" <td class=\"value\"><input type=\"text\" size=\"64\"
name=\"ldapUserSearch\"
value=\""+Encoder.attributeEscape(fUserSearch)+"\"/></td>\n"+
-" </tr>\n"+
-
-" <tr>\n"+
-" <td
class=\"description\"><nobr>"+Messages.getBodyString(locale,"LDAP.AddUserAuthColon")+"</nobr></td>\n"+
-" <td class=\"value\"><input type=\"checkbox\" value=\"1\"
name=\"ldapAddUserRecord\" " + (fAddUserRecord ? "checked=\"true\"" : "") +
"/></td>\n"+
-" </tr>\n"+
-
-" <tr>\n"+
-" <td
class=\"description\"><nobr>"+Messages.getBodyString(locale,"LDAP.UserNameAttrColon")+"</nobr></td>\n"+
-" <td class=\"value\"><input type=\"text\" size=\"64\"
name=\"ldapUserNameAttr\" value=\"" + Encoder.attributeEscape(fUserNameAttr) +
"\"/></td>\n"+
-" </tr>\n"+
-
-" <tr><td class=\"separator\" colspan=\"2\"><hr/></td></tr>\n" +
-" <tr>\n"+
-" <td
class=\"description\"><nobr>"+Messages.getBodyString(locale,"LDAP.GroupSearchBaseColon")+"</nobr></td>\n"+
-" <td class=\"value\"><input type=\"text\" size=\"64\" name=\"ldapGroupBase\"
value=\""+Encoder.attributeEscape(fGroupBase)+"\"/></td>\n"+
-" </tr>\n"+
-
-" <tr>\n"+
-" <td
class=\"description\"><nobr>"+Messages.getBodyString(locale,"LDAP.GroupSearchFilterColon")+"</nobr></td>\n"+
-" <td class=\"value\"><input type=\"text\" size=\"64\"
name=\"ldapGroupSearch\"
value=\""+Encoder.attributeEscape(fGroupSearch)+"\"/></td>\n"+
-" </tr>\n"+
-
-" <tr>\n"+
-" <td
class=\"description\"><nobr>"+Messages.getBodyString(locale,"LDAP.GroupNameAttributeColon")+"</nobr></td>\n"+
-" <td class=\"value\"><input type=\"text\" size=\"64\"
name=\"ldapGroupNameAttr\"
value=\""+Encoder.attributeEscape(fGroupNameAttr)+"\"/></td>\n"+
-" </tr>\n"+
-
-" <tr>\n"+
-" <td
class=\"description\"><nobr>"+Messages.getBodyString(locale,"LDAP.GroupMemberDnColon")+"</nobr></td>\n"+
-" <td class=\"value\"><input type=\"checkbox\" value=\"1\"
name=\"ldapGroupMemberDn\" " + (fGroupMemberDN ? "checked=\"true\"" : "") +
"/></td>\n"+
-" </tr>\n"+
-
-"</table>\n"
- );
+ "<table class=\"displaytable\">\n"
+ + " <tr><td class=\"separator\" colspan=\"2\"><hr/></td></tr>\n"
+ + " <tr>\n"
+ + " <td class=\"description\"><nobr>" +
Messages.getBodyString(locale, "LDAP.LDAPServerNameColon") + "</nobr></td>\n"
+ + " <td class=\"value\"><input type=\"text\" size=\"32\"
name=\"ldapServerName\" value=\"" + Encoder.attributeEscape(fServerName) +
"\"/></td>\n"
+ + " </tr>\n"
+ + " <tr>\n"
+ + " <td class=\"description\"><nobr>" +
Messages.getBodyString(locale, "LDAP.LDAPServerPortColon") + "</nobr></td>\n"
+ + " <td class=\"value\"><input type=\"text\" size=\"5\"
name=\"ldapServerPort\" value=\"" + Encoder.attributeEscape(fServerPort) +
"\"/></td>\n"
+ + " </tr>\n"
+ + " <tr>\n"
+ + " <td class=\"description\"><nobr>" +
Messages.getBodyString(locale, "LDAP.LDAPServerBaseColon") + "</nobr></td>\n"
+ + " <td class=\"value\"><input type=\"text\" size=\"64\"
name=\"ldapServerBase\" value=\"" + Encoder.attributeEscape(fServerBase) +
"\"/></td>\n"
+ + " </tr>\n"
+ + " <tr>\n"
+ + " <td class=\"description\"><nobr>" +
Messages.getBodyString(locale, "LDAP.LDAPBindUserColon") + "</nobr></td>\n"
+ + " <td class=\"value\"><input type=\"text\" size=\"64\"
name=\"ldapBindUser\" value=\"" + Encoder.attributeEscape(fBindUser) +
"\"/></td>\n"
+ + " </tr>\n"
+ + " <tr>\n"
+ + " <td class=\"description\"><nobr>" +
Messages.getBodyString(locale, "LDAP.LDAPBindPasswordColon") + "</nobr></td>\n"
+ + " <td class=\"value\"><input type=\"password\" size=\"64\"
name=\"ldapBindPass\" value=\"" + Encoder.attributeEscape(fBindPass) +
"\"/></td>\n"
+ + " </tr>\n"
+ + " <tr><td class=\"separator\" colspan=\"2\"><hr/></td></tr>\n"
+ + " <tr>\n"
+ + " <td class=\"description\"><nobr>" +
Messages.getBodyString(locale, "LDAP.UserSearchBaseColon") + "</nobr></td>\n"
+ + " <td class=\"value\"><input type=\"text\" size=\"64\"
name=\"ldapUserBase\" value=\"" + Encoder.attributeEscape(fUserBase) +
"\"/></td>\n"
+ + " </tr>\n"
+ + " <tr>\n"
+ + " <td class=\"description\"><nobr>" +
Messages.getBodyString(locale, "LDAP.UserSearchFilterColon") + "</nobr></td>\n"
+ + " <td class=\"value\"><input type=\"text\" size=\"64\"
name=\"ldapUserSearch\" value=\"" + Encoder.attributeEscape(fUserSearch) +
"\"/></td>\n"
+ + " </tr>\n"
+ + " <tr>\n"
+ + " <td class=\"description\"><nobr>" +
Messages.getBodyString(locale, "LDAP.AddUserAuthColon") + "</nobr></td>\n"
+ + " <td class=\"value\"><input type=\"checkbox\" value=\"1\"
name=\"ldapAddUserRecord\" " + (fAddUserRecord ? "checked=\"true\"" : "") +
"/></td>\n"
+ + " </tr>\n"
+ + " <tr>\n"
+ + " <td class=\"description\"><nobr>" +
Messages.getBodyString(locale, "LDAP.UserNameAttrColon") + "</nobr></td>\n"
+ + " <td class=\"value\"><input type=\"text\" size=\"64\"
name=\"ldapUserNameAttr\" value=\"" + Encoder.attributeEscape(fUserNameAttr) +
"\"/></td>\n"
+ + " </tr>\n"
+ + " <tr><td class=\"separator\" colspan=\"2\"><hr/></td></tr>\n"
+ + " <tr>\n"
+ + " <td class=\"description\"><nobr>" +
Messages.getBodyString(locale, "LDAP.GroupSearchBaseColon") + "</nobr></td>\n"
+ + " <td class=\"value\"><input type=\"text\" size=\"64\"
name=\"ldapGroupBase\" value=\"" + Encoder.attributeEscape(fGroupBase) +
"\"/></td>\n"
+ + " </tr>\n"
+ + " <tr>\n"
+ + " <td class=\"description\"><nobr>" +
Messages.getBodyString(locale, "LDAP.GroupSearchFilterColon") + "</nobr></td>\n"
+ + " <td class=\"value\"><input type=\"text\" size=\"64\"
name=\"ldapGroupSearch\" value=\"" + Encoder.attributeEscape(fGroupSearch) +
"\"/></td>\n"
+ + " </tr>\n"
+ + " <tr>\n"
+ + " <td class=\"description\"><nobr>" +
Messages.getBodyString(locale, "LDAP.GroupNameAttributeColon") +
"</nobr></td>\n"
+ + " <td class=\"value\"><input type=\"text\" size=\"64\"
name=\"ldapGroupNameAttr\" value=\"" + Encoder.attributeEscape(fGroupNameAttr)
+ "\"/></td>\n"
+ + " </tr>\n"
+ + " <tr>\n"
+ + " <td class=\"description\"><nobr>" +
Messages.getBodyString(locale, "LDAP.GroupMemberDnColon") + "</nobr></td>\n"
+ + " <td class=\"value\"><input type=\"checkbox\" value=\"1\"
name=\"ldapGroupMemberDn\" " + (fGroupMemberDN ? "checked=\"true\"" : "") +
"/></td>\n"
+ + " </tr>\n"
+ + "</table>\n");
} else {
out.print("<input type=\"hidden\" name=\"ldapServerName\" value=\"" +
Encoder.attributeEscape(fServerName) + "\"/>\n");
out.print("<input type=\"hidden\" name=\"ldapServerPort\" value=\"" +
Encoder.attributeEscape(fServerPort) + "\"/>\n");
@@ -634,62 +624,64 @@ public class LDAPAuthority extends org.a
}
}
- private String getParam( ConfigParams parameters, String name, String def) {
+ private String getParam(ConfigParams parameters, String name, String def) {
return parameters.getParameter(name) != null ?
parameters.getParameter(name) : def;
}
- private String getViewParam( ConfigParams parameters, String name) {
+ private String getViewParam(ConfigParams parameters, String name) {
return parameters.getParameter(name) != null ?
parameters.getParameter(name) : "";
}
- private boolean copyParam( IPostParameters variableContext, ConfigParams
parameters, String name) {
- String val = variableContext.getParameter( name );
- if( val == null ){
+ private boolean copyParam(IPostParameters variableContext, ConfigParams
parameters, String name) {
+ String val = variableContext.getParameter(name);
+ if (val == null) {
return false;
}
- parameters.setParameter( name, val );
+ parameters.setParameter(name, val);
return true;
}
- private void copyParam2(IPostParameters variableContext, ConfigParams
parameters, String name) {
+ private boolean copyParam(IPostParameters variableContext, ConfigParams
parameters, String name, String def) {
String val = variableContext.getParameter(name);
if (val == null) {
- val = "";
+ val = def;
}
parameters.setParameter(name, val);
+ return true;
}
/**
- * Process a configuration post. This method is called at the start of the
- * authority connector's configuration page, whenever there is a possibility
- * that form data for a connection has been posted. Its purpose is to gather
- * form information and modify the configuration parameters accordingly. The
- * name of the posted form is "editconnection".
- *
- * @param threadContext is the local thread context.
- * @param variableContext is the set of variables available from the post,
- * including binary file post information.
- * @param parameters are the configuration parameters, as they currently
- * exist, for this connection being configured.
- * @return null if all is well, or a string error message if there is an
- * error that should prevent saving of the connection (and cause a
- * redirection to an error page).
- */
+ * Process a configuration post. This method is called at the start of the
+ * authority connector's configuration page, whenever there is a possibility
+ * that form data for a connection has been posted. Its purpose is to gather
+ * form information and modify the configuration parameters accordingly. The
+ * name of the posted form is "editconnection".
+ *
+ * @param threadContext is the local thread context.
+ * @param variableContext is the set of variables available from the post,
+ * including binary file post information.
+ * @param parameters are the configuration parameters, as they currently
+ * exist, for this connection being configured.
+ * @return null if all is well, or a string error message if there is an
error
+ * that should prevent saving of the connection (and cause a redirection to
an
+ * error page).
+ */
@Override
public String processConfigurationPost(IThreadContext threadContext,
IPostParameters variableContext, Locale locale, ConfigParams parameters)
throws ManifoldCFException {
- copyParam(variableContext, parameters, "ldapServerName" );
- copyParam(variableContext, parameters, "ldapServerPort" );
- copyParam(variableContext, parameters, "ldapServerBase" );
- copyParam(variableContext, parameters, "ldapUserBase" );
- copyParam(variableContext, parameters, "ldapUserSearch" );
- copyParam(variableContext, parameters, "ldapUserNameAttr" );
- copyParam(variableContext, parameters, "ldapGroupBase" );
- copyParam(variableContext, parameters, "ldapGroupSearch" );
- copyParam(variableContext, parameters, "ldapGroupNameAttr" );
-
- copyParam(variableContext, parameters, "ldapGroupMemberDn");
- copyParam(variableContext, parameters, "ldapAddUserRecord");
+ copyParam(variableContext, parameters, "ldapServerName");
+ copyParam(variableContext, parameters, "ldapServerPort");
+ copyParam(variableContext, parameters, "ldapServerBase");
+ copyParam(variableContext, parameters, "ldapUserBase");
+ copyParam(variableContext, parameters, "ldapUserSearch");
+ copyParam(variableContext, parameters, "ldapUserNameAttr");
+ copyParam(variableContext, parameters, "ldapGroupBase");
+ copyParam(variableContext, parameters, "ldapGroupSearch");
+ copyParam(variableContext, parameters, "ldapGroupNameAttr");
+
+ copyParam(variableContext, parameters, "ldapGroupMemberDn", "0");
//checkbox boolean value
+ copyParam(variableContext, parameters, "ldapAddUserRecord", "0");
//checkbox boolean value
+
copyParam(variableContext, parameters, "ldapBindUser");
String bindPass = variableContext.getParameter("ldapBindPass");
if (bindPass != null) {
@@ -700,106 +692,91 @@ public class LDAPAuthority extends org.a
}
/**
- * View configuration. This method is called in the body section of the
- * authority connector's view configuration page. Its purpose is to present
- * the connection information to the user. The coder can presume that the
- * HTML that is output from this configuration will be within appropriate
- * <html> and <body> tags.
- *
- * @param threadContext is the local thread context.
- * @param out is the output to which any HTML should be sent.
- * @param parameters are the configuration parameters, as they currently
- * exist, for this connection being configured.
- */
+ * View configuration. This method is called in the body section of the
+ * authority connector's view configuration page. Its purpose is to present
+ * the connection information to the user. The coder can presume that the
HTML
+ * that is output from this configuration will be within appropriate <html>
+ * and <body> tags.
+ *
+ * @param threadContext is the local thread context.
+ * @param out is the output to which any HTML should be sent.
+ * @param parameters are the configuration parameters, as they currently
+ * exist, for this connection being configured.
+ */
@Override
public void viewConfiguration(IThreadContext threadContext, IHTTPOutput out,
Locale locale, ConfigParams parameters)
throws ManifoldCFException, IOException {
- String f_serverName = getViewParam( parameters, "ldapServerName" );
- String f_serverPort = getViewParam( parameters, "ldapServerPort" );
- String f_serverBase = getViewParam( parameters, "ldapServerBase" );
+ String f_serverName = getViewParam(parameters, "ldapServerName");
+ String f_serverPort = getViewParam(parameters, "ldapServerPort");
+ String f_serverBase = getViewParam(parameters, "ldapServerBase");
String f_bindUser = getViewParam(parameters, "ldapBindUser");
- String f_userBase = getViewParam( parameters, "ldapUserBase" );
- String f_userSearch = getViewParam( parameters, "ldapUserSearch" );
- String f_groupBase = getViewParam( parameters, "ldapGroupBase" );
- String f_groupSearch = getViewParam( parameters, "ldapGroupSearch" );
- String f_groupNameAttr = getViewParam( parameters, "ldapGroupNameAttr" );
-
+ String f_userBase = getViewParam(parameters, "ldapUserBase");
+ String f_userSearch = getViewParam(parameters, "ldapUserSearch");
+ String f_groupBase = getViewParam(parameters, "ldapGroupBase");
+ String f_groupSearch = getViewParam(parameters, "ldapGroupSearch");
+ String f_groupNameAttr = getViewParam(parameters, "ldapGroupNameAttr");
+
String f_userNameAttr = getViewParam(parameters, "ldapUserNameAttr");
boolean f_groupMemberDN = "1".equals(getViewParam(parameters,
"ldapGroupMemberDn"));
boolean f_addUserRecord = "1".equals(getViewParam(parameters,
"ldapAddUserRecord"));
out.print(
-"<table class=\"displaytable\">\n"+
-" <tr><td class=\"separator\" colspan=\"2\"><hr/></td></tr>\n"+
-
-" <tr>\n"+
-" <td
class=\"description\"><nobr>"+Messages.getBodyString(locale,"LDAP.LDAPServerNameColon")+"</nobr></td>\n"+
-" <td class=\"value\">"+Encoder.bodyEscape(f_serverName)+"</td>\n"+
-" </tr>\n"+
-
-" <tr>\n"+
-" <td
class=\"description\"><nobr>"+Messages.getBodyString(locale,"LDAP.LDAPServerPortColon")+"</nobr></td>\n"+
-" <td class=\"value\">"+Encoder.bodyEscape(f_serverPort)+"</td>\n"+
-" </tr>\n"+
-
-" <tr>\n"+
-" <td
class=\"description\"><nobr>"+Messages.getBodyString(locale,"LDAP.LDAPServerBaseColon")+"</nobr></td>\n"+
-" <td class=\"value\">"+Encoder.bodyEscape(f_serverBase)+"</td>\n"+
-" </tr>\n"+
-
-" <tr>\n"+
-" <td
class=\"description\"><nobr>"+Messages.getBodyString(locale,"LDAP.LDAPBindUserColon")+"</nobr></td>\n"+
-" <td class=\"value\">"+Encoder.bodyEscape(f_bindUser)+"</td>\n"+
-" </tr>\n"+
-
-" <tr>\n"+
-" <td
class=\"description\"><nobr>"+Messages.getBodyString(locale,"LDAP.LDAPBindPasswordColon")+"</nobr></td>\n"+
-" <td class=\"value\">*******</td>\n"+
-" </tr>\n"+
-
-" <tr>\n"+
-" <td
class=\"description\"><nobr>"+Messages.getBodyString(locale,"LDAP.UserSearchBaseColon")+"</nobr></td>\n"+
-" <td class=\"value\">"+Encoder.bodyEscape(f_userBase)+"</td>\n"+
-" </tr>\n"+
-
-" <tr>\n"+
-" <td
class=\"description\"><nobr>"+Messages.getBodyString(locale,"LDAP.UserSearchFilterColon")+"</nobr></td>\n"+
-" <td class=\"value\">"+Encoder.bodyEscape(f_userSearch)+"</td>\n"+
-" </tr>\n"+
-
-" <tr>\n"+
-" <td
class=\"description\"><nobr>"+Messages.getBodyString(locale,"LDAP.AddUserAuthColon")+"</nobr></td>\n"+
-" <td class=\"value\">" + (f_addUserRecord ? "Y" : "N") + "</td>\n"+
-" </tr>\n"+
-
-" <tr>\n"+
-" <td
class=\"description\"><nobr>"+Messages.getBodyString(locale,"LDAP.UserNameAttrColon")+"</nobr></td>\n"+
-" <td class=\"value\">" + Encoder.bodyEscape(f_userNameAttr) + "</td>\n"+
-" </tr>\n"+
-
-" <tr>\n"+
-" <td
class=\"description\"><nobr>"+Messages.getBodyString(locale,"LDAP.GroupSearchBaseColon")+"</nobr></td>\n"+
-" <td class=\"value\">"+Encoder.bodyEscape(f_groupBase)+"</td>\n"+
-" </tr>\n"+
-
-" <tr>\n"+
-" <td
class=\"description\"><nobr>"+Messages.getBodyString(locale,"LDAP.GroupSearchFilterColon")+"</nobr></td>\n"+
-" <td class=\"value\">"+Encoder.bodyEscape(f_groupSearch)+"</td>\n"+
-" </tr>\n"+
-
-" <tr>\n"+
-" <td
class=\"description\"><nobr>"+Messages.getBodyString(locale,"LDAP.GroupNameAttributeColon")+"</nobr></td>\n"+
-" <td class=\"value\">"+Encoder.bodyEscape(f_groupNameAttr)+"</td>\n"+
-" </tr>\n"+
-
-" <tr>\n"+
-" <td
class=\"description\"><nobr>"+Messages.getBodyString(locale,"LDAP.GroupMemberDnColon")+"</nobr></td>\n"+
-" <td class=\"value\">"+(f_groupMemberDN?"Y":"N")+"</td>\n"+
-" </tr>\n"+
-
-"</table>\n"
- );
+ "<table class=\"displaytable\">\n"
+ + " <tr><td class=\"separator\" colspan=\"2\"><hr/></td></tr>\n"
+ + " <tr>\n"
+ + " <td class=\"description\"><nobr>" + Messages.getBodyString(locale,
"LDAP.LDAPServerNameColon") + "</nobr></td>\n"
+ + " <td class=\"value\">" + Encoder.bodyEscape(f_serverName) + "</td>\n"
+ + " </tr>\n"
+ + " <tr>\n"
+ + " <td class=\"description\"><nobr>" + Messages.getBodyString(locale,
"LDAP.LDAPServerPortColon") + "</nobr></td>\n"
+ + " <td class=\"value\">" + Encoder.bodyEscape(f_serverPort) + "</td>\n"
+ + " </tr>\n"
+ + " <tr>\n"
+ + " <td class=\"description\"><nobr>" + Messages.getBodyString(locale,
"LDAP.LDAPServerBaseColon") + "</nobr></td>\n"
+ + " <td class=\"value\">" + Encoder.bodyEscape(f_serverBase) + "</td>\n"
+ + " </tr>\n"
+ + " <tr>\n"
+ + " <td class=\"description\"><nobr>" + Messages.getBodyString(locale,
"LDAP.LDAPBindUserColon") + "</nobr></td>\n"
+ + " <td class=\"value\">" + Encoder.bodyEscape(f_bindUser) + "</td>\n"
+ + " </tr>\n"
+ + " <tr>\n"
+ + " <td class=\"description\"><nobr>" + Messages.getBodyString(locale,
"LDAP.LDAPBindPasswordColon") + "</nobr></td>\n"
+ + " <td class=\"value\">*******</td>\n"
+ + " </tr>\n"
+ + " <tr>\n"
+ + " <td class=\"description\"><nobr>" + Messages.getBodyString(locale,
"LDAP.UserSearchBaseColon") + "</nobr></td>\n"
+ + " <td class=\"value\">" + Encoder.bodyEscape(f_userBase) + "</td>\n"
+ + " </tr>\n"
+ + " <tr>\n"
+ + " <td class=\"description\"><nobr>" + Messages.getBodyString(locale,
"LDAP.UserSearchFilterColon") + "</nobr></td>\n"
+ + " <td class=\"value\">" + Encoder.bodyEscape(f_userSearch) + "</td>\n"
+ + " </tr>\n"
+ + " <tr>\n"
+ + " <td class=\"description\"><nobr>" + Messages.getBodyString(locale,
"LDAP.AddUserAuthColon") + "</nobr></td>\n"
+ + " <td class=\"value\">" + (f_addUserRecord ? "Y" : "N") + "</td>\n"
+ + " </tr>\n"
+ + " <tr>\n"
+ + " <td class=\"description\"><nobr>" + Messages.getBodyString(locale,
"LDAP.UserNameAttrColon") + "</nobr></td>\n"
+ + " <td class=\"value\">" + Encoder.bodyEscape(f_userNameAttr) +
"</td>\n"
+ + " </tr>\n"
+ + " <tr>\n"
+ + " <td class=\"description\"><nobr>" + Messages.getBodyString(locale,
"LDAP.GroupSearchBaseColon") + "</nobr></td>\n"
+ + " <td class=\"value\">" + Encoder.bodyEscape(f_groupBase) + "</td>\n"
+ + " </tr>\n"
+ + " <tr>\n"
+ + " <td class=\"description\"><nobr>" + Messages.getBodyString(locale,
"LDAP.GroupSearchFilterColon") + "</nobr></td>\n"
+ + " <td class=\"value\">" + Encoder.bodyEscape(f_groupSearch) +
"</td>\n"
+ + " </tr>\n"
+ + " <tr>\n"
+ + " <td class=\"description\"><nobr>" + Messages.getBodyString(locale,
"LDAP.GroupNameAttributeColon") + "</nobr></td>\n"
+ + " <td class=\"value\">" + Encoder.bodyEscape(f_groupNameAttr) +
"</td>\n"
+ + " </tr>\n"
+ + " <tr>\n"
+ + " <td class=\"description\"><nobr>" + Messages.getBodyString(locale,
"LDAP.GroupMemberDnColon") + "</nobr></td>\n"
+ + " <td class=\"value\">" + (f_groupMemberDN ? "Y" : "N") + "</td>\n"
+ + " </tr>\n"
+ + "</table>\n");
}
// Protected methods
@@ -810,12 +787,12 @@ public class LDAPAuthority extends org.a
* @param userName (Domain Logon Name) is the user name or identifier.
* @param searchBase (Full Domain Name for the search ie:
* DC=qa-ad-76,DC=metacarta,DC=com)
- * @return SearchResult for given domain user logon name. (Should throws
- * an exception if user is not found.)
+ * @return SearchResult for given domain user logon name. (Should throws an
+ * exception if user is not found.)
*/
protected SearchResult getUserEntry(LdapContext ctx, String userName)
throws ManifoldCFException {
- String searchFilter = userSearch.replaceAll("\\{0\\}", escapeDN(userName));
+ String searchFilter = userSearch.replaceAll("\\{0\\}",
escapeDN(userName.split("@")[0]));
SearchControls searchCtls = new SearchControls();
searchCtls.setSearchScope(SearchControls.SUBTREE_SCOPE);
@@ -915,7 +892,6 @@ public class LDAPAuthority extends org.a
}
return sb.toString();
}
-
protected static StringSet emptyStringSet = new StringSet();
/**
Added:
manifoldcf/trunk/connectors/ldap/connector/src/main/native2ascii/org/apache/manifoldcf/authorities/authorities/ldap/common_pl_PL.properties
URL:
http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/ldap/connector/src/main/native2ascii/org/apache/manifoldcf/authorities/authorities/ldap/common_pl_PL.properties?rev=1496653&view=auto
==============================================================================
---
manifoldcf/trunk/connectors/ldap/connector/src/main/native2ascii/org/apache/manifoldcf/authorities/authorities/ldap/common_pl_PL.properties
(added)
+++
manifoldcf/trunk/connectors/ldap/connector/src/main/native2ascii/org/apache/manifoldcf/authorities/authorities/ldap/common_pl_PL.properties
Tue Jun 25 22:05:04 2013
@@ -0,0 +1,50 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+LDAP.LDAP=LDAP
+LDAP.LDAPServerNameColon=Serwer LDAP:
+LDAP.LDAPServerPortColon=Port LDAP:
+LDAP.LDAPServerBaseColon=Baza DN (np. 'dc=office,dc=com'):
+LDAP.LDAPBindUserColon=Pod\u0142\u0105cz do serwera jako u\u017cytkownik
(pozostaw puste je\u015bli niepotrzebne):
+LDAP.LDAPBindPasswordColon=Pod\u0142\u0105cz do serwera z has\u0142em:
+LDAP.UserSearchBaseColon=Baza wyszukiwania u\u017cytkownik\u00f3w:
+LDAP.UserSearchFilterColon=Filtr u\u017cytkownik\u00f3w:
+LDAP.GroupSearchBaseColon=Baza wyszukiwania grup:
+LDAP.GroupSearchFilterColon=Filtr grup:
+LDAP.GroupNameAttributeColon=Atrybut nazwy grupy:
+LDAP.AddUserAuthColon=Dodaj nazw\u0119 u\u017cytkownika jako token:
+LDAP.UserNameAttrColon=Atrybut nazwy u\u017cytkownika:
+LDAP.GroupMemberDnColon=Elementy atrybutu "member" s\u0105 w postaci DN:
+
+LDAP.ServerNameCannotBeBlank=Nazwa serwera nie mo\u017ce by\u0107 pusta
+LDAP.ServerPortCannotBeBlank=Port nie mo\u017ce by\u0107 pusty
+LDAP.UserSearchCannotBeBlank=Filtr u\u017cytkownik\u00f3w nie mo\u017ce
by\u0107 pusty
+LDAP.GroupSearchCannotBeBlank=Filtr grup nie mo\u017ce by\u0107 pusty
+LDAP.GroupNameAttrCannotBeBlank=Atrybut nazwy grupy nie mo\u017ce by\u0107
pusty
+LDAP.UserSearchMustIncludeSubstitution=Filtr u\u017cytkownik\u00f3w musi
zawiera\u0107 odwo\u0142anie do nazwy u\u017cytkownika ({0})
+LDAP.GroupSearchMustIncludeSubstitution=Filtr grupy musi zawiera\u0107
odwo\u0142anie do nazwy u\u017cytkownika ({0})
+LDAP.ServerPortMustBeAnInteger=Port musi by\u0107 liczb\u0105
ca\u0142kowit\u0105
+LDAP.ServerNameCannotIncludeSlash=Nazwa serwera nie mo\u017ce zawiera\u0107
znaku "/"
+LDAP.ServerBaseCannotIncludeSlash=Baza DN nie mo\u017ce zawiera\u0107 znaku "/"
+
+
+
+
+
+
+
+
+
+