guacamole-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmuehl...@apache.org
Subject [17/51] [abbrv] incubator-guacamole-client git commit: GUACAMOLE-1: Rename Basic* to File* for default authentication provider. Deprecate "basic-user-mapping" property.
Date Tue, 29 Mar 2016 04:20:26 GMT
GUACAMOLE-1: Rename Basic* to File* for default authentication provider. Deprecate "basic-user-mapping" property.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/8590a0a4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/8590a0a4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/8590a0a4

Branch: refs/heads/master
Commit: 8590a0a492330f610ba8669f51b21a50741f0902
Parents: cbe3387
Author: Michael Jumper <mjumper@apache.org>
Authored: Tue Mar 22 14:50:02 2016 -0700
Committer: Michael Jumper <mjumper@apache.org>
Committed: Mon Mar 28 20:50:01 2016 -0700

----------------------------------------------------------------------
 .../apache/guacamole/auth/Authorization.java    | 255 -------------------
 .../org/apache/guacamole/auth/UserMapping.java  |  62 -----
 .../auth/basic/AuthorizeTagHandler.java         | 151 -----------
 .../basic/BasicFileAuthenticationProvider.java  | 218 ----------------
 .../auth/basic/ConnectionTagHandler.java        | 110 --------
 .../guacamole/auth/basic/ParamTagHandler.java   |  74 ------
 .../auth/basic/ProtocolTagHandler.java          |  70 -----
 .../auth/basic/UserMappingTagHandler.java       |  78 ------
 .../guacamole/auth/basic/package-info.java      |  27 --
 .../guacamole/auth/file/Authorization.java      | 255 +++++++++++++++++++
 .../auth/file/AuthorizeTagHandler.java          | 149 +++++++++++
 .../auth/file/ConnectionTagHandler.java         | 109 ++++++++
 .../auth/file/FileAuthenticationProvider.java   | 226 ++++++++++++++++
 .../guacamole/auth/file/ParamTagHandler.java    |  74 ++++++
 .../guacamole/auth/file/ProtocolTagHandler.java |  70 +++++
 .../apache/guacamole/auth/file/UserMapping.java |  62 +++++
 .../auth/file/UserMappingTagHandler.java        |  77 ++++++
 .../guacamole/auth/file/package-info.java       |  28 ++
 .../org/apache/guacamole/auth/package-info.java |  28 --
 .../guacamole/extension/ExtensionModule.java    |   6 +-
 20 files changed, 1053 insertions(+), 1076 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/8590a0a4/guacamole/src/main/java/org/apache/guacamole/auth/Authorization.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/auth/Authorization.java b/guacamole/src/main/java/org/apache/guacamole/auth/Authorization.java
deleted file mode 100644
index 9ff1c79..0000000
--- a/guacamole/src/main/java/org/apache/guacamole/auth/Authorization.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * Copyright (C) 2013 Glyptodon LLC
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-package org.apache.guacamole.auth;
-
-import java.io.UnsupportedEncodingException;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.util.Map;
-import java.util.TreeMap;
-import org.apache.guacamole.protocol.GuacamoleConfiguration;
-
-/**
- * Mapping of username/password pair to configuration set. In addition to basic
- * storage of the username, password, and configurations, this class also
- * provides password validation functions.
- *
- * @author Mike Jumper
- */
-public class Authorization {
-
-    /**
-     * All supported password encodings.
-     */
-    public static enum Encoding {
-
-        /**
-         * Plain-text password (not hashed at all).
-         */
-        PLAIN_TEXT,
-
-        /**
-         * Password hashed with MD5.
-         */
-        MD5
-
-    }
-
-    /**
-     * The username being authorized.
-     */
-    private String username;
-
-    /**
-     * The password corresponding to the username being authorized, which may
-     * be hashed.
-     */
-    private String password;
-
-    /**
-     * The encoding used when the password was hashed.
-     */
-    private Encoding encoding = Encoding.PLAIN_TEXT;
-
-    /**
-     * Map of all authorized configurations, indexed by configuration name.
-     */
-    private Map<String, GuacamoleConfiguration> configs = new
-            TreeMap<String, GuacamoleConfiguration>();
-
-    /**
-     * Lookup table of hex bytes characters by value.
-     */
-    private static final char HEX_CHARS[] = {
-        '0', '1', '2', '3', '4', '5', '6', '7',
-        '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
-    };
-
-    /**
-     * Produces a String containing the bytes provided in hexadecimal notation.
-     *
-     * @param bytes The bytes to convert into hex.
-     * @return A String containing the hex representation of the given bytes.
-     */
-    private static String getHexString(byte[] bytes) {
-
-        // If null byte array given, return null
-        if (bytes == null)
-            return null;
-
-        // Create string builder for holding the hex representation,
-        // pre-calculating the exact length
-        StringBuilder hex = new StringBuilder(2 * bytes.length);
-
-        // Convert each byte into a pair of hex digits
-        for (byte b : bytes) {
-            hex.append(HEX_CHARS[(b & 0xF0) >> 4])
-               .append(HEX_CHARS[ b & 0x0F      ]);
-        }
-
-        // Return the string produced
-        return hex.toString();
-
-    }
-
-    /**
-     * Returns the username associated with this authorization.
-     *
-     * @return The username associated with this authorization.
-     */
-    public String getUsername() {
-        return username;
-    }
-
-    /**
-     * Sets the username associated with this authorization.
-     *
-     * @param username The username to associate with this authorization.
-     */
-    public void setUsername(String username) {
-        this.username = username;
-    }
-
-    /**
-     * Returns the password associated with this authorization, which may be
-     * encoded or hashed.
-     *
-     * @return The password associated with this authorization.
-     */
-    public String getPassword() {
-        return password;
-    }
-
-    /**
-     * Sets the password associated with this authorization, which must be
-     * encoded using the encoding specified with setEncoding(). By default,
-     * passwords are plain text.
-     *
-     * @param password Sets the password associated with this authorization.
-     */
-    public void setPassword(String password) {
-        this.password = password;
-    }
-
-    /**
-     * Returns the encoding used to hash the password, if any.
-     *
-     * @return The encoding used to hash the password.
-     */
-    public Encoding getEncoding() {
-        return encoding;
-    }
-
-    /**
-     * Sets the encoding which will be used to hash the password or when
-     * comparing a given password for validation.
-     *
-     * @param encoding The encoding to use for password hashing.
-     */
-    public void setEncoding(Encoding encoding) {
-        this.encoding = encoding;
-    }
-
-    /**
-     * Returns whether a given username/password pair is authorized based on
-     * the stored username and password. The password given must be plain text.
-     * It will be hashed as necessary to perform the validation.
-     *
-     * @param username The username to validate.
-     * @param password The password to validate.
-     * @return true if the username/password pair given is authorized, false
-     *         otherwise.
-     */
-    public boolean validate(String username, String password) {
-
-        // If username matches
-        if (username != null && password != null
-                && username.equals(this.username)) {
-
-            switch (encoding) {
-
-                // If plain text, just compare
-                case PLAIN_TEXT:
-
-                    // Compare plaintext
-                    return password.equals(this.password);
-
-                // If hased with MD5, hash password and compare
-                case MD5:
-
-                    // Compare hashed password
-                    try {
-                        MessageDigest digest = MessageDigest.getInstance("MD5");
-                        String hashedPassword = getHexString(digest.digest(password.getBytes("UTF-8")));
-                        return hashedPassword.equals(this.password.toUpperCase());
-                    }
-                    catch (UnsupportedEncodingException e) {
-                        throw new UnsupportedOperationException("Unexpected lack of UTF-8 support.", e);
-                    }
-                    catch (NoSuchAlgorithmException e) {
-                        throw new UnsupportedOperationException("Unexpected lack of MD5 support.", e);
-                    }
-
-            }
-
-        } // end validation check
-
-        return false;
-
-    }
-
-    /**
-     * Returns the GuacamoleConfiguration having the given name and associated
-     * with the username/password pair stored within this authorization.
-     *
-     * @param name The name of the GuacamoleConfiguration to return.
-     * @return The GuacamoleConfiguration having the given name, or null if no
-     *         such GuacamoleConfiguration exists.
-     */
-    public GuacamoleConfiguration getConfiguration(String name) {
-        return configs.get(name);
-    }
-
-    /**
-     * Adds the given GuacamoleConfiguration to the set of stored configurations
-     * under the given name.
-     *
-     * @param name The name to associate this GuacamoleConfiguration with.
-     * @param config The GuacamoleConfiguration to store.
-     */
-    public void addConfiguration(String name, GuacamoleConfiguration config) {
-        configs.put(name, config);
-    }
-
-    /**
-     * Returns a Map of all stored GuacamoleConfigurations associated with the
-     * username/password pair stored within this authorization, indexed by
-     * configuration name.
-     *
-     * @return A Map of all stored GuacamoleConfigurations.
-     */
-    public Map<String, GuacamoleConfiguration> getConfigurations() {
-        return configs;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/8590a0a4/guacamole/src/main/java/org/apache/guacamole/auth/UserMapping.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/auth/UserMapping.java b/guacamole/src/main/java/org/apache/guacamole/auth/UserMapping.java
deleted file mode 100644
index 7f86b1e..0000000
--- a/guacamole/src/main/java/org/apache/guacamole/auth/UserMapping.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2013 Glyptodon LLC
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-package org.apache.guacamole.auth;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Mapping of all usernames to corresponding authorizations.
- *
- * @author Mike Jumper
- */
-public class UserMapping {
-
-    /**
-     * All authorizations, indexed by username.
-     */
-    private Map<String, Authorization> authorizations =
-            new HashMap<String, Authorization>();
-
-    /**
-     * Adds the given authorization to the user mapping.
-     *
-     * @param authorization The authorization to add to the user mapping.
-     */
-    public void addAuthorization(Authorization authorization) {
-        authorizations.put(authorization.getUsername(), authorization);
-    }
-
-    /**
-     * Returns the authorization corresponding to the user having the given
-     * username, if any.
-     *
-     * @param username The username to find the authorization for.
-     * @return The authorization corresponding to the user having the given
-     *         username, or null if no such authorization exists.
-     */
-    public Authorization getAuthorization(String username) {
-        return authorizations.get(username);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/8590a0a4/guacamole/src/main/java/org/apache/guacamole/auth/basic/AuthorizeTagHandler.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/auth/basic/AuthorizeTagHandler.java b/guacamole/src/main/java/org/apache/guacamole/auth/basic/AuthorizeTagHandler.java
deleted file mode 100644
index bdd9c9a..0000000
--- a/guacamole/src/main/java/org/apache/guacamole/auth/basic/AuthorizeTagHandler.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright (C) 2013 Glyptodon LLC
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-package org.apache.guacamole.auth.basic;
-
-import org.apache.guacamole.auth.Authorization;
-import org.apache.guacamole.auth.UserMapping;
-import org.apache.guacamole.xml.TagHandler;
-import org.apache.guacamole.protocol.GuacamoleConfiguration;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-
-/**
- * TagHandler for the "authorize" element.
- *
- * @author Mike Jumper
- */
-public class AuthorizeTagHandler implements TagHandler {
-
-    /**
-     * The Authorization corresponding to the "authorize" tag being handled
-     * by this tag handler. The data of this Authorization will be populated
-     * as the tag is parsed.
-     */
-    private Authorization authorization = new Authorization();
-
-    /**
-     * The default GuacamoleConfiguration to use if "param" or "protocol"
-     * tags occur outside a "connection" tag.
-     */
-    private GuacamoleConfiguration default_config = null;
-
-    /**
-     * The UserMapping this authorization belongs to.
-     */
-    private UserMapping parent;
-
-    /**
-     * Creates a new AuthorizeTagHandler that parses an Authorization owned
-     * by the given UserMapping.
-     *
-     * @param parent The UserMapping that owns the Authorization this handler
-     *               will parse.
-     */
-    public AuthorizeTagHandler(UserMapping parent) {
-        this.parent = parent;
-    }
-
-    @Override
-    public void init(Attributes attributes) throws SAXException {
-
-        // Init username and password
-        authorization.setUsername(attributes.getValue("username"));
-        authorization.setPassword(attributes.getValue("password"));
-
-        // Get encoding
-        String encoding = attributes.getValue("encoding");
-        if (encoding != null) {
-
-            // If "md5", use MD5 encoding
-            if (encoding.equals("md5"))
-                authorization.setEncoding(Authorization.Encoding.MD5);
-
-            // If "plain", use plain text
-            else if (encoding.equals("plain"))
-                authorization.setEncoding(Authorization.Encoding.PLAIN_TEXT);
-
-            // Otherwise, bad encoding
-            else
-                throw new SAXException(
-                        "Invalid encoding: '" + encoding + "'");
-
-        }
-
-        parent.addAuthorization(this.asAuthorization());
-
-    }
-
-    @Override
-    public TagHandler childElement(String localName) throws SAXException {
-
-        // "connection" tag
-        if (localName.equals("connection"))
-            return new ConnectionTagHandler(authorization);
-
-        // "param" tag
-        if (localName.equals("param")) {
-
-            // Create default config if it doesn't exist
-            if (default_config == null) {
-                default_config = new GuacamoleConfiguration();
-                authorization.addConfiguration("DEFAULT", default_config);
-            }
-
-            return new ParamTagHandler(default_config);
-        }
-
-        // "protocol" tag
-        if (localName.equals("protocol")) {
-
-            // Create default config if it doesn't exist
-            if (default_config == null) {
-                default_config = new GuacamoleConfiguration();
-                authorization.addConfiguration("DEFAULT", default_config);
-            }
-
-            return new ProtocolTagHandler(default_config);
-        }
-
-        return null;
-
-    }
-
-    @Override
-    public void complete(String textContent) throws SAXException {
-        // Do nothing
-    }
-
-    /**
-     * Returns an Authorization backed by the data of this authorize tag
-     * handler. This Authorization is guaranteed to at least have the username,
-     * password, and encoding available. Any associated configurations will be
-     * added dynamically as the authorize tag is parsed.
-     *
-     * @return An Authorization backed by the data of this authorize tag
-     *         handler.
-     */
-    public Authorization asAuthorization() {
-        return authorization;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/8590a0a4/guacamole/src/main/java/org/apache/guacamole/auth/basic/BasicFileAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/auth/basic/BasicFileAuthenticationProvider.java b/guacamole/src/main/java/org/apache/guacamole/auth/basic/BasicFileAuthenticationProvider.java
deleted file mode 100644
index be3fd1a..0000000
--- a/guacamole/src/main/java/org/apache/guacamole/auth/basic/BasicFileAuthenticationProvider.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * Copyright (C) 2013 Glyptodon LLC
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-package org.apache.guacamole.auth.basic;
-
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Map;
-import org.apache.guacamole.GuacamoleException;
-import org.apache.guacamole.GuacamoleException;
-import org.apache.guacamole.environment.Environment;
-import org.apache.guacamole.environment.LocalEnvironment;
-import org.apache.guacamole.net.auth.Credentials;
-import org.apache.guacamole.net.auth.simple.SimpleAuthenticationProvider;
-import org.apache.guacamole.auth.Authorization;
-import org.apache.guacamole.auth.UserMapping;
-import org.apache.guacamole.xml.DocumentHandler;
-import org.apache.guacamole.properties.FileGuacamoleProperty;
-import org.apache.guacamole.protocol.GuacamoleConfiguration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-/**
- * Authenticates users against a static list of username/password pairs.
- * Each username/password may be associated with multiple configurations.
- * This list is stored in an XML file which is reread if modified.
- *
- * @author Michael Jumper, Michal Kotas
- */
-public class BasicFileAuthenticationProvider extends SimpleAuthenticationProvider {
-
-    /**
-     * Logger for this class.
-     */
-    private final Logger logger = LoggerFactory.getLogger(BasicFileAuthenticationProvider.class);
-
-    /**
-     * The time the user mapping file was last modified. If the file has never
-     * been read, and thus no modification time exists, this will be
-     * Long.MIN_VALUE.
-     */
-    private long lastModified = Long.MIN_VALUE;
-
-    /**
-     * The parsed UserMapping read when the user mapping file was last parsed.
-     */
-    private UserMapping cachedUserMapping;
-
-    /**
-     * Guacamole server environment.
-     */
-    private final Environment environment;
-
-    /**
-     * The XML file to read the user mapping from.
-     */
-    public static final FileGuacamoleProperty BASIC_USER_MAPPING = new FileGuacamoleProperty() {
-
-        @Override
-        public String getName() { return "basic-user-mapping"; }
-
-    };
-
-    /**
-     * The default filename to use for the user mapping, if not defined within
-     * guacamole.properties.
-     */
-    public static final String DEFAULT_USER_MAPPING = "user-mapping.xml";
-    
-    /**
-     * Creates a new BasicFileAuthenticationProvider that authenticates users
-     * against simple, monolithic XML file.
-     *
-     * @throws GuacamoleException
-     *     If a required property is missing, or an error occurs while parsing
-     *     a property.
-     */
-    public BasicFileAuthenticationProvider() throws GuacamoleException {
-        environment = new LocalEnvironment();
-    }
-
-    @Override
-    public String getIdentifier() {
-        return "default";
-    }
-
-    /**
-     * Returns a UserMapping containing all authorization data given within
-     * the XML file specified by the "basic-user-mapping" property in
-     * guacamole.properties. If the XML file has been modified or has not yet
-     * been read, this function may reread the file.
-     *
-     * @return
-     *     A UserMapping containing all authorization data within the user
-     *     mapping XML file, or null if the file cannot be found/parsed.
-     */
-    private UserMapping getUserMapping() {
-
-        // Get user mapping file, defaulting to GUACAMOLE_HOME/user-mapping.xml
-        File userMappingFile;
-        try {
-            userMappingFile = environment.getProperty(BASIC_USER_MAPPING);
-            if (userMappingFile == null)
-                userMappingFile = new File(environment.getGuacamoleHome(), DEFAULT_USER_MAPPING);
-        }
-
-        // Abort if property cannot be parsed
-        catch (GuacamoleException e) {
-            logger.warn("Unable to read user mapping filename from properties: {}", e.getMessage());
-            logger.debug("Error parsing user mapping property.", e);
-            return null;
-        }
-
-        // Abort if user mapping does not exist
-        if (!userMappingFile.exists()) {
-            logger.debug("User mapping file \"{}\" does not exist and will not be read.", userMappingFile);
-            return null;
-        }
-
-        // Refresh user mapping if file has changed
-        if (lastModified < userMappingFile.lastModified()) {
-
-            logger.debug("Reading user mapping file: \"{}\"", userMappingFile);
-
-            // Parse document
-            try {
-
-                // Get handler for root element
-                UserMappingTagHandler userMappingHandler =
-                        new UserMappingTagHandler();
-
-                // Set up document handler
-                DocumentHandler contentHandler = new DocumentHandler(
-                        "user-mapping", userMappingHandler);
-
-                // Set up XML parser
-                XMLReader parser = XMLReaderFactory.createXMLReader();
-                parser.setContentHandler(contentHandler);
-
-                // Read and parse file
-                InputStream input = new BufferedInputStream(new FileInputStream(userMappingFile));
-                parser.parse(new InputSource(input));
-                input.close();
-
-                // Store mod time and user mapping
-                lastModified = userMappingFile.lastModified();
-                cachedUserMapping = userMappingHandler.asUserMapping();
-
-            }
-
-            // If the file is unreadable, return no mapping
-            catch (IOException e) {
-                logger.warn("Unable to read user mapping file \"{}\": {}", userMappingFile, e.getMessage());
-                logger.debug("Error reading user mapping file.", e);
-                return null;
-            }
-
-            // If the file cannot be parsed, return no mapping
-            catch (SAXException e) {
-                logger.warn("User mapping file \"{}\" is not valid: {}", userMappingFile, e.getMessage());
-                logger.debug("Error parsing user mapping file.", e);
-                return null;
-            }
-
-        }
-
-        // Return (possibly cached) user mapping
-        return cachedUserMapping;
-
-    }
-
-    @Override
-    public Map<String, GuacamoleConfiguration>
-            getAuthorizedConfigurations(Credentials credentials)
-            throws GuacamoleException {
-
-        // Abort authorization if no user mapping exists
-        UserMapping userMapping = getUserMapping();
-        if (userMapping == null)
-            return null;
-
-        // Validate and return info for given user and pass
-        Authorization auth = userMapping.getAuthorization(credentials.getUsername());
-        if (auth != null && auth.validate(credentials.getUsername(), credentials.getPassword()))
-            return auth.getConfigurations();
-
-        // Unauthorized
-        return null;
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/8590a0a4/guacamole/src/main/java/org/apache/guacamole/auth/basic/ConnectionTagHandler.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/auth/basic/ConnectionTagHandler.java b/guacamole/src/main/java/org/apache/guacamole/auth/basic/ConnectionTagHandler.java
deleted file mode 100644
index f9acabb..0000000
--- a/guacamole/src/main/java/org/apache/guacamole/auth/basic/ConnectionTagHandler.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2013 Glyptodon LLC
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-package org.apache.guacamole.auth.basic;
-
-import org.apache.guacamole.auth.Authorization;
-import org.apache.guacamole.xml.TagHandler;
-import org.apache.guacamole.protocol.GuacamoleConfiguration;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-
-/**
- * TagHandler for the "connection" element.
- *
- * @author Mike Jumper
- */
-public class ConnectionTagHandler implements TagHandler {
-
-    /**
-     * The GuacamoleConfiguration backing this tag handler.
-     */
-    private GuacamoleConfiguration config = new GuacamoleConfiguration();
-
-    /**
-     * The name associated with the connection being parsed.
-     */
-    private String name;
-
-    /**
-     * The Authorization this connection belongs to.
-     */
-    private Authorization parent;
-
-    /**
-     * Creates a new ConnectionTagHandler that parses a Connection owned by
-     * the given Authorization.
-     *
-     * @param parent The Authorization that will own this Connection once
-     *               parsed.
-     */
-    public ConnectionTagHandler(Authorization parent) {
-        this.parent = parent;
-    }
-
-    @Override
-    public void init(Attributes attributes) throws SAXException {
-        name = attributes.getValue("name");
-        parent.addConfiguration(name, this.asGuacamoleConfiguration());
-    }
-
-    @Override
-    public TagHandler childElement(String localName) throws SAXException {
-
-        if (localName.equals("param"))
-            return new ParamTagHandler(config);
-
-        if (localName.equals("protocol"))
-            return new ProtocolTagHandler(config);
-
-        return null;
-
-    }
-
-    @Override
-    public void complete(String textContent) throws SAXException {
-        // Do nothing
-    }
-
-    /**
-     * Returns a GuacamoleConfiguration whose contents are populated from data
-     * within this connection element and child elements. This
-     * GuacamoleConfiguration will continue to be modified as the user mapping
-     * is parsed.
-     *
-     * @return A GuacamoleConfiguration whose contents are populated from data
-     *         within this connection element.
-     */
-    public GuacamoleConfiguration asGuacamoleConfiguration() {
-        return config;
-    }
-
-    /**
-     * Returns the name associated with this connection.
-     *
-     * @return The name associated with this connection.
-     */
-    public String getName() {
-        return name;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/8590a0a4/guacamole/src/main/java/org/apache/guacamole/auth/basic/ParamTagHandler.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/auth/basic/ParamTagHandler.java b/guacamole/src/main/java/org/apache/guacamole/auth/basic/ParamTagHandler.java
deleted file mode 100644
index 5d3d804..0000000
--- a/guacamole/src/main/java/org/apache/guacamole/auth/basic/ParamTagHandler.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2013 Glyptodon LLC
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-package org.apache.guacamole.auth.basic;
-
-import org.apache.guacamole.xml.TagHandler;
-import org.apache.guacamole.protocol.GuacamoleConfiguration;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-
-/**
- * TagHandler for the "param" element.
- *
- * @author Mike Jumper
- */
-public class ParamTagHandler implements TagHandler {
-
-    /**
-     * The GuacamoleConfiguration which will be populated with data from
-     * the tag handled by this tag handler.
-     */
-    private GuacamoleConfiguration config;
-
-    /**
-     * The name of the parameter.
-     */
-    private String name;
-
-    /**
-     * Creates a new handler for an "param" tag having the given
-     * attributes.
-     *
-     * @param config The GuacamoleConfiguration to update with the data parsed
-     *               from the "protocol" tag.
-     */
-    public ParamTagHandler(GuacamoleConfiguration config) {
-        this.config = config;
-    }
-
-    @Override
-    public void init(Attributes attributes) throws SAXException {
-        this.name = attributes.getValue("name");
-    }
-
-    @Override
-    public TagHandler childElement(String localName) throws SAXException {
-        throw new SAXException("The 'param' tag can contain no elements.");
-    }
-
-    @Override
-    public void complete(String textContent) throws SAXException {
-        config.setParameter(name, textContent);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/8590a0a4/guacamole/src/main/java/org/apache/guacamole/auth/basic/ProtocolTagHandler.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/auth/basic/ProtocolTagHandler.java b/guacamole/src/main/java/org/apache/guacamole/auth/basic/ProtocolTagHandler.java
deleted file mode 100644
index 3fc5f12..0000000
--- a/guacamole/src/main/java/org/apache/guacamole/auth/basic/ProtocolTagHandler.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2013 Glyptodon LLC
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-package org.apache.guacamole.auth.basic;
-
-import org.apache.guacamole.xml.TagHandler;
-import org.apache.guacamole.protocol.GuacamoleConfiguration;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-
-/**
- * TagHandler for the "protocol" element.
- *
- * @author Mike Jumper
- */
-public class ProtocolTagHandler implements TagHandler {
-
-    /**
-     * The GuacamoleConfiguration which will be populated with data from
-     * the tag handled by this tag handler.
-     */
-    private GuacamoleConfiguration config;
-
-    /**
-     * Creates a new handler for a "protocol" tag having the given
-     * attributes.
-     *
-     * @param config The GuacamoleConfiguration to update with the data parsed
-     *               from the "protocol" tag.
-     * @throws SAXException If the attributes given are not valid.
-     */
-    public ProtocolTagHandler(GuacamoleConfiguration config) throws SAXException {
-        this.config = config;
-    }
-
-    @Override
-    public void init(Attributes attributes) throws SAXException {
-        // Do nothing
-    }
-
-    @Override
-    public TagHandler childElement(String localName) throws SAXException {
-        throw new SAXException("The 'protocol' tag can contain no elements.");
-    }
-
-    @Override
-    public void complete(String textContent) throws SAXException {
-        config.setProtocol(textContent);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/8590a0a4/guacamole/src/main/java/org/apache/guacamole/auth/basic/UserMappingTagHandler.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/auth/basic/UserMappingTagHandler.java b/guacamole/src/main/java/org/apache/guacamole/auth/basic/UserMappingTagHandler.java
deleted file mode 100644
index f0bb6fa..0000000
--- a/guacamole/src/main/java/org/apache/guacamole/auth/basic/UserMappingTagHandler.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (C) 2013 Glyptodon LLC
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-package org.apache.guacamole.auth.basic;
-
-import org.apache.guacamole.auth.UserMapping;
-import org.apache.guacamole.xml.TagHandler;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-
-/**
- * TagHandler for the "user-mapping" element.
- *
- * @author Mike Jumper
- */
-public class UserMappingTagHandler implements TagHandler {
-
-    /**
-     * The UserMapping which will contain all data parsed by this tag handler.
-     */
-    private UserMapping user_mapping = new UserMapping();
-
-    @Override
-    public void init(Attributes attributes) throws SAXException {
-        // Do nothing
-    }
-
-    @Override
-    public TagHandler childElement(String localName) throws SAXException {
-
-        // Start parsing of authorize tags, add to list of all authorizations
-        if (localName.equals("authorize"))
-            return new AuthorizeTagHandler(user_mapping);
-
-        return null;
-
-    }
-
-    @Override
-    public void complete(String textContent) throws SAXException {
-        // Do nothing
-    }
-
-    /**
-     * Returns a user mapping containing all authorizations and configurations
-     * parsed so far. This user mapping will be backed by the data being parsed,
-     * thus any additional authorizations or configurations will be available
-     * in the object returned by this function even after this function has
-     * returned, once the data corresponding to those authorizations or
-     * configurations has been parsed.
-     *
-     * @return A user mapping containing all authorizations and configurations
-     *         parsed so far.
-     */
-    public UserMapping asUserMapping() {
-        return user_mapping;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/8590a0a4/guacamole/src/main/java/org/apache/guacamole/auth/basic/package-info.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/auth/basic/package-info.java b/guacamole/src/main/java/org/apache/guacamole/auth/basic/package-info.java
deleted file mode 100644
index d5f8fb7..0000000
--- a/guacamole/src/main/java/org/apache/guacamole/auth/basic/package-info.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2013 Glyptodon LLC
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-/**
- * Classes related to parsing the user-mapping.xml file.
- */
-package org.apache.guacamole.auth.basic;
-

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/8590a0a4/guacamole/src/main/java/org/apache/guacamole/auth/file/Authorization.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/auth/file/Authorization.java b/guacamole/src/main/java/org/apache/guacamole/auth/file/Authorization.java
new file mode 100644
index 0000000..044760c
--- /dev/null
+++ b/guacamole/src/main/java/org/apache/guacamole/auth/file/Authorization.java
@@ -0,0 +1,255 @@
+/*
+ * Copyright (C) 2013 Glyptodon LLC
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+package org.apache.guacamole.auth.file;
+
+import java.io.UnsupportedEncodingException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.Map;
+import java.util.TreeMap;
+import org.apache.guacamole.protocol.GuacamoleConfiguration;
+
+/**
+ * Mapping of username/password pair to configuration set. In addition to basic
+ * storage of the username, password, and configurations, this class also
+ * provides password validation functions.
+ *
+ * @author Mike Jumper
+ */
+public class Authorization {
+
+    /**
+     * All supported password encodings.
+     */
+    public static enum Encoding {
+
+        /**
+         * Plain-text password (not hashed at all).
+         */
+        PLAIN_TEXT,
+
+        /**
+         * Password hashed with MD5.
+         */
+        MD5
+
+    }
+
+    /**
+     * The username being authorized.
+     */
+    private String username;
+
+    /**
+     * The password corresponding to the username being authorized, which may
+     * be hashed.
+     */
+    private String password;
+
+    /**
+     * The encoding used when the password was hashed.
+     */
+    private Encoding encoding = Encoding.PLAIN_TEXT;
+
+    /**
+     * Map of all authorized configurations, indexed by configuration name.
+     */
+    private Map<String, GuacamoleConfiguration> configs = new
+            TreeMap<String, GuacamoleConfiguration>();
+
+    /**
+     * Lookup table of hex bytes characters by value.
+     */
+    private static final char HEX_CHARS[] = {
+        '0', '1', '2', '3', '4', '5', '6', '7',
+        '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
+    };
+
+    /**
+     * Produces a String containing the bytes provided in hexadecimal notation.
+     *
+     * @param bytes The bytes to convert into hex.
+     * @return A String containing the hex representation of the given bytes.
+     */
+    private static String getHexString(byte[] bytes) {
+
+        // If null byte array given, return null
+        if (bytes == null)
+            return null;
+
+        // Create string builder for holding the hex representation,
+        // pre-calculating the exact length
+        StringBuilder hex = new StringBuilder(2 * bytes.length);
+
+        // Convert each byte into a pair of hex digits
+        for (byte b : bytes) {
+            hex.append(HEX_CHARS[(b & 0xF0) >> 4])
+               .append(HEX_CHARS[ b & 0x0F      ]);
+        }
+
+        // Return the string produced
+        return hex.toString();
+
+    }
+
+    /**
+     * Returns the username associated with this authorization.
+     *
+     * @return The username associated with this authorization.
+     */
+    public String getUsername() {
+        return username;
+    }
+
+    /**
+     * Sets the username associated with this authorization.
+     *
+     * @param username The username to associate with this authorization.
+     */
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    /**
+     * Returns the password associated with this authorization, which may be
+     * encoded or hashed.
+     *
+     * @return The password associated with this authorization.
+     */
+    public String getPassword() {
+        return password;
+    }
+
+    /**
+     * Sets the password associated with this authorization, which must be
+     * encoded using the encoding specified with setEncoding(). By default,
+     * passwords are plain text.
+     *
+     * @param password Sets the password associated with this authorization.
+     */
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    /**
+     * Returns the encoding used to hash the password, if any.
+     *
+     * @return The encoding used to hash the password.
+     */
+    public Encoding getEncoding() {
+        return encoding;
+    }
+
+    /**
+     * Sets the encoding which will be used to hash the password or when
+     * comparing a given password for validation.
+     *
+     * @param encoding The encoding to use for password hashing.
+     */
+    public void setEncoding(Encoding encoding) {
+        this.encoding = encoding;
+    }
+
+    /**
+     * Returns whether a given username/password pair is authorized based on
+     * the stored username and password. The password given must be plain text.
+     * It will be hashed as necessary to perform the validation.
+     *
+     * @param username The username to validate.
+     * @param password The password to validate.
+     * @return true if the username/password pair given is authorized, false
+     *         otherwise.
+     */
+    public boolean validate(String username, String password) {
+
+        // If username matches
+        if (username != null && password != null
+                && username.equals(this.username)) {
+
+            switch (encoding) {
+
+                // If plain text, just compare
+                case PLAIN_TEXT:
+
+                    // Compare plaintext
+                    return password.equals(this.password);
+
+                // If hased with MD5, hash password and compare
+                case MD5:
+
+                    // Compare hashed password
+                    try {
+                        MessageDigest digest = MessageDigest.getInstance("MD5");
+                        String hashedPassword = getHexString(digest.digest(password.getBytes("UTF-8")));
+                        return hashedPassword.equals(this.password.toUpperCase());
+                    }
+                    catch (UnsupportedEncodingException e) {
+                        throw new UnsupportedOperationException("Unexpected lack of UTF-8 support.", e);
+                    }
+                    catch (NoSuchAlgorithmException e) {
+                        throw new UnsupportedOperationException("Unexpected lack of MD5 support.", e);
+                    }
+
+            }
+
+        } // end validation check
+
+        return false;
+
+    }
+
+    /**
+     * Returns the GuacamoleConfiguration having the given name and associated
+     * with the username/password pair stored within this authorization.
+     *
+     * @param name The name of the GuacamoleConfiguration to return.
+     * @return The GuacamoleConfiguration having the given name, or null if no
+     *         such GuacamoleConfiguration exists.
+     */
+    public GuacamoleConfiguration getConfiguration(String name) {
+        return configs.get(name);
+    }
+
+    /**
+     * Adds the given GuacamoleConfiguration to the set of stored configurations
+     * under the given name.
+     *
+     * @param name The name to associate this GuacamoleConfiguration with.
+     * @param config The GuacamoleConfiguration to store.
+     */
+    public void addConfiguration(String name, GuacamoleConfiguration config) {
+        configs.put(name, config);
+    }
+
+    /**
+     * Returns a Map of all stored GuacamoleConfigurations associated with the
+     * username/password pair stored within this authorization, indexed by
+     * configuration name.
+     *
+     * @return A Map of all stored GuacamoleConfigurations.
+     */
+    public Map<String, GuacamoleConfiguration> getConfigurations() {
+        return configs;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/8590a0a4/guacamole/src/main/java/org/apache/guacamole/auth/file/AuthorizeTagHandler.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/auth/file/AuthorizeTagHandler.java b/guacamole/src/main/java/org/apache/guacamole/auth/file/AuthorizeTagHandler.java
new file mode 100644
index 0000000..8d3c55e
--- /dev/null
+++ b/guacamole/src/main/java/org/apache/guacamole/auth/file/AuthorizeTagHandler.java
@@ -0,0 +1,149 @@
+/*
+ * Copyright (C) 2013 Glyptodon LLC
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+package org.apache.guacamole.auth.file;
+
+import org.apache.guacamole.xml.TagHandler;
+import org.apache.guacamole.protocol.GuacamoleConfiguration;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * TagHandler for the "authorize" element.
+ *
+ * @author Mike Jumper
+ */
+public class AuthorizeTagHandler implements TagHandler {
+
+    /**
+     * The Authorization corresponding to the "authorize" tag being handled
+     * by this tag handler. The data of this Authorization will be populated
+     * as the tag is parsed.
+     */
+    private Authorization authorization = new Authorization();
+
+    /**
+     * The default GuacamoleConfiguration to use if "param" or "protocol"
+     * tags occur outside a "connection" tag.
+     */
+    private GuacamoleConfiguration default_config = null;
+
+    /**
+     * The UserMapping this authorization belongs to.
+     */
+    private UserMapping parent;
+
+    /**
+     * Creates a new AuthorizeTagHandler that parses an Authorization owned
+     * by the given UserMapping.
+     *
+     * @param parent The UserMapping that owns the Authorization this handler
+     *               will parse.
+     */
+    public AuthorizeTagHandler(UserMapping parent) {
+        this.parent = parent;
+    }
+
+    @Override
+    public void init(Attributes attributes) throws SAXException {
+
+        // Init username and password
+        authorization.setUsername(attributes.getValue("username"));
+        authorization.setPassword(attributes.getValue("password"));
+
+        // Get encoding
+        String encoding = attributes.getValue("encoding");
+        if (encoding != null) {
+
+            // If "md5", use MD5 encoding
+            if (encoding.equals("md5"))
+                authorization.setEncoding(Authorization.Encoding.MD5);
+
+            // If "plain", use plain text
+            else if (encoding.equals("plain"))
+                authorization.setEncoding(Authorization.Encoding.PLAIN_TEXT);
+
+            // Otherwise, bad encoding
+            else
+                throw new SAXException(
+                        "Invalid encoding: '" + encoding + "'");
+
+        }
+
+        parent.addAuthorization(this.asAuthorization());
+
+    }
+
+    @Override
+    public TagHandler childElement(String localName) throws SAXException {
+
+        // "connection" tag
+        if (localName.equals("connection"))
+            return new ConnectionTagHandler(authorization);
+
+        // "param" tag
+        if (localName.equals("param")) {
+
+            // Create default config if it doesn't exist
+            if (default_config == null) {
+                default_config = new GuacamoleConfiguration();
+                authorization.addConfiguration("DEFAULT", default_config);
+            }
+
+            return new ParamTagHandler(default_config);
+        }
+
+        // "protocol" tag
+        if (localName.equals("protocol")) {
+
+            // Create default config if it doesn't exist
+            if (default_config == null) {
+                default_config = new GuacamoleConfiguration();
+                authorization.addConfiguration("DEFAULT", default_config);
+            }
+
+            return new ProtocolTagHandler(default_config);
+        }
+
+        return null;
+
+    }
+
+    @Override
+    public void complete(String textContent) throws SAXException {
+        // Do nothing
+    }
+
+    /**
+     * Returns an Authorization backed by the data of this authorize tag
+     * handler. This Authorization is guaranteed to at least have the username,
+     * password, and encoding available. Any associated configurations will be
+     * added dynamically as the authorize tag is parsed.
+     *
+     * @return An Authorization backed by the data of this authorize tag
+     *         handler.
+     */
+    public Authorization asAuthorization() {
+        return authorization;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/8590a0a4/guacamole/src/main/java/org/apache/guacamole/auth/file/ConnectionTagHandler.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/auth/file/ConnectionTagHandler.java b/guacamole/src/main/java/org/apache/guacamole/auth/file/ConnectionTagHandler.java
new file mode 100644
index 0000000..5f069a2
--- /dev/null
+++ b/guacamole/src/main/java/org/apache/guacamole/auth/file/ConnectionTagHandler.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2013 Glyptodon LLC
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+package org.apache.guacamole.auth.file;
+
+import org.apache.guacamole.xml.TagHandler;
+import org.apache.guacamole.protocol.GuacamoleConfiguration;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * TagHandler for the "connection" element.
+ *
+ * @author Mike Jumper
+ */
+public class ConnectionTagHandler implements TagHandler {
+
+    /**
+     * The GuacamoleConfiguration backing this tag handler.
+     */
+    private GuacamoleConfiguration config = new GuacamoleConfiguration();
+
+    /**
+     * The name associated with the connection being parsed.
+     */
+    private String name;
+
+    /**
+     * The Authorization this connection belongs to.
+     */
+    private Authorization parent;
+
+    /**
+     * Creates a new ConnectionTagHandler that parses a Connection owned by
+     * the given Authorization.
+     *
+     * @param parent The Authorization that will own this Connection once
+     *               parsed.
+     */
+    public ConnectionTagHandler(Authorization parent) {
+        this.parent = parent;
+    }
+
+    @Override
+    public void init(Attributes attributes) throws SAXException {
+        name = attributes.getValue("name");
+        parent.addConfiguration(name, this.asGuacamoleConfiguration());
+    }
+
+    @Override
+    public TagHandler childElement(String localName) throws SAXException {
+
+        if (localName.equals("param"))
+            return new ParamTagHandler(config);
+
+        if (localName.equals("protocol"))
+            return new ProtocolTagHandler(config);
+
+        return null;
+
+    }
+
+    @Override
+    public void complete(String textContent) throws SAXException {
+        // Do nothing
+    }
+
+    /**
+     * Returns a GuacamoleConfiguration whose contents are populated from data
+     * within this connection element and child elements. This
+     * GuacamoleConfiguration will continue to be modified as the user mapping
+     * is parsed.
+     *
+     * @return A GuacamoleConfiguration whose contents are populated from data
+     *         within this connection element.
+     */
+    public GuacamoleConfiguration asGuacamoleConfiguration() {
+        return config;
+    }
+
+    /**
+     * Returns the name associated with this connection.
+     *
+     * @return The name associated with this connection.
+     */
+    public String getName() {
+        return name;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/8590a0a4/guacamole/src/main/java/org/apache/guacamole/auth/file/FileAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/auth/file/FileAuthenticationProvider.java b/guacamole/src/main/java/org/apache/guacamole/auth/file/FileAuthenticationProvider.java
new file mode 100644
index 0000000..75230fd
--- /dev/null
+++ b/guacamole/src/main/java/org/apache/guacamole/auth/file/FileAuthenticationProvider.java
@@ -0,0 +1,226 @@
+/*
+ * Copyright (C) 2013 Glyptodon LLC
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+package org.apache.guacamole.auth.file;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Map;
+import org.apache.guacamole.GuacamoleException;
+import org.apache.guacamole.environment.Environment;
+import org.apache.guacamole.environment.LocalEnvironment;
+import org.apache.guacamole.net.auth.Credentials;
+import org.apache.guacamole.net.auth.simple.SimpleAuthenticationProvider;
+import org.apache.guacamole.xml.DocumentHandler;
+import org.apache.guacamole.properties.FileGuacamoleProperty;
+import org.apache.guacamole.protocol.GuacamoleConfiguration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+/**
+ * Authenticates users against a static list of username/password pairs.
+ * Each username/password may be associated with multiple configurations.
+ * This list is stored in an XML file which is reread if modified.
+ *
+ * @author Michael Jumper, Michal Kotas
+ */
+public class FileAuthenticationProvider extends SimpleAuthenticationProvider {
+
+    /**
+     * Logger for this class.
+     */
+    private final Logger logger = LoggerFactory.getLogger(FileAuthenticationProvider.class);
+
+    /**
+     * The time the user mapping file was last modified. If the file has never
+     * been read, and thus no modification time exists, this will be
+     * Long.MIN_VALUE.
+     */
+    private long lastModified = Long.MIN_VALUE;
+
+    /**
+     * The parsed UserMapping read when the user mapping file was last parsed.
+     */
+    private UserMapping cachedUserMapping;
+
+    /**
+     * Guacamole server environment.
+     */
+    private final Environment environment;
+
+    /**
+     * The XML file to read the user mapping from. This property has been
+     * deprecated, as the name "basic" is ridiculous, and providing for
+     * configurable user-mapping.xml locations is unnecessary complexity. Use
+     * GUACAMOLE_HOME/user-mapping.xml instead.
+     */
+    @Deprecated
+    public static final FileGuacamoleProperty BASIC_USER_MAPPING = new FileGuacamoleProperty() {
+
+        @Override
+        public String getName() { return "basic-user-mapping"; }
+
+    };
+
+    /**
+     * The filename to use for the user mapping.
+     */
+    public static final String USER_MAPPING_FILENAME = "user-mapping.xml";
+    
+    /**
+     * Creates a new BasicFileAuthenticationProvider that authenticates users
+     * against simple, monolithic XML file.
+     *
+     * @throws GuacamoleException
+     *     If a required property is missing, or an error occurs while parsing
+     *     a property.
+     */
+    public FileAuthenticationProvider() throws GuacamoleException {
+        environment = new LocalEnvironment();
+    }
+
+    @Override
+    public String getIdentifier() {
+        return "default";
+    }
+
+    /**
+     * Returns a UserMapping containing all authorization data given within
+     * the XML file specified by the "basic-user-mapping" property in
+     * guacamole.properties. If the XML file has been modified or has not yet
+     * been read, this function may reread the file.
+     *
+     * @return
+     *     A UserMapping containing all authorization data within the user
+     *     mapping XML file, or null if the file cannot be found/parsed.
+     */
+    @SuppressWarnings("deprecation") // We must continue to use the "basic-user-mapping" property until it is truly no longer supported
+    private UserMapping getUserMapping() {
+
+        // Get user mapping file, defaulting to GUACAMOLE_HOME/user-mapping.xml
+        File userMappingFile;
+        try {
+
+            // Continue supporting deprecated property, but warn in the logs
+            userMappingFile = environment.getProperty(BASIC_USER_MAPPING);
+            if (userMappingFile != null)
+                logger.warn("The \"basic-user-mapping\" property is deprecated. Please use the \"GUACAMOLE_HOME/user-mapping.xml\" file instead.");
+
+            // Read user mapping from GUACAMOLE_HOME
+            if (userMappingFile == null)
+                userMappingFile = new File(environment.getGuacamoleHome(), USER_MAPPING_FILENAME);
+
+        }
+
+        // Abort if property cannot be parsed
+        catch (GuacamoleException e) {
+            logger.warn("Unable to read user mapping filename from properties: {}", e.getMessage());
+            logger.debug("Error parsing user mapping property.", e);
+            return null;
+        }
+
+        // Abort if user mapping does not exist
+        if (!userMappingFile.exists()) {
+            logger.debug("User mapping file \"{}\" does not exist and will not be read.", userMappingFile);
+            return null;
+        }
+
+        // Refresh user mapping if file has changed
+        if (lastModified < userMappingFile.lastModified()) {
+
+            logger.debug("Reading user mapping file: \"{}\"", userMappingFile);
+
+            // Parse document
+            try {
+
+                // Get handler for root element
+                UserMappingTagHandler userMappingHandler =
+                        new UserMappingTagHandler();
+
+                // Set up document handler
+                DocumentHandler contentHandler = new DocumentHandler(
+                        "user-mapping", userMappingHandler);
+
+                // Set up XML parser
+                XMLReader parser = XMLReaderFactory.createXMLReader();
+                parser.setContentHandler(contentHandler);
+
+                // Read and parse file
+                InputStream input = new BufferedInputStream(new FileInputStream(userMappingFile));
+                parser.parse(new InputSource(input));
+                input.close();
+
+                // Store mod time and user mapping
+                lastModified = userMappingFile.lastModified();
+                cachedUserMapping = userMappingHandler.asUserMapping();
+
+            }
+
+            // If the file is unreadable, return no mapping
+            catch (IOException e) {
+                logger.warn("Unable to read user mapping file \"{}\": {}", userMappingFile, e.getMessage());
+                logger.debug("Error reading user mapping file.", e);
+                return null;
+            }
+
+            // If the file cannot be parsed, return no mapping
+            catch (SAXException e) {
+                logger.warn("User mapping file \"{}\" is not valid: {}", userMappingFile, e.getMessage());
+                logger.debug("Error parsing user mapping file.", e);
+                return null;
+            }
+
+        }
+
+        // Return (possibly cached) user mapping
+        return cachedUserMapping;
+
+    }
+
+    @Override
+    public Map<String, GuacamoleConfiguration>
+            getAuthorizedConfigurations(Credentials credentials)
+            throws GuacamoleException {
+
+        // Abort authorization if no user mapping exists
+        UserMapping userMapping = getUserMapping();
+        if (userMapping == null)
+            return null;
+
+        // Validate and return info for given user and pass
+        Authorization auth = userMapping.getAuthorization(credentials.getUsername());
+        if (auth != null && auth.validate(credentials.getUsername(), credentials.getPassword()))
+            return auth.getConfigurations();
+
+        // Unauthorized
+        return null;
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/8590a0a4/guacamole/src/main/java/org/apache/guacamole/auth/file/ParamTagHandler.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/auth/file/ParamTagHandler.java b/guacamole/src/main/java/org/apache/guacamole/auth/file/ParamTagHandler.java
new file mode 100644
index 0000000..8fee87e
--- /dev/null
+++ b/guacamole/src/main/java/org/apache/guacamole/auth/file/ParamTagHandler.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2013 Glyptodon LLC
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+package org.apache.guacamole.auth.file;
+
+import org.apache.guacamole.xml.TagHandler;
+import org.apache.guacamole.protocol.GuacamoleConfiguration;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * TagHandler for the "param" element.
+ *
+ * @author Mike Jumper
+ */
+public class ParamTagHandler implements TagHandler {
+
+    /**
+     * The GuacamoleConfiguration which will be populated with data from
+     * the tag handled by this tag handler.
+     */
+    private GuacamoleConfiguration config;
+
+    /**
+     * The name of the parameter.
+     */
+    private String name;
+
+    /**
+     * Creates a new handler for an "param" tag having the given
+     * attributes.
+     *
+     * @param config The GuacamoleConfiguration to update with the data parsed
+     *               from the "protocol" tag.
+     */
+    public ParamTagHandler(GuacamoleConfiguration config) {
+        this.config = config;
+    }
+
+    @Override
+    public void init(Attributes attributes) throws SAXException {
+        this.name = attributes.getValue("name");
+    }
+
+    @Override
+    public TagHandler childElement(String localName) throws SAXException {
+        throw new SAXException("The 'param' tag can contain no elements.");
+    }
+
+    @Override
+    public void complete(String textContent) throws SAXException {
+        config.setParameter(name, textContent);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/8590a0a4/guacamole/src/main/java/org/apache/guacamole/auth/file/ProtocolTagHandler.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/auth/file/ProtocolTagHandler.java b/guacamole/src/main/java/org/apache/guacamole/auth/file/ProtocolTagHandler.java
new file mode 100644
index 0000000..8f1aecd
--- /dev/null
+++ b/guacamole/src/main/java/org/apache/guacamole/auth/file/ProtocolTagHandler.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2013 Glyptodon LLC
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+package org.apache.guacamole.auth.file;
+
+import org.apache.guacamole.xml.TagHandler;
+import org.apache.guacamole.protocol.GuacamoleConfiguration;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * TagHandler for the "protocol" element.
+ *
+ * @author Mike Jumper
+ */
+public class ProtocolTagHandler implements TagHandler {
+
+    /**
+     * The GuacamoleConfiguration which will be populated with data from
+     * the tag handled by this tag handler.
+     */
+    private GuacamoleConfiguration config;
+
+    /**
+     * Creates a new handler for a "protocol" tag having the given
+     * attributes.
+     *
+     * @param config The GuacamoleConfiguration to update with the data parsed
+     *               from the "protocol" tag.
+     * @throws SAXException If the attributes given are not valid.
+     */
+    public ProtocolTagHandler(GuacamoleConfiguration config) throws SAXException {
+        this.config = config;
+    }
+
+    @Override
+    public void init(Attributes attributes) throws SAXException {
+        // Do nothing
+    }
+
+    @Override
+    public TagHandler childElement(String localName) throws SAXException {
+        throw new SAXException("The 'protocol' tag can contain no elements.");
+    }
+
+    @Override
+    public void complete(String textContent) throws SAXException {
+        config.setProtocol(textContent);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/8590a0a4/guacamole/src/main/java/org/apache/guacamole/auth/file/UserMapping.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/auth/file/UserMapping.java b/guacamole/src/main/java/org/apache/guacamole/auth/file/UserMapping.java
new file mode 100644
index 0000000..b857d19
--- /dev/null
+++ b/guacamole/src/main/java/org/apache/guacamole/auth/file/UserMapping.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2013 Glyptodon LLC
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+package org.apache.guacamole.auth.file;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Mapping of all usernames to corresponding authorizations.
+ *
+ * @author Mike Jumper
+ */
+public class UserMapping {
+
+    /**
+     * All authorizations, indexed by username.
+     */
+    private Map<String, Authorization> authorizations =
+            new HashMap<String, Authorization>();
+
+    /**
+     * Adds the given authorization to the user mapping.
+     *
+     * @param authorization The authorization to add to the user mapping.
+     */
+    public void addAuthorization(Authorization authorization) {
+        authorizations.put(authorization.getUsername(), authorization);
+    }
+
+    /**
+     * Returns the authorization corresponding to the user having the given
+     * username, if any.
+     *
+     * @param username The username to find the authorization for.
+     * @return The authorization corresponding to the user having the given
+     *         username, or null if no such authorization exists.
+     */
+    public Authorization getAuthorization(String username) {
+        return authorizations.get(username);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/8590a0a4/guacamole/src/main/java/org/apache/guacamole/auth/file/UserMappingTagHandler.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/auth/file/UserMappingTagHandler.java b/guacamole/src/main/java/org/apache/guacamole/auth/file/UserMappingTagHandler.java
new file mode 100644
index 0000000..a707232
--- /dev/null
+++ b/guacamole/src/main/java/org/apache/guacamole/auth/file/UserMappingTagHandler.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2013 Glyptodon LLC
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+package org.apache.guacamole.auth.file;
+
+import org.apache.guacamole.xml.TagHandler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * TagHandler for the "user-mapping" element.
+ *
+ * @author Mike Jumper
+ */
+public class UserMappingTagHandler implements TagHandler {
+
+    /**
+     * The UserMapping which will contain all data parsed by this tag handler.
+     */
+    private UserMapping user_mapping = new UserMapping();
+
+    @Override
+    public void init(Attributes attributes) throws SAXException {
+        // Do nothing
+    }
+
+    @Override
+    public TagHandler childElement(String localName) throws SAXException {
+
+        // Start parsing of authorize tags, add to list of all authorizations
+        if (localName.equals("authorize"))
+            return new AuthorizeTagHandler(user_mapping);
+
+        return null;
+
+    }
+
+    @Override
+    public void complete(String textContent) throws SAXException {
+        // Do nothing
+    }
+
+    /**
+     * Returns a user mapping containing all authorizations and configurations
+     * parsed so far. This user mapping will be backed by the data being parsed,
+     * thus any additional authorizations or configurations will be available
+     * in the object returned by this function even after this function has
+     * returned, once the data corresponding to those authorizations or
+     * configurations has been parsed.
+     *
+     * @return A user mapping containing all authorizations and configurations
+     *         parsed so far.
+     */
+    public UserMapping asUserMapping() {
+        return user_mapping;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/8590a0a4/guacamole/src/main/java/org/apache/guacamole/auth/file/package-info.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/auth/file/package-info.java b/guacamole/src/main/java/org/apache/guacamole/auth/file/package-info.java
new file mode 100644
index 0000000..72534a7
--- /dev/null
+++ b/guacamole/src/main/java/org/apache/guacamole/auth/file/package-info.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2013 Glyptodon LLC
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/**
+ * Classes which drive the default, file-based authentication of the Guacamole
+ * web application.
+ */
+package org.apache.guacamole.auth.file;
+

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/8590a0a4/guacamole/src/main/java/org/apache/guacamole/auth/package-info.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/auth/package-info.java b/guacamole/src/main/java/org/apache/guacamole/auth/package-info.java
deleted file mode 100644
index d1ac69e..0000000
--- a/guacamole/src/main/java/org/apache/guacamole/auth/package-info.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2013 Glyptodon LLC
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-/**
- * Classes which drive the default, basic authentication of the Guacamole
- * web application.
- */
-package org.apache.guacamole.auth;
-

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/8590a0a4/guacamole/src/main/java/org/apache/guacamole/extension/ExtensionModule.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/extension/ExtensionModule.java b/guacamole/src/main/java/org/apache/guacamole/extension/ExtensionModule.java
index b81593c..3823fbc 100644
--- a/guacamole/src/main/java/org/apache/guacamole/extension/ExtensionModule.java
+++ b/guacamole/src/main/java/org/apache/guacamole/extension/ExtensionModule.java
@@ -32,7 +32,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
-import org.apache.guacamole.auth.basic.BasicFileAuthenticationProvider;
+import org.apache.guacamole.auth.file.FileAuthenticationProvider;
 import org.apache.guacamole.GuacamoleException;
 import org.apache.guacamole.GuacamoleServerException;
 import org.apache.guacamole.environment.Environment;
@@ -426,8 +426,8 @@ public class ExtensionModule extends ServletModule {
         // Load all extensions
         loadExtensions(javaScriptResources, cssResources);
 
-        // Always bind basic auth last
-        bindAuthenticationProvider(BasicFileAuthenticationProvider.class);
+        // Always bind default file-driven auth last
+        bindAuthenticationProvider(FileAuthenticationProvider.class);
 
         // Dynamically generate app.js and app.css from extensions
         serve("/app.js").with(new ResourceServlet(new SequenceResource(javaScriptResources)));



Mime
View raw message