mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-189: Refactor GuacamoleProxyConfiguration to guacamole-ext.
This commit is contained in:
@@ -20,8 +20,6 @@
|
||||
package org.apache.guacamole.auth.jdbc;
|
||||
|
||||
import org.apache.guacamole.GuacamoleException;
|
||||
import org.apache.guacamole.auth.jdbc.connection.GuacamoleProxyConfiguration;
|
||||
import org.apache.guacamole.environment.Environment;
|
||||
import org.apache.guacamole.environment.LocalEnvironment;
|
||||
import org.apache.guacamole.auth.jdbc.security.PasswordPolicy;
|
||||
|
||||
@@ -31,18 +29,6 @@ import org.apache.guacamole.auth.jdbc.security.PasswordPolicy;
|
||||
*/
|
||||
public abstract class JDBCEnvironment extends LocalEnvironment {
|
||||
|
||||
/**
|
||||
* The hostname to use when connecting to guacd if no hostname is provided
|
||||
* within guacamole.properties.
|
||||
*/
|
||||
private static final String DEFAULT_GUACD_HOSTNAME = "localhost";
|
||||
|
||||
/**
|
||||
* The port to use when connecting to guacd if no port is provided within
|
||||
* guacamole.properties.
|
||||
*/
|
||||
private static final int DEFAULT_GUACD_PORT = 4822;
|
||||
|
||||
/**
|
||||
* Constructs a new JDBCEnvironment using an underlying LocalEnviroment to
|
||||
* read properties from the file system.
|
||||
@@ -54,30 +40,6 @@ public abstract class JDBCEnvironment extends LocalEnvironment {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the connection information which should be used, by default, to
|
||||
* connect to guacd when establishing a remote desktop connection.
|
||||
*
|
||||
* @return
|
||||
* The connection information which should be used, by default, to
|
||||
* connect to guacd.
|
||||
*
|
||||
* @throws GuacamoleException
|
||||
* If the properties describing the connection information for guacd
|
||||
* cannot be parsed.
|
||||
*/
|
||||
public GuacamoleProxyConfiguration getDefaultGuacamoleProxyConfiguration()
|
||||
throws GuacamoleException {
|
||||
|
||||
// Parse guacd hostname/port/ssl properties
|
||||
return new GuacamoleProxyConfiguration(
|
||||
getProperty(Environment.GUACD_HOSTNAME, DEFAULT_GUACD_HOSTNAME),
|
||||
getProperty(Environment.GUACD_PORT, DEFAULT_GUACD_PORT),
|
||||
getProperty(Environment.GUACD_SSL, false)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether a database user account is required for authentication to
|
||||
* succeed, even if another authentication provider has already
|
||||
|
@@ -22,7 +22,7 @@ package org.apache.guacamole.auth.jdbc.connection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import org.apache.guacamole.auth.jdbc.base.ChildObjectModel;
|
||||
import org.apache.guacamole.auth.jdbc.connection.GuacamoleProxyConfiguration.EncryptionMethod;
|
||||
import org.apache.guacamole.net.auth.GuacamoleProxyConfiguration.EncryptionMethod;
|
||||
|
||||
/**
|
||||
* Object representation of a Guacamole connection, as represented in the
|
||||
|
@@ -1,132 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.guacamole.auth.jdbc.connection;
|
||||
|
||||
/**
|
||||
* Information which describes how the connection to guacd should be
|
||||
* established. This includes the hostname and port which guacd is listening on,
|
||||
* as well as the type of encryption required, if any.
|
||||
*
|
||||
* @author Michael Jumper
|
||||
*/
|
||||
public class GuacamoleProxyConfiguration {
|
||||
|
||||
/**
|
||||
* All possible types of encryption used by guacd.
|
||||
*/
|
||||
public enum EncryptionMethod {
|
||||
|
||||
/**
|
||||
* Unencrypted (plaintext).
|
||||
*/
|
||||
NONE,
|
||||
|
||||
/**
|
||||
* Encrypted with SSL or TLS.
|
||||
*/
|
||||
SSL
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* The hostname or address of the machine where guacd is running.
|
||||
*/
|
||||
private final String hostname;
|
||||
|
||||
/**
|
||||
* The port that guacd is listening on.
|
||||
*/
|
||||
private final int port;
|
||||
|
||||
/**
|
||||
* The type of encryption required by guacd.
|
||||
*/
|
||||
private final EncryptionMethod encryptionMethod;
|
||||
|
||||
/**
|
||||
* Creates a new GuacamoleProxyConfiguration having the given hostname,
|
||||
* port, and encryption method.
|
||||
*
|
||||
* @param hostname
|
||||
* The hostname or address of the machine where guacd is running.
|
||||
*
|
||||
* @param port
|
||||
* The port that guacd is listening on.
|
||||
*
|
||||
* @param encryptionMethod
|
||||
* The type of encryption required by the instance of guacd running at
|
||||
* the given hostname and port.
|
||||
*/
|
||||
public GuacamoleProxyConfiguration(String hostname, int port,
|
||||
EncryptionMethod encryptionMethod) {
|
||||
this.hostname = hostname;
|
||||
this.port = port;
|
||||
this.encryptionMethod = encryptionMethod;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new GuacamoleProxyConfiguration having the given hostname and
|
||||
* port, with encryption method being restricted to either NONE or SSL.
|
||||
*
|
||||
* @param hostname
|
||||
* The hostname or address of the machine where guacd is running.
|
||||
*
|
||||
* @param port
|
||||
* The port that guacd is listening on.
|
||||
*
|
||||
* @param ssl
|
||||
* true if guacd requires SSL/TLS encryption, false if communication
|
||||
* with guacd should be unencrypted.
|
||||
*/
|
||||
public GuacamoleProxyConfiguration(String hostname, int port, boolean ssl) {
|
||||
this(hostname, port, ssl ? EncryptionMethod.SSL : EncryptionMethod.NONE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the hostname or address of the machine where guacd is running.
|
||||
*
|
||||
* @return
|
||||
* The hostname or address of the machine where guacd is running.
|
||||
*/
|
||||
public String getHostname() {
|
||||
return hostname;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the port that guacd is listening on.
|
||||
*
|
||||
* @return
|
||||
* The port that guacd is listening on.
|
||||
*/
|
||||
public int getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of encryption required by guacd.
|
||||
*
|
||||
* @return
|
||||
* The type of encryption required by guacd.
|
||||
*/
|
||||
public EncryptionMethod getEncryptionMethod() {
|
||||
return encryptionMethod;
|
||||
}
|
||||
|
||||
}
|
@@ -32,7 +32,6 @@ import org.apache.guacamole.auth.jdbc.tunnel.GuacamoleTunnelService;
|
||||
import org.apache.guacamole.GuacamoleException;
|
||||
import org.apache.guacamole.auth.jdbc.JDBCEnvironment;
|
||||
import org.apache.guacamole.auth.jdbc.base.ModeledChildDirectoryObject;
|
||||
import org.apache.guacamole.auth.jdbc.connection.GuacamoleProxyConfiguration.EncryptionMethod;
|
||||
import org.apache.guacamole.form.EnumField;
|
||||
import org.apache.guacamole.form.Field;
|
||||
import org.apache.guacamole.form.Form;
|
||||
@@ -41,6 +40,8 @@ import org.apache.guacamole.form.TextField;
|
||||
import org.apache.guacamole.net.GuacamoleTunnel;
|
||||
import org.apache.guacamole.net.auth.Connection;
|
||||
import org.apache.guacamole.net.auth.ConnectionRecord;
|
||||
import org.apache.guacamole.net.auth.GuacamoleProxyConfiguration;
|
||||
import org.apache.guacamole.net.auth.GuacamoleProxyConfiguration.EncryptionMethod;
|
||||
import org.apache.guacamole.protocol.GuacamoleClientInformation;
|
||||
import org.apache.guacamole.protocol.GuacamoleConfiguration;
|
||||
import org.slf4j.Logger;
|
||||
|
@@ -57,12 +57,12 @@ import org.apache.guacamole.token.StandardTokens;
|
||||
import org.apache.guacamole.token.TokenFilter;
|
||||
import org.mybatis.guice.transactional.Transactional;
|
||||
import org.apache.guacamole.auth.jdbc.connection.ConnectionParameterMapper;
|
||||
import org.apache.guacamole.auth.jdbc.connection.GuacamoleProxyConfiguration;
|
||||
import org.apache.guacamole.auth.jdbc.sharing.connection.SharedConnectionDefinition;
|
||||
import org.apache.guacamole.auth.jdbc.sharingprofile.ModeledSharingProfile;
|
||||
import org.apache.guacamole.auth.jdbc.sharingprofile.SharingProfileParameterMapper;
|
||||
import org.apache.guacamole.auth.jdbc.sharingprofile.SharingProfileParameterModel;
|
||||
import org.apache.guacamole.auth.jdbc.user.RemoteAuthenticatedUser;
|
||||
import org.apache.guacamole.net.auth.GuacamoleProxyConfiguration;
|
||||
import org.apache.guacamole.protocol.FailoverGuacamoleSocket;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@@ -36,7 +36,7 @@
|
||||
<result column="proxy_hostname" property="proxyHostname" jdbcType="VARCHAR"/>
|
||||
<result column="proxy_port" property="proxyPort" jdbcType="INTEGER"/>
|
||||
<result column="proxy_encryption_method" property="proxyEncryptionMethod" jdbcType="VARCHAR"
|
||||
javaType="org.apache.guacamole.auth.jdbc.connection.GuacamoleProxyConfiguration$EncryptionMethod"/>
|
||||
javaType="org.apache.guacamole.net.auth.GuacamoleProxyConfiguration$EncryptionMethod"/>
|
||||
|
||||
<!-- Associated sharing profiles -->
|
||||
<collection property="sharingProfileIdentifiers" resultSet="sharingProfiles" ofType="java.lang.String"
|
||||
@@ -218,4 +218,4 @@
|
||||
WHERE connection_id = #{object.objectID,jdbcType=INTEGER}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
@@ -36,7 +36,7 @@
|
||||
<result column="proxy_hostname" property="proxyHostname" jdbcType="VARCHAR"/>
|
||||
<result column="proxy_port" property="proxyPort" jdbcType="INTEGER"/>
|
||||
<result column="proxy_encryption_method" property="proxyEncryptionMethod" jdbcType="VARCHAR"
|
||||
javaType="org.apache.guacamole.auth.jdbc.connection.GuacamoleProxyConfiguration$EncryptionMethod"/>
|
||||
javaType="org.apache.guacamole.net.auth.GuacamoleProxyConfiguration$EncryptionMethod"/>
|
||||
|
||||
<!-- Associated sharing profiles -->
|
||||
<collection property="sharingProfileIdentifiers" resultSet="sharingProfiles" ofType="java.lang.String"
|
||||
@@ -218,4 +218,4 @@
|
||||
WHERE connection_id = #{object.objectID,jdbcType=INTEGER}::integer
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
Reference in New Issue
Block a user