Package net.sourceforge.guacamole.net.auth.mysql.model

Examples of net.sourceforge.guacamole.net.auth.mysql.model.UserWithBLOBs


     * @return The existing MySQLUser object if found, null otherwise.
     */
    public MySQLUser retrieveUser(int id) {

        // Query user by ID
        UserWithBLOBs user = userDAO.selectByPrimaryKey(id);

        // If no user found, return null
        if(user == null)
            return null;

View Full Code Here


        // Assert only one user found
        assert users.size() == 1 : "Multiple users with same username.";

        // Get first (and only) user
        UserWithBLOBs user = users.get(0);

        // Check password, if invalid return null
        if (!passwordService.checkPassword(credentials.getPassword(),
                user.getPassword_hash(), user.getPassword_salt()))
            return null;

        // Return found user
        return toMySQLUser(user);
View Full Code Here

     *         user.
     */
    public MySQLUser createUser(String username, String password) {

        // Initialize database user
        UserWithBLOBs user = new UserWithBLOBs();
        user.setUsername(username);

        // Set password if specified
        if (password != null) {
            byte[] salt = saltService.generateSalt();
            user.setPassword_salt(salt);
            user.setPassword_hash(
                passwordService.createPasswordHash(password, salt));
        }

        // Create user
        userDAO.insert(user);
View Full Code Here

     * @param mySQLUser The MySQLUser to update (save) to the database. This
     *                  user must already exist.
     */
    public void updateUser(MySQLUser mySQLUser) {

        UserWithBLOBs user = new UserWithBLOBs();
        user.setUser_id(mySQLUser.getUserID());
        user.setUsername(mySQLUser.getUsername());

        // Set password if specified
        if (mySQLUser.getPassword() != null) {
            byte[] salt = saltService.generateSalt();
            user.setPassword_salt(salt);
            user.setPassword_hash(
                passwordService.createPasswordHash(mySQLUser.getPassword(), salt));
        }

        // Update the user in the database
        userDAO.updateByPrimaryKeySelective(user);
View Full Code Here

TOP

Related Classes of net.sourceforge.guacamole.net.auth.mysql.model.UserWithBLOBs

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.