private GuacamoleConfiguration getGuacamoleConfiguration(
            ModeledConnection connection, String connectionID,
            ModeledSharingProfile sharingProfile) {

        ConnectionModel model = connection.getModel();

        // Generate configuration from available data
        GuacamoleConfiguration config = new GuacamoleConfiguration();
        config.setProtocol(model.getProtocol());
        config.setConnectionID(connectionID);

        // Set parameters from associated data
        if (sharingProfile != null) {
            Collection<SharingProfileParameterModel> parameters = sharingProfileParameterMapper.select(sharingProfile.getIdentifier());
            for (SharingProfileParameterModel parameter : parameters)
                config.setParameter(parameter.getName(), parameter.getValue());
        }
        else {
            Collection<ConnectionParameterModel> parameters = connectionParameterMapper.select(connection.getIdentifier());
            for (ConnectionParameterModel parameter : parameters)
                config.setParameter(parameter.getName(), parameter.getValue());
        }

        return config;

    }
Returns a GuacamoleConfiguration which connects to the given connection.
If the ID of an active connection is provided, that active connection
will be joined rather than establishing an entirely new connection. If
a sharing profile is provided, the parameters associated with that
sharing profile will be used to define the access provided to the user
accessing the shared connection.

@param connection
    The connection that the user is connecting to.

@param connectionID
    The ID of the active connection being joined, as provided by guacd
    when the original connection was established, or null if a new
    connection should be established instead.

@param sharingProfile
    The sharing profile whose associated parameters dictate the level
    of access granted to the user joining the connection, or null if the
    parameters associated with the connection should be used.

@return
    A GuacamoleConfiguration defining the requested, possibly shared
    connection.
extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/AbstractGuacamoleTunnelService.java