public Directory<Connection> getConnectionDirectory(UserData userData) {

        // Do not return any connections if empty or expired
        Map<String, UserData.Connection> connections = userData.getConnections();
        if (connections == null || userData.isExpired())
            return new SimpleDirectory<>();

        // Convert UserData.Connection objects to normal Connections
        Map<String, Connection> directoryContents = new HashMap<>();
        for (Map.Entry<String, UserData.Connection> entry : connections.entrySet()) {

            // Pull connection and associated identifier
            String identifier = entry.getKey();
            UserData.Connection connection = entry.getValue();

            // Create Guacamole connection containing the defined identifier
            // and parameters
            Connection guacConnection = userDataConnectionProvider.get().init(
                userData,
                identifier,
                connection
            );

            // Add corresponding Connection to directory
            directoryContents.put(identifier, guacConnection);

        }

        return new SimpleDirectory<>(directoryContents);

    }
Returns a Directory containing all connections accessible by the user
whose data is given by the provided UserData object. If the given
UserData object is not expired, this Directory will contain absolutely
all connections defined within the given UserData. If the given UserData
object is expired, this Directory will be empty.

@param userData
    All data associated with the user whose connection directory is
    being retrieved.

@return
    A Directory containing all connections accessible by the user whose
    data is given by the provided UserData object.
extensions/guacamole-auth-json/src/main/java/org/apache/guacamole/auth/json/user/UserDataService.java