@Override
    public Directory<Connection> getConnectionDirectory(
            Directory<Connection> underlyingDirectory) throws GuacamoleException {

        // A Connection directory that will decorate all connections with a
        // KsmConnection wrapper to ensure that all defined KSM fields will
        // be exposed in the connection group attributes.
        return new DecoratingDirectory<Connection>(underlyingDirectory) {

            @Override
            protected Connection decorate(Connection connection) throws GuacamoleException {

                // Wrap in a KsmConnection class to ensure that all defined KSM fields will be
                // present
                return new KsmConnection(connection);
            }

            @Override
            protected Connection undecorate(Connection connection) throws GuacamoleException {

                // Unwrap the KsmConnection
                return ((KsmConnection) connection).getUnderlyingConnection();
            }

        };
    }
Service for retrieving any custom attributes defined for the
current vault implementation and processing of said attributes.
extensions/guacamole-vault/modules/guacamole-vault-ksm/src/main/java/org/apache/guacamole/vault/ksm/user/KsmDirectoryService.java