GUACAMOLE-708: Add properties for automatic account creation.

This commit is contained in:
Virtually Nick
2020-06-19 12:22:26 -04:00
parent 6d89c1a308
commit 0ad00dda3e
11 changed files with 70 additions and 5 deletions

View File

@@ -25,6 +25,8 @@ import com.google.inject.name.Names;
import java.lang.UnsupportedOperationException;
import java.util.Properties;
import org.apache.guacamole.GuacamoleException;
import org.apache.guacamole.auth.sqlserver.conf.SQLServerDriver;
import org.apache.guacamole.auth.sqlserver.conf.SQLServerEnvironment;
import org.mybatis.guice.datasource.helper.JdbcHelper;
/**
@@ -45,7 +47,7 @@ public class SQLServerAuthenticationProviderModule implements Module {
/**
* Which SQL Server driver should be used.
*/
private SQLServerDriver sqlServerDriver;
private final SQLServerDriver sqlServerDriver;
/**
* Creates a new SQLServer authentication provider module that configures

View File

@@ -24,6 +24,7 @@ import com.google.inject.Injector;
import org.apache.guacamole.GuacamoleException;
import org.apache.guacamole.auth.jdbc.JDBCAuthenticationProviderModule;
import org.apache.guacamole.auth.jdbc.JDBCInjectorProvider;
import org.apache.guacamole.auth.sqlserver.conf.SQLServerEnvironment;
/**
* JDBCInjectorProvider implementation which configures Guice injections for

View File

@@ -17,7 +17,7 @@
* under the License.
*/
package org.apache.guacamole.auth.sqlserver;
package org.apache.guacamole.auth.sqlserver.conf;
import org.apache.guacamole.properties.EnumGuacamoleProperty.PropertyValue;

View File

@@ -17,7 +17,7 @@
* under the License.
*/
package org.apache.guacamole.auth.sqlserver;
package org.apache.guacamole.auth.sqlserver.conf;
import org.apache.guacamole.GuacamoleException;
import org.apache.guacamole.auth.jdbc.JDBCEnvironment;
@@ -273,5 +273,11 @@ public class SQLServerEnvironment extends JDBCEnvironment {
public boolean isRecursiveQuerySupported(SqlSession session) {
return true; // All versions of SQL Server support recursive queries through CTEs
}
@Override
public boolean autoCreateAbsentAccounts() throws GuacamoleException {
return getProperty(SQLServerGuacamoleProperties.SQLSERVER_AUTO_CREATE_ACCOUNTS,
false);
}
}

View File

@@ -17,7 +17,7 @@
* under the License.
*/
package org.apache.guacamole.auth.sqlserver;
package org.apache.guacamole.auth.sqlserver.conf;
import org.apache.guacamole.properties.BooleanGuacamoleProperty;
import org.apache.guacamole.properties.EnumGuacamoleProperty;
@@ -193,5 +193,13 @@ public class SQLServerGuacamoleProperties {
public String getName() { return "sqlserver-driver"; }
};
public static final BooleanGuacamoleProperty SQLSERVER_AUTO_CREATE_ACCOUNTS =
new BooleanGuacamoleProperty() {
@Override
public String getName() { return "sqlserver-auto-create-accounts"; }
};
}

View File

@@ -17,7 +17,7 @@
* under the License.
*/
package org.apache.guacamole.auth.sqlserver;
package org.apache.guacamole.auth.sqlserver.conf;
import org.apache.guacamole.GuacamoleException;
import org.apache.guacamole.auth.jdbc.JDBCEnvironment;