public static void addStandardTokens(TokenFilter filter, Credentials credentials) {

        // Add username token
        String username = credentials.getUsername();
        if (username != null)
            filter.setToken(USERNAME_TOKEN, username);

        // Add password token
        String password = credentials.getPassword();
        if (password != null)
            filter.setToken(PASSWORD_TOKEN, password);

        // Add client hostname token
        String hostname = credentials.getRemoteHostname();
        if (hostname != null)
            filter.setToken(CLIENT_HOSTNAME_TOKEN, hostname);

        // Add client address token
        String address = credentials.getRemoteAddress();
        if (address != null)
            filter.setToken(CLIENT_ADDRESS_TOKEN, address);

        // Add any tokens which do not require credentials
        addStandardTokens(filter);

    }
Adds tokens which are standardized by guacamole-ext to the given
TokenFilter using the values from the given Credentials object. These
standardized tokens include the current username (GUAC_USERNAME),
password (GUAC_PASSWORD), and the server date and time (GUAC_DATE and
GUAC_TIME respectively). If either the username or password are not set
within the given credentials, the corresponding token(s) will remain
unset.

@param filter
    The TokenFilter to add standard tokens to.

@param credentials
    The Credentials to use when populating the GUAC_USERNAME and
    GUAC_PASSWORD tokens.
guacamole-ext/src/main/java/org/apache/guacamole/token/StandardTokens.java