GUAC-587: Default to GUACAMOLE_HOME/user-mapping.xml.

This commit is contained in:
Michael Jumper
2015-05-12 13:41:40 -07:00
parent abd3d381f9
commit 5232dac896

View File

@@ -76,7 +76,7 @@ public class BasicFileAuthenticationProvider extends SimpleAuthenticationProvide
private final Environment environment;
/**
* The filename of the XML file to read the user user_mapping from.
* The XML file to read the user mapping from.
*/
public static final FileGuacamoleProperty BASIC_USER_MAPPING = new FileGuacamoleProperty() {
@@ -85,6 +85,12 @@ public class BasicFileAuthenticationProvider extends SimpleAuthenticationProvide
};
/**
* The default filename to use for the user mapping, if not defined within
* guacamole.properties.
*/
public static final String DEFAULT_USER_MAPPING = "user-mapping.xml";
/**
* Creates a new BasicFileAuthenticationProvider that authenticates users
* against simple, monolithic XML file.
@@ -110,9 +116,10 @@ public class BasicFileAuthenticationProvider extends SimpleAuthenticationProvide
*/
private UserMapping getUserMapping() throws GuacamoleException {
// Get user user_mapping file
File user_mapping_file =
environment.getRequiredProperty(BASIC_USER_MAPPING);
// Get user mapping file, defaulting to GUACAMOLE_HOME/user-mapping.xml
File user_mapping_file = environment.getProperty(BASIC_USER_MAPPING);
if (user_mapping_file == null)
user_mapping_file = new File(environment.getGuacamoleHome(), DEFAULT_USER_MAPPING);
// If user_mapping not yet read, or user_mapping has been modified, reread
if (user_mapping == null ||