<commit_before>
package net.sourceforge.guacamole.net.authentication.basic;

import javax.servlet.http.HttpSession;
import net.sourceforge.guacamole.GuacamoleClient;
import net.sourceforge.guacamole.GuacamoleException;
import net.sourceforge.guacamole.net.Configuration;
import net.sourceforge.guacamole.net.GuacamoleSession;
import net.sourceforge.guacamole.net.authentication.GuacamoleClientProvider;

/*
 *  Guacamole - Clientless Remote Desktop
 *  Copyright (C) 2010  <NAME>
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Affero General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Affero General Public License for more details.
 *
 *  You should have received a copy of the GNU Affero General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

public class BasicGuacamoleClientProvider implements GuacamoleClientProvider {

    public GuacamoleClient createClient(HttpSession session) throws GuacamoleException {

        // Retrieve authorized config data from session
        Configuration config = (Configuration) session.getAttribute("BASIC-LOGIN-AUTH");

        // If no data, not authorized
        if (config == null)
            throw new GuacamoleException("Unauthorized");

        GuacamoleClient client = new GuacamoleClient("localhost", 4822);

        // TODO: Send "select" and "connect" messages in client connect function (based on config) ... to be implemented.
        char[] initMessages = "select:vnc;connect:localhost,5901,potato;".toCharArray();
        client.write(initMessages, 0, initMessages.length);

        // Return authorized session
        return client;

    }

}<commit_msg>Implementing API improvements made in guacamole-common<commit_after>
package net.sourceforge.guacamole.net.authentication.basic;

import javax.servlet.http.HttpSession;
import net.sourceforge.guacamole.GuacamoleTCPClient;
import net.sourceforge.guacamole.GuacamoleException;
import net.sourceforge.guacamole.net.Configuration;
import net.sourceforge.guacamole.net.GuacamoleProperties;
import net.sourceforge.guacamole.net.authentication.GuacamoleClientProvider;

/*
 *  Guacamole - Clientless Remote Desktop
 *  Copyright (C) 2010  <NAME>
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Affero General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Affero General Public License for more details.
 *
 *  You should have received a copy of the GNU Affero General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

public class BasicGuacamoleClientProvider implements GuacamoleClientProvider {

    public GuacamoleTCPClient createClient(HttpSession session) throws GuacamoleException {

        // Retrieve authorized config data from session
        Configuration config = (Configuration) session.getAttribute("BASIC-LOGIN-AUTH");

        // If no data, not authorized
        if (config == null)
            throw new GuacamoleException("Unauthorized");

        String hostname = GuacamoleProperties.getProperty("guacd-hostname");
        int port = GuacamoleProperties.getIntProperty("guacd-port", null);

        GuacamoleTCPClient client = new GuacamoleTCPClient(hostname, port);

        // Return authorized session
        return client;

    }

}
{'fraction_non_alphanumeric': 0.07525, 'fraction_numerical': 0.00475, 'mean_word_length': 3.879268292682927, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7064809', 'n_tokens_mistral': 1117, 'n_tokens_neox': 1076, 'n_words': 368}