Commit 459e99fc authored by Matt Tucker's avatar Matt Tucker Committed by matt

Fixed logic for authenticating passwords.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@4645 b35dd754-fafc-0310-a699-88a17e54d16e
parent 68b57843
...@@ -100,7 +100,7 @@ public class JDBCAuthProvider implements AuthProvider { ...@@ -100,7 +100,7 @@ public class JDBCAuthProvider implements AuthProvider {
username = username.trim().toLowerCase(); username = username.trim().toLowerCase();
String userPassword; String userPassword;
try { try {
userPassword = getPassword(username); userPassword = getPasswordValue(username);
} }
catch (UserNotFoundException unfe) { catch (UserNotFoundException unfe) {
throw new UnauthorizedException(); throw new UnauthorizedException();
...@@ -134,7 +134,7 @@ public class JDBCAuthProvider implements AuthProvider { ...@@ -134,7 +134,7 @@ public class JDBCAuthProvider implements AuthProvider {
username = username.trim().toLowerCase(); username = username.trim().toLowerCase();
String password; String password;
try { try {
password = getPassword(username); password = getPasswordValue(username);
} }
catch (UserNotFoundException unfe) { catch (UserNotFoundException unfe) {
throw new UnauthorizedException(); throw new UnauthorizedException();
...@@ -164,6 +164,27 @@ public class JDBCAuthProvider implements AuthProvider { ...@@ -164,6 +164,27 @@ public class JDBCAuthProvider implements AuthProvider {
if (!supportsPasswordRetrieval()) { if (!supportsPasswordRetrieval()) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
return getPasswordValue(username);
}
public void setPassword(String username, String password)
throws UserNotFoundException, UnsupportedOperationException
{
throw new UnsupportedOperationException();
}
public boolean supportsPasswordRetrieval() {
return (passwordSQL != null && passwordType == PasswordType.plain);
}
/**
* Returns the value of the password field. It will be in plain text or hashed
* format, depending on the password type.
*
* @return the password value.
* @throws UserNotFoundException if the given user could not be loaded.
*/
private String getPasswordValue(String username) throws UserNotFoundException {
String password = null; String password = null;
Connection con = null; Connection con = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
...@@ -192,16 +213,6 @@ public class JDBCAuthProvider implements AuthProvider { ...@@ -192,16 +213,6 @@ public class JDBCAuthProvider implements AuthProvider {
return password; return password;
} }
public void setPassword(String username, String password)
throws UserNotFoundException, UnsupportedOperationException
{
throw new UnsupportedOperationException();
}
public boolean supportsPasswordRetrieval() {
return (passwordSQL != null && passwordType == PasswordType.plain);
}
/** /**
* Indicates how the password is stored. * Indicates how the password is stored.
*/ */
......
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