mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 21:27:40 +00:00
GUACAMOLE-234: Tweaks to handling bind requests/failures.
This commit is contained in:
committed by
Virtually Nick
parent
742b0c4e65
commit
ed568b1f55
@@ -25,6 +25,8 @@ import org.apache.directory.api.ldap.model.exception.LdapException;
|
||||
import org.apache.directory.api.ldap.model.filter.ExprNode;
|
||||
import org.apache.directory.api.ldap.model.message.BindRequest;
|
||||
import org.apache.directory.api.ldap.model.message.BindRequestImpl;
|
||||
import org.apache.directory.api.ldap.model.message.BindResponse;
|
||||
import org.apache.directory.api.ldap.model.message.ResultCodeEnum;
|
||||
import org.apache.directory.api.ldap.model.message.SearchRequest;
|
||||
import org.apache.directory.api.ldap.model.message.SearchRequestImpl;
|
||||
import org.apache.directory.api.ldap.model.message.SearchScope;
|
||||
@@ -149,10 +151,15 @@ public class LDAPConnectionService {
|
||||
BindRequest bindRequest = new BindRequestImpl();
|
||||
bindRequest.setDn(userDN);
|
||||
bindRequest.setCredentials(password);
|
||||
ldapConnection.bind(bindRequest);
|
||||
if (ldapConnection.isConnected() && ldapConnection.isAuthenticated())
|
||||
BindResponse bindResponse = ldapConnection.bind(bindRequest);
|
||||
if (bindResponse.getLdapResult().getResultCode() == ResultCodeEnum.SUCCESS)
|
||||
return ldapConnection;
|
||||
|
||||
else
|
||||
throw new GuacamoleInvalidCredentialsException("Error binding"
|
||||
+ " to server: " + bindResponse.toString(),
|
||||
CredentialsInfo.USERNAME_PASSWORD);
|
||||
|
||||
}
|
||||
|
||||
// Disconnect if an error occurs during bind
|
||||
@@ -164,9 +171,6 @@ public class LDAPConnectionService {
|
||||
CredentialsInfo.USERNAME_PASSWORD);
|
||||
}
|
||||
|
||||
throw new GuacamoleInvalidCredentialsException("Authentication failed.",
|
||||
CredentialsInfo.USERNAME_PASSWORD);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user