private UserMapping getUserMapping() {

        // Read user mapping from GUACAMOLE_HOME/user-mapping.xml
        File userMappingFile = new File(environment.getGuacamoleHome(), USER_MAPPING_FILENAME);

        // 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);

            // Set up XML parser
            SAXParser parser;
            try {
                parser = SAXParserFactory.newInstance().newSAXParser();
            }
            catch (ParserConfigurationException e) {
                logger.error("Unable to create XML parser for reading \"{}\": {}", USER_MAPPING_FILENAME, e.getMessage());
                logger.debug("An instance of SAXParser could not be created.", e);
                return null;
            }
            catch (SAXException e) {
                logger.error("Unable to create XML parser for reading \"{}\": {}", USER_MAPPING_FILENAME, e.getMessage());
                logger.debug("An instance of SAXParser could not be created.", e);
                return null;
            }

            // Parse document
            try {

                // Get handler for root element
                UserMappingTagHandler userMappingHandler =
                        new UserMappingTagHandler();

                // Set up document handler
                DocumentHandler contentHandler = new DocumentHandler(
                        "user-mapping", userMappingHandler);

                // Read and parse file
                parser.parse(userMappingFile, contentHandler);

                // 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;

    }
Returns a UserMapping containing all authorization data given within
GUACAMOLE_HOME/user-mapping.xml. 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.
guacamole/src/main/java/org/apache/guacamole/auth/file/FileAuthenticationProvider.java