@@ -0,0 +1,2828 @@
+/*%0A * Copyright (C) 2015 Glyptodon LLC%0A * %0A * Permission is hereby granted, free of charge, to any person obtaining a copy%0A * of this software and associated documentation files (the %22Software%22), to deal%0A * in the Software without restriction, including without limitation the rights%0A * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell%0A * copies of the Software, and to permit persons to whom the Software is%0A * furnished to do so, subject to the following conditions:%0A * %0A * The above copyright notice and this permission notice shall be included in%0A * all copies or substantial portions of the Software.%0A * %0A * THE SOFTWARE IS PROVIDED %22AS IS%22, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR%0A * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,%0A * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE%0A * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER%0A * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,%0A * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN%0A * THE SOFTWARE.%0A */%0A%0Apackage org.glyptodon.guacamole.token;%0A%0Aimport org.glyptodon.guacamole.net.auth.Credentials;%0A%0A/**%0A * Utility class which provides access to standardized token names, as well as%0A * facilities for generating those tokens from common objects.%0A *%0A * @author Michael Jumper%0A */%0Apublic class StandardTokens %7B%0A%0A    /**%0A     * The name of the username token added via addStandardTokens().%0A     */%0A    private static final String USERNAME_TOKEN = %22GUAC_USERNAME%22;%0A%0A    /**%0A     * The name of the password token added via addStandardTokens().%0A     */%0A    private static final String PASSWORD_TOKEN = %22GUAC_PASSWORD%22;%0A%0A    /**%0A     * This utility class should not be instantiated.%0A     */%0A    private StandardTokens() %7B%7D%0A%0A    /**%0A     * Adds the standard username (GUAC_USERNAME) and password (GUAC_PASSWORD)%0A     * tokens to the given TokenFilter using the values from the given%0A     * Credentials object. If either the username or password are not set%0A     * within the given credentials, the corresponding token(s) will remain%0A     * unset.%0A     *%0A     * @param filter%0A     *     The TokenFilter to add standard username/password tokens to.%0A     *%0A     * @param credentials%0A     *     The Credentials containing the username/password to add.%0A     *%0A     */%0A    public static void addStandardTokens(TokenFilter filter, Credentials credentials) %7B%0A%0A        // Add username token%0A        String username = credentials.getUsername();%0A        if (username != null)%0A            filter.setToken(USERNAME_TOKEN, username);%0A        %0A        // Add password token%0A        String password = credentials.getPassword();%0A        if (password != null)%0A            filter.setToken(PASSWORD_TOKEN, password);%0A        %0A    %7D%0A    %0A%0A%7D%0A

Add StandardTokens and credential-specific tokens.