public GuacamoleConfiguration getConfiguration(UserData.Connection connection) {

        GuacamoleConfiguration config = new GuacamoleConfiguration();

        // Set connection ID if joining an active connection
        String primaryConnection = connection.getPrimaryConnection();
        if (primaryConnection != null) {

            // Verify that the connection being joined actually exists
            String id = activeConnections.get(primaryConnection);
            if (id == null)
                return null;

            config.setConnectionID(id);

        }

        // Otherwise, require protocol
        else
            config.setProtocol(connection.getProtocol());

        // Add all parameter name/value pairs
        Map<String, String> parameters = connection.getParameters();
        if (parameters != null)
            config.setParameters(parameters);

        return config;

    }
Generates a new GuacamoleConfiguration from the associated protocol and
parameters of the given UserData.Connection. If the configuration cannot
be generated (because a connection is being joined by that connection is
not actually active), null is returned.

@param connection
    The UserData.Connection whose protocol and parameters should be used
    to construct the new GuacamoleConfiguration.

@return
    A new GuacamoleConfiguration generated from the associated protocol
    and parameters of the given UserData.Connection, or null if the
    configuration cannot be generated.
extensions/guacamole-auth-json/src/main/java/org/apache/guacamole/auth/json/connection/ConnectionService.java