mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 05:07:41 +00:00
Fixed MD5 auth
This commit is contained in:
@@ -94,8 +94,7 @@ public class BasicLogin extends HttpServlet {
|
|||||||
if (info != null) {
|
if (info != null) {
|
||||||
|
|
||||||
// Validate username and password
|
// Validate username and password
|
||||||
if (info.getAuthorizedUsername().equals(username)
|
if (info.validate(username, password)) {
|
||||||
&& info.getAuthorizedPassword().equals(password)) {
|
|
||||||
|
|
||||||
// Store authorized configuration
|
// Store authorized configuration
|
||||||
HttpSession session = req.getSession(true);
|
HttpSession session = req.getSession(true);
|
||||||
|
@@ -40,14 +40,6 @@ public class BasicUserMappingContentHandler extends DefaultHandler {
|
|||||||
this.auth_encoding = auth_encoding;
|
this.auth_encoding = auth_encoding;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAuthorizedUsername() {
|
|
||||||
return auth_username;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAuthorizedPassword() {
|
|
||||||
return auth_password;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final char HEX_CHARS[] = {
|
private static final char HEX_CHARS[] = {
|
||||||
'0', '1', '2', '3', '4', '5', '6', '7',
|
'0', '1', '2', '3', '4', '5', '6', '7',
|
||||||
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
|
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
|
||||||
@@ -87,7 +79,7 @@ public class BasicUserMappingContentHandler extends DefaultHandler {
|
|||||||
try {
|
try {
|
||||||
MessageDigest digest = MessageDigest.getInstance("MD5");
|
MessageDigest digest = MessageDigest.getInstance("MD5");
|
||||||
String hashedPassword = getHexString(digest.digest(password.getBytes()));
|
String hashedPassword = getHexString(digest.digest(password.getBytes()));
|
||||||
return hashedPassword.equals(auth_password);
|
return hashedPassword.equals(auth_password.toUpperCase());
|
||||||
}
|
}
|
||||||
catch (NoSuchAlgorithmException e) {
|
catch (NoSuchAlgorithmException e) {
|
||||||
throw new UnsupportedOperationException("Unexpected lack of MD5 support.", e);
|
throw new UnsupportedOperationException("Unexpected lack of MD5 support.", e);
|
||||||
@@ -137,7 +129,7 @@ public class BasicUserMappingContentHandler extends DefaultHandler {
|
|||||||
|
|
||||||
// Finalize mapping for this user
|
// Finalize mapping for this user
|
||||||
authMapping.put(
|
authMapping.put(
|
||||||
current.getAuthorizedUsername(),
|
current.auth_username,
|
||||||
current
|
current
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user