mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 05:31:22 +00:00
Remove TODOs, replace with logging.
This commit is contained in:
@@ -52,6 +52,8 @@ import net.sourceforge.guacamole.net.auth.ldap.properties.LDAPGuacamolePropertie
|
|||||||
import net.sourceforge.guacamole.net.auth.simple.SimpleAuthenticationProvider;
|
import net.sourceforge.guacamole.net.auth.simple.SimpleAuthenticationProvider;
|
||||||
import net.sourceforge.guacamole.properties.GuacamoleProperties;
|
import net.sourceforge.guacamole.properties.GuacamoleProperties;
|
||||||
import net.sourceforge.guacamole.protocol.GuacamoleConfiguration;
|
import net.sourceforge.guacamole.protocol.GuacamoleConfiguration;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows users to be authenticated against an LDAP server. Each user may have
|
* Allows users to be authenticated against an LDAP server. Each user may have
|
||||||
@@ -61,7 +63,12 @@ import net.sourceforge.guacamole.protocol.GuacamoleConfiguration;
|
|||||||
* @author Michael Jumper
|
* @author Michael Jumper
|
||||||
*/
|
*/
|
||||||
public class LDAPAuthenticationProvider extends SimpleAuthenticationProvider {
|
public class LDAPAuthenticationProvider extends SimpleAuthenticationProvider {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logger for this class.
|
||||||
|
*/
|
||||||
|
private Logger logger = LoggerFactory.getLogger(LDAPAuthenticationProvider.class);
|
||||||
|
|
||||||
// Courtesy of OWASP: https://www.owasp.org/index.php/Preventing_LDAP_Injection_in_Java
|
// Courtesy of OWASP: https://www.owasp.org/index.php/Preventing_LDAP_Injection_in_Java
|
||||||
private static String escapeLDAPSearchFilter(String filter) {
|
private static String escapeLDAPSearchFilter(String filter) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
@@ -138,14 +145,14 @@ public class LDAPAuthenticationProvider extends SimpleAuthenticationProvider {
|
|||||||
|
|
||||||
// Require username
|
// Require username
|
||||||
if (credentials.getUsername() == null) {
|
if (credentials.getUsername() == null) {
|
||||||
// TODO: log "LDAP authentication requires a username."
|
logger.info("Anonymous bind is not currently allowed by the LDAP authentication provider.");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Require password, and do not allow anonymous binding
|
// Require password, and do not allow anonymous binding
|
||||||
if (credentials.getPassword() == null
|
if (credentials.getPassword() == null
|
||||||
|| credentials.getPassword().length() == 0) {
|
|| credentials.getPassword().length() == 0) {
|
||||||
// TODO: log "LDAP authentication requires a password."
|
logger.info("Anonymous bind is not currently allowed by the LDAP authentication provider.");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user