mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
Remove whitespace errors.
This commit is contained in:
@@ -68,7 +68,7 @@ public class LDAPAuthenticationProvider extends SimpleAuthenticationProvider {
|
|||||||
* Logger for this class.
|
* Logger for this class.
|
||||||
*/
|
*/
|
||||||
private Logger logger = LoggerFactory.getLogger(LDAPAuthenticationProvider.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();
|
||||||
@@ -137,12 +137,12 @@ public class LDAPAuthenticationProvider extends SimpleAuthenticationProvider {
|
|||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, GuacamoleConfiguration> getAuthorizedConfigurations(Credentials credentials) throws GuacamoleException {
|
public Map<String, GuacamoleConfiguration> getAuthorizedConfigurations(Credentials credentials) throws GuacamoleException {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// Require username
|
// Require username
|
||||||
if (credentials.getUsername() == null) {
|
if (credentials.getUsername() == null) {
|
||||||
logger.info("Anonymous bind is not currently allowed by the LDAP authentication provider.");
|
logger.info("Anonymous bind is not currently allowed by the LDAP authentication provider.");
|
||||||
@@ -155,7 +155,7 @@ public class LDAPAuthenticationProvider extends SimpleAuthenticationProvider {
|
|||||||
logger.info("Anonymous bind is not currently allowed by the LDAP authentication provider.");
|
logger.info("Anonymous bind is not currently allowed by the LDAP authentication provider.");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Connect to LDAP server
|
// Connect to LDAP server
|
||||||
LDAPConnection ldapConnection = new LDAPConnection();
|
LDAPConnection ldapConnection = new LDAPConnection();
|
||||||
ldapConnection.connect(
|
ldapConnection.connect(
|
||||||
@@ -172,12 +172,12 @@ public class LDAPAuthenticationProvider extends SimpleAuthenticationProvider {
|
|||||||
String user_base_dn = GuacamoleProperties.getRequiredProperty(
|
String user_base_dn = GuacamoleProperties.getRequiredProperty(
|
||||||
LDAPGuacamoleProperties.LDAP_USER_BASE_DN
|
LDAPGuacamoleProperties.LDAP_USER_BASE_DN
|
||||||
);
|
);
|
||||||
|
|
||||||
// Construct user DN
|
// Construct user DN
|
||||||
String user_dn =
|
String user_dn =
|
||||||
escapeDN(username_attribute) + "=" + escapeDN(credentials.getUsername())
|
escapeDN(username_attribute) + "=" + escapeDN(credentials.getUsername())
|
||||||
+ "," + user_base_dn;
|
+ "," + user_base_dn;
|
||||||
|
|
||||||
// Bind as user
|
// Bind as user
|
||||||
try {
|
try {
|
||||||
ldapConnection.bind(
|
ldapConnection.bind(
|
||||||
@@ -189,7 +189,7 @@ public class LDAPAuthenticationProvider extends SimpleAuthenticationProvider {
|
|||||||
catch (UnsupportedEncodingException e) {
|
catch (UnsupportedEncodingException e) {
|
||||||
throw new GuacamoleException(e);
|
throw new GuacamoleException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get config base DN
|
// Get config base DN
|
||||||
String config_base_dn = GuacamoleProperties.getRequiredProperty(
|
String config_base_dn = GuacamoleProperties.getRequiredProperty(
|
||||||
LDAPGuacamoleProperties.LDAP_CONFIG_BASE_DN
|
LDAPGuacamoleProperties.LDAP_CONFIG_BASE_DN
|
||||||
@@ -207,7 +207,7 @@ public class LDAPAuthenticationProvider extends SimpleAuthenticationProvider {
|
|||||||
// Add all configs
|
// Add all configs
|
||||||
Map<String, GuacamoleConfiguration> configs = new TreeMap<String, GuacamoleConfiguration>();
|
Map<String, GuacamoleConfiguration> configs = new TreeMap<String, GuacamoleConfiguration>();
|
||||||
while (results.hasMore()) {
|
while (results.hasMore()) {
|
||||||
|
|
||||||
LDAPEntry entry = results.next();
|
LDAPEntry entry = results.next();
|
||||||
|
|
||||||
// New empty configuration
|
// New empty configuration
|
||||||
@@ -245,13 +245,13 @@ public class LDAPAuthenticationProvider extends SimpleAuthenticationProvider {
|
|||||||
String value = parameter.substring(equals+1);
|
String value = parameter.substring(equals+1);
|
||||||
|
|
||||||
config.setParameter(name, value);
|
config.setParameter(name, value);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store config by CN
|
// Store config by CN
|
||||||
configs.put(cn.getStringValue(), config);
|
configs.put(cn.getStringValue(), config);
|
||||||
|
|
||||||
@@ -260,12 +260,12 @@ public class LDAPAuthenticationProvider extends SimpleAuthenticationProvider {
|
|||||||
// Disconnect
|
// Disconnect
|
||||||
ldapConnection.disconnect();
|
ldapConnection.disconnect();
|
||||||
return configs;
|
return configs;
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (LDAPException e) {
|
catch (LDAPException e) {
|
||||||
throw new GuacamoleException(e);
|
throw new GuacamoleException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user