GUACAMOLE-494: Remove support for "basic-user-mapping" property, deprecated since 0.9.10-incubating (8590a0a).

This commit is contained in:
Michael Jumper
2018-02-01 22:42:36 -08:00
parent 07d0307855
commit cbed98e849

View File

@@ -31,7 +31,6 @@ import org.apache.guacamole.environment.LocalEnvironment;
import org.apache.guacamole.net.auth.Credentials; import org.apache.guacamole.net.auth.Credentials;
import org.apache.guacamole.net.auth.simple.SimpleAuthenticationProvider; import org.apache.guacamole.net.auth.simple.SimpleAuthenticationProvider;
import org.apache.guacamole.xml.DocumentHandler; import org.apache.guacamole.xml.DocumentHandler;
import org.apache.guacamole.properties.FileGuacamoleProperty;
import org.apache.guacamole.protocol.GuacamoleConfiguration; import org.apache.guacamole.protocol.GuacamoleConfiguration;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -69,20 +68,6 @@ public class FileAuthenticationProvider extends SimpleAuthenticationProvider {
*/ */
private final Environment environment; private final Environment environment;
/**
* The XML file to read the user mapping from. This property has been
* deprecated, as the name "basic" is ridiculous, and providing for
* configurable user-mapping.xml locations is unnecessary complexity. Use
* GUACAMOLE_HOME/user-mapping.xml instead.
*/
@Deprecated
public static final FileGuacamoleProperty BASIC_USER_MAPPING = new FileGuacamoleProperty() {
@Override
public String getName() { return "basic-user-mapping"; }
};
/** /**
* The filename to use for the user mapping. * The filename to use for the user mapping.
*/ */
@@ -107,38 +92,17 @@ public class FileAuthenticationProvider extends SimpleAuthenticationProvider {
/** /**
* Returns a UserMapping containing all authorization data given within * Returns a UserMapping containing all authorization data given within
* the XML file specified by the "basic-user-mapping" property in * GUACAMOLE_HOME/user-mapping.xml. If the XML file has been modified or has
* guacamole.properties. If the XML file has been modified or has not yet * not yet been read, this function may reread the file.
* been read, this function may reread the file.
* *
* @return * @return
* A UserMapping containing all authorization data within the user * A UserMapping containing all authorization data within the user
* mapping XML file, or null if the file cannot be found/parsed. * mapping XML file, or null if the file cannot be found/parsed.
*/ */
@SuppressWarnings("deprecation") // We must continue to use the "basic-user-mapping" property until it is truly no longer supported
private UserMapping getUserMapping() { private UserMapping getUserMapping() {
// Get user mapping file, defaulting to GUACAMOLE_HOME/user-mapping.xml // Read user mapping from GUACAMOLE_HOME/user-mapping.xml
File userMappingFile; File userMappingFile = new File(environment.getGuacamoleHome(), USER_MAPPING_FILENAME);
try {
// Continue supporting deprecated property, but warn in the logs
userMappingFile = environment.getProperty(BASIC_USER_MAPPING);
if (userMappingFile != null)
logger.warn("The \"basic-user-mapping\" property is deprecated. Please use the \"GUACAMOLE_HOME/user-mapping.xml\" file instead.");
// Read user mapping from GUACAMOLE_HOME
if (userMappingFile == null)
userMappingFile = new File(environment.getGuacamoleHome(), USER_MAPPING_FILENAME);
}
// Abort if property cannot be parsed
catch (GuacamoleException e) {
logger.warn("Unable to read user mapping filename from properties: {}", e.getMessage());
logger.debug("Error parsing user mapping property.", e);
return null;
}
// Abort if user mapping does not exist // Abort if user mapping does not exist
if (!userMappingFile.exists()) { if (!userMappingFile.exists()) {