public ModeledUser retrieveUser(AuthenticationProvider authenticationProvider,
            AuthenticatedUser authenticatedUser) throws GuacamoleException {

        // Retrieve corresponding user model, if such a user exists
        UserModel userModel = userMapper.selectOne(authenticatedUser.getIdentifier(),
                getCaseSensitivity());
        if (userModel == null)
            return null;

        // Create corresponding user object, set up cyclic reference
        ModeledUser user = getObjectInstance(null, userModel);
        user.setCurrentUser(new ModeledAuthenticatedUser(authenticatedUser,
                authenticationProvider, user));

        // Return already-authenticated user
        return user;

    }
Retrieves the user corresponding to the given AuthenticatedUser from the
database.

@param authenticationProvider
    The AuthenticationProvider on behalf of which the user is being
    retrieved.

@param authenticatedUser
    The AuthenticatedUser to retrieve the corresponding ModeledUser of.

@return
    The ModeledUser which corresponds to the given AuthenticatedUser, or
    null if no such user exists.

@throws GuacamoleException
    If a ModeledUser object for the user corresponding to the given
    AuthenticatedUser cannot be created.
extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/UserService.java