mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 05:07:41 +00:00
GUAC-1170: Remove use of deprecated GuacamoleProperties.
This commit is contained in:
@@ -37,7 +37,6 @@ import org.glyptodon.guacamole.auth.jdbc.tunnel.UnrestrictedGuacamoleTunnelServi
|
||||
import org.glyptodon.guacamole.auth.jdbc.user.UserContextService;
|
||||
import org.glyptodon.guacamole.environment.Environment;
|
||||
import org.glyptodon.guacamole.environment.LocalEnvironment;
|
||||
import org.glyptodon.guacamole.properties.GuacamoleProperties;
|
||||
|
||||
/**
|
||||
* Provides a MySQL based implementation of the AuthenticationProvider
|
||||
|
@@ -36,8 +36,9 @@ import org.glyptodon.guacamole.GuacamoleException;
|
||||
import org.glyptodon.guacamole.net.auth.Credentials;
|
||||
import net.sourceforge.guacamole.net.auth.ldap.properties.LDAPGuacamoleProperties;
|
||||
import org.glyptodon.guacamole.GuacamoleServerException;
|
||||
import org.glyptodon.guacamole.environment.Environment;
|
||||
import org.glyptodon.guacamole.environment.LocalEnvironment;
|
||||
import org.glyptodon.guacamole.net.auth.simple.SimpleAuthenticationProvider;
|
||||
import org.glyptodon.guacamole.properties.GuacamoleProperties;
|
||||
import org.glyptodon.guacamole.protocol.GuacamoleConfiguration;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -56,6 +57,23 @@ public class LDAPAuthenticationProvider extends SimpleAuthenticationProvider {
|
||||
*/
|
||||
private Logger logger = LoggerFactory.getLogger(LDAPAuthenticationProvider.class);
|
||||
|
||||
/**
|
||||
* Guacamole server environment.
|
||||
*/
|
||||
private final Environment environment;
|
||||
|
||||
/**
|
||||
* Creates a new LDAPAuthenticationProvider that authenticates users
|
||||
* against an LDAP directory.
|
||||
*
|
||||
* @throws GuacamoleException
|
||||
* If a required property is missing, or an error occurs while parsing
|
||||
* a property.
|
||||
*/
|
||||
public LDAPAuthenticationProvider() throws GuacamoleException {
|
||||
environment = new LocalEnvironment();
|
||||
}
|
||||
|
||||
// Courtesy of OWASP: https://www.owasp.org/index.php/Preventing_LDAP_Injection_in_Java
|
||||
private static String escapeLDAPSearchFilter(String filter) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
@@ -146,8 +164,8 @@ public class LDAPAuthenticationProvider extends SimpleAuthenticationProvider {
|
||||
|
||||
ldapConnection = new LDAPConnection();
|
||||
ldapConnection.connect(
|
||||
GuacamoleProperties.getRequiredProperty(LDAPGuacamoleProperties.LDAP_HOSTNAME),
|
||||
GuacamoleProperties.getRequiredProperty(LDAPGuacamoleProperties.LDAP_PORT)
|
||||
environment.getRequiredProperty(LDAPGuacamoleProperties.LDAP_HOSTNAME),
|
||||
environment.getRequiredProperty(LDAPGuacamoleProperties.LDAP_PORT)
|
||||
);
|
||||
|
||||
}
|
||||
@@ -156,12 +174,12 @@ public class LDAPAuthenticationProvider extends SimpleAuthenticationProvider {
|
||||
}
|
||||
|
||||
// Get username attribute
|
||||
String username_attribute = GuacamoleProperties.getRequiredProperty(
|
||||
String username_attribute = environment.getRequiredProperty(
|
||||
LDAPGuacamoleProperties.LDAP_USERNAME_ATTRIBUTE
|
||||
);
|
||||
|
||||
// Get user base DN
|
||||
String user_base_dn = GuacamoleProperties.getRequiredProperty(
|
||||
String user_base_dn = environment.getRequiredProperty(
|
||||
LDAPGuacamoleProperties.LDAP_USER_BASE_DN
|
||||
);
|
||||
|
||||
@@ -191,7 +209,7 @@ public class LDAPAuthenticationProvider extends SimpleAuthenticationProvider {
|
||||
}
|
||||
|
||||
// Get config base DN
|
||||
String config_base_dn = GuacamoleProperties.getRequiredProperty(
|
||||
String config_base_dn = environment.getRequiredProperty(
|
||||
LDAPGuacamoleProperties.LDAP_CONFIG_BASE_DN
|
||||
);
|
||||
|
||||
|
@@ -30,10 +30,11 @@ import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import org.glyptodon.guacamole.GuacamoleException;
|
||||
import org.glyptodon.guacamole.GuacamoleServerException;
|
||||
import org.glyptodon.guacamole.environment.Environment;
|
||||
import org.glyptodon.guacamole.environment.LocalEnvironment;
|
||||
import org.glyptodon.guacamole.net.auth.simple.SimpleAuthenticationProvider;
|
||||
import org.glyptodon.guacamole.net.auth.Credentials;
|
||||
import org.glyptodon.guacamole.properties.FileGuacamoleProperty;
|
||||
import org.glyptodon.guacamole.properties.GuacamoleProperties;
|
||||
import org.glyptodon.guacamole.protocol.GuacamoleConfiguration;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.slf4j.Logger;
|
||||
@@ -86,6 +87,11 @@ public class NoAuthenticationProvider extends SimpleAuthenticationProvider {
|
||||
*/
|
||||
private long configTime;
|
||||
|
||||
/**
|
||||
* Guacamole server environment.
|
||||
*/
|
||||
private final Environment environment;
|
||||
|
||||
/**
|
||||
* The filename of the XML file to read the user mapping from.
|
||||
*/
|
||||
@@ -98,6 +104,19 @@ public class NoAuthenticationProvider extends SimpleAuthenticationProvider {
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a new NoAuthenticationProvider that does not perform any
|
||||
* authentication at all. All attempts to access the Guacamole system are
|
||||
* presumed to be authorized.
|
||||
*
|
||||
* @throws GuacamoleException
|
||||
* If a required property is missing, or an error occurs while parsing
|
||||
* a property.
|
||||
*/
|
||||
public NoAuthenticationProvider() throws GuacamoleException {
|
||||
environment = new LocalEnvironment();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the configuration file, as defined within guacamole.properties.
|
||||
*
|
||||
@@ -106,7 +125,7 @@ public class NoAuthenticationProvider extends SimpleAuthenticationProvider {
|
||||
* property.
|
||||
*/
|
||||
private File getConfigurationFile() throws GuacamoleException {
|
||||
return GuacamoleProperties.getRequiredProperty(NOAUTH_CONFIG);
|
||||
return environment.getRequiredProperty(NOAUTH_CONFIG);
|
||||
}
|
||||
|
||||
public synchronized void init() throws GuacamoleException {
|
||||
|
Reference in New Issue
Block a user