Well, OK, if you use both LDAP and Password authentication, there is something that you can configure and you can make it work with both authentication methods, but it is a bit more complicated.
We use the same dual configuration in our institution for many years now, for 3 DSpace installations with two different versions (5.6 and 6.3). However, in our case we have now disabled the manual registration and users are registering only via LDAP, which is a separate server. The Password authentication in this case is only for old users, when the manual registration was still permitted.
In order to make the system display the "manual user registration" for users that want to register via the DSpace instance and NOT having their credentials in the LDAP Server and also to make the system display ONE login form for BOTH authentication methods when the users try to connect, you have to do the following:
At first lets begin with the reason that the system displays the "new-user-ldap.jsp" form when users are trying to register and also the "chooser.jsp" form when they try to login, making them choose with which method they wish to authenticate.
The reason is because in the file /dspace/config/modules/authentication-ldap.cfg you have enabled the setting authentication-ldap.enable, by setting it to true. The reason that the new-user-ldap.jsp and the chooser.jsp pages are displayed upon registering and logging in, is this setting, which is checked before they are loaded. You have to set this setting to false.
However, in order to make both the authentication methods to work, you will then have to go into the file /dspace/config/modules/authentication.cfg and enable both authentication methods (i.e. LDAP and PasswordAuthentication) as follows. These settings for your installation, might be enabled in the /dspace/config/local.cfg file, so check if they are also there and disable them from one place or another. I recommend to have them in the authentication.cfg file:
/dspace/config/modules/authentication.cfg
# IP-based authentication/authorization. See authentication-ip.cfg for default configuration.
#plugin.sequence.org.dspace.authenticate.AuthenticationMethod = org.dspace.authenticate.IPAuthentication
# LDAP authentication/authorization. See authentication-ldap.cfg for default configuration.
plugin.sequence.org.dspace.authenticate.AuthenticationMethod = org.dspace.authenticate.LDAPAuthentication
# Shibboleth authentication/authorization. See authentication-shibboleth.cfg for default configuration.
#plugin.sequence.org.dspace.authenticate.AuthenticationMethod = org.dspace.authenticate.ShibAuthentication
# X.509 certificate authentication. See authentication-x509.cfg for default configuration.
#plugin.sequence.org.dspace.authenticate.AuthenticationMethod = org.dspace.authenticate.X509Authentication
# Authentication by Password (encrypted in DSpace's database). See authentication-password.cfg for default configuration.
# Enabled by default (to disable, either comment out, or define a new list of AuthenticationMethod plugins in your local.cfg)
plugin.sequence.org.dspace.authenticate.AuthenticationMethod = org.dspace.authenticate.PasswordAuthentication
Now, you also have to replace the class file /dspace/webapps/jspui/WEB-INF/classes/org/dspace/app/webui/util/Authenticate.class with the one I send you. This patched class does not display the chooser.jsp form when the users try to login, but redirects them to the /dspace/ldap-login page. Then, upon their login, since you have enabled BOTH the authentication methods in the authentication.cfg file, it will try both of them in the order they are configured. If your ldap-login page is in a different location than that, then please inform me so as to send you the correct one. However, the default is the one I send you.
Finally, since an LDAP user does not have the option to change his/her password, you do not want them to be able to do that in case they have logged in with LDAP, but only with password authentication. Also, you should also be able to see their netid (i.e. LDAP name) and not be able to change their password from the edit-user.jsp administration page only if they have registered as LDAP users. Since these textboxes and information depend on the authentication-ldap.enable setting and if it is false it considers all the users as PasswordAuthentication users, then you have to tweak two additional jsp files that have to do with this information.
The first has to do with the user's profile. You do not want the "New Password" and "Confirm Password" to be displayed in the manage my profile of a user, if that user is an LDAP user. For this to work, you have to insert code that actually ignores the "ldap_enabled" setting in case a user is an LDAP user. You have to edit the file /dspace/webapps/jspui/register/edit-profile.jsp and at the top tweak the code with the portion that I am sending you:
boolean ldap_enabled = ConfigurationManager.getBooleanProperty("authentication-ldap", "enable");
//Filippos Kolovos -- Do not check for the ldap_enabled field, since it is not enabled in the cfg file,
//because it leads to a different login page, which is not used.
//boolean ldap_eperson = (ldap_enabled && (eperson.getNetid() != null) && (eperson.getNetid().equals("") == false));
boolean ldap_eperson = ((eperson.getNetid() != null) && (eperson.getNetid().equals("") == false));
and then some lines below, check for the "not an LDAP user" in order to display the password change box:
....
....
<%
// Only show password update section if the user doesn't use
// certificates
if ((eperson.getRequireCertificate() == false) && (ldap_eperson == false))
{
%>
That will take care of the user's profile management. Then, you also have to edit the jsp file: /dspace/webapps/dspace-admin/eperson-edit.jsp and again at the top insert the following code:
boolean ldap_enabled = ConfigurationManager.getBooleanProperty("authentication-ldap", "enable");
//Filippos Kolovos -- Do not check for the ldap_enabled field, since it is not enabled in the cfg file,
//because it leads to a different login page, which is not used.
boolean ldap_eperson = ((eperson.getNetid() != null) && (eperson.getNetid().equals("") == false));
and again some lines below, replace the "ldap_enabled" check with "ldap_eperson" check, in order to DISPLAY to the administrator the LDAP Net ID and NOT to display the reset password for this user if he/she is an LDAP user and vice versa if he/she is a Password user:
Around Line 128:
<% if (ldap_eperson) { %>
<div class="row">
<label class="col-md-2">LDAP NetID:</label>
<div class="col-md-6">
<input class="form-control" name="netid" size="24" value="<%=netid == null ? "" : Utils.addEntities(netid) %>" />
</div>
</div>
<% } %>
Around Line 189:
<div class="col-md-4 btn-group">
<%-- <input type="submit" name="submit_save" value="Save Edits"> --%>
<input class="btn btn-default" type="submit" name="submit_save" value="<fmt:message key="jsp.dspace-admin.general.save"/>" />
<% // Filippos Kolovos -- Reset the password only for non-ldap users
if (!ldap_eperson) { %>
<input class="btn btn-default" type="submit" name="submit_resetpassword" value="<fmt:message key="jsp.dspace-admin.eperson-main.ResetPassword.submit"/>"/>
<% } %>
<%-- <input type="submit" name="submit_delete" value="Delete EPerson..."> --%>
<input class="btn btn-danger" type="submit" name="submit_delete" value="<fmt:message key="jsp.dspace-admin.general.delete"/>" />
</div>
Then, restart tomcat and you will be good to go.
I think that this does it. Please keep a backup of any files that you replace in order for you to be able to go back to the previous setting.
I hope that this helps you.
Best Regards,
-Fk