From 190f61d92761e9c9507c9e1aa169d861c53f2ec1 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Tue, 12 May 2015 13:53:32 -0700 Subject: [PATCH] GUAC-587: Default to noauth-config.xml. --- .../auth/noauth/NoAuthenticationProvider.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/extensions/guacamole-auth-noauth/src/main/java/net/sourceforge/guacamole/net/auth/noauth/NoAuthenticationProvider.java b/extensions/guacamole-auth-noauth/src/main/java/net/sourceforge/guacamole/net/auth/noauth/NoAuthenticationProvider.java index f655a5fc3..3752f8029 100644 --- a/extensions/guacamole-auth-noauth/src/main/java/net/sourceforge/guacamole/net/auth/noauth/NoAuthenticationProvider.java +++ b/extensions/guacamole-auth-noauth/src/main/java/net/sourceforge/guacamole/net/auth/noauth/NoAuthenticationProvider.java @@ -92,7 +92,7 @@ public class NoAuthenticationProvider extends SimpleAuthenticationProvider { 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() { @@ -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 * authentication at all. All attempts to access the Guacamole system are @@ -124,7 +130,14 @@ public class NoAuthenticationProvider extends SimpleAuthenticationProvider { * property. */ 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 {