diff --git a/guacamole/src/main/java/net/sourceforge/guacamole/net/basic/BasicFileAuthenticationProvider.java b/guacamole/src/main/java/net/sourceforge/guacamole/net/basic/BasicFileAuthenticationProvider.java index 6694f5eea..fd7ffda9f 100644 --- a/guacamole/src/main/java/net/sourceforge/guacamole/net/basic/BasicFileAuthenticationProvider.java +++ b/guacamole/src/main/java/net/sourceforge/guacamole/net/basic/BasicFileAuthenticationProvider.java @@ -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 ||