Index: lams_central/src/java/org/lamsfoundation/lams/security/UniversalLoginModule.java =================================================================== RCS file: /usr/local/cvsroot/lams_central/src/java/org/lamsfoundation/lams/security/UniversalLoginModule.java,v diff -u -r1.17 -r1.18 --- lams_central/src/java/org/lamsfoundation/lams/security/UniversalLoginModule.java 31 Aug 2007 07:41:33 -0000 1.17 +++ lams_central/src/java/org/lamsfoundation/lams/security/UniversalLoginModule.java 11 Sep 2007 07:36:42 -0000 1.18 @@ -59,6 +59,7 @@ import org.lamsfoundation.lams.usermanagement.service.UserManagementService; import org.lamsfoundation.lams.util.Configuration; import org.lamsfoundation.lams.util.ConfigurationKeys; +import org.lamsfoundation.lams.util.HashUtil; import org.lamsfoundation.lams.web.session.SessionManager; import org.lamsfoundation.lams.web.util.AttributeNames; import org.lamsfoundation.lams.web.util.HttpSessionManager; @@ -150,6 +151,11 @@ user = service.getUserByLogin(username); } else if (AuthenticationMethodType.LAMS.equals(type)) { DatabaseAuthenticator authenticator = new DatabaseAuthenticator(dsJndiName, principalsQuery); + // if the password is not encrypted when sent from the jsp (e.g. when it is passed + // unencrypted to say, ldap) then encrypt it here when authenticating against local db + if (!Configuration.getAsBoolean(ConfigurationKeys.LDAP_ENCRYPT_PASSWORD_FROM_BROWSER)) { + inputPassword = HashUtil.sha1(inputPassword); + } isValid = authenticator.authenticate(username,inputPassword); } else if (AuthenticationMethodType.WEB_AUTH.equals(type)) { WebAuthAuthenticator authenticator = new WebAuthAuthenticator(); Index: lams_central/web/login.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/login.jsp,v diff -u -r1.31 -r1.32 --- lams_central/web/login.jsp 5 Jun 2007 05:53:07 -0000 1.31 +++ lams_central/web/login.jsp 11 Sep 2007 07:36:42 -0000 1.32 @@ -32,6 +32,7 @@ flash is searching for this string, so leave it!: j_security_login_page --> +<%= Configuration.getAsBoolean(ConfigurationKeys.LDAP_ENCRYPT_PASSWORD_FROM_BROWSER) %> <fmt:message key="title.login.window"/> @@ -46,8 +47,10 @@