def METHOD_NAME(self, configurationAttributes, requestParameters, step):
    userService = CdiUtil.bean(UserService)
    authenticationService = CdiUtil.bean(AuthenticationService)
    identity = CdiUtil.bean(Identity)
    credentials = identity.getCredentials()
    user_name = credentials.getUsername()
    if (step == 1):
        print "Basic (with password update). Authenticate for step 1"
        user_password = credentials.getPassword()
        logged_in = False
        if (StringHelper.isNotEmptyString(user_name) and StringHelper.isNotEmptyString(user_password)):
            logged_in = authenticationService.METHOD_NAME(user_name, user_password)
        if (not logged_in):
            return False
        return True
    elif (step == 2):
        print "Basic (with password update). Authenticate for step 2"
        user = authenticationService.getAuthenticatedUser()
        if user == None:
            print "Basic (with password update). Authenticate for step 2. Failed to determine user name"
            return False
        user_name = user.getUserId()
        find_user_by_uid = userService.getUser(user_name)
        update_button = requestParameters.get("loginForm:updateButton")
        if ArrayHelper.isEmpty(update_button):
            return True
        new_password_array = requestParameters.get("new_password")
        if ArrayHelper.isEmpty(new_password_array) or StringHelper.isEmpty(new_password_array[0]):
            print "Basic (with password update). Authenticate for step 2. New password is empty"
            return False
        new_password = new_password_array[0]
        find_user_by_uid.setAttribute("userPassword", new_password)
        print "Basic (with password update). Authenticate for step 2. Attempting to set new user '%s' password" % user_name
        userService.updateUser(find_user_by_uid)
        print "Basic (with password update). Authenticate for step 2. Password updated successfully"
        return True
    else:
        return False