GUAC-587: Default to noauth-config.xml.

This commit is contained in:
Michael Jumper
2015-05-12 13:53:32 -07:00
parent 5232dac896
commit 190f61d927

View File

@@ -92,7 +92,7 @@ public class NoAuthenticationProvider extends SimpleAuthenticationProvider {
private final Environment environment; private final Environment environment;
/** /**
* The filename of the XML file to read the user mapping from. * The XML file to read the configuration from.
*/ */
public static final FileGuacamoleProperty NOAUTH_CONFIG = new FileGuacamoleProperty() { public static final FileGuacamoleProperty NOAUTH_CONFIG = new FileGuacamoleProperty() {
@@ -103,6 +103,12 @@ public class NoAuthenticationProvider extends SimpleAuthenticationProvider {
}; };
/**
* The default filename to use for the configuration, if not defined within
* guacamole.properties.
*/
public static final String DEFAULT_NOAUTH_CONFIG = "noauth-config.xml";
/** /**
* Creates a new NoAuthenticationProvider that does not perform any * Creates a new NoAuthenticationProvider that does not perform any
* authentication at all. All attempts to access the Guacamole system are * authentication at all. All attempts to access the Guacamole system are
@@ -124,7 +130,14 @@ public class NoAuthenticationProvider extends SimpleAuthenticationProvider {
* property. * property.
*/ */
private File getConfigurationFile() throws GuacamoleException { private File getConfigurationFile() throws GuacamoleException {
return environment.getRequiredProperty(NOAUTH_CONFIG);
// Get config file, defaulting to GUACAMOLE_HOME/noauth-config.xml
File configFile = environment.getProperty(NOAUTH_CONFIG);
if (configFile == null)
configFile = new File(environment.getGuacamoleHome(), DEFAULT_NOAUTH_CONFIG);
return configFile;
} }
public synchronized void init() throws GuacamoleException { public synchronized void init() throws GuacamoleException {