def wrapper(profile_name, *args, **kwargs):
     profile_name = profile_name or profile_utils.DEFAULT_PROFILE_NAME
     profile = profile_utils.get_profile(profile_name)
     secret = getattr(profile, 'APP_SECRET', None)
     if secret:
         prompt.show_warning(auth_login_msg.format('login', 'authentication'))
     f = func(profile_name, profile, *args, **kwargs)
     if secret:
         profile_utils.remove_profile_value(profile.NAME, secret)
     return f
 def wrapper(profile_name, *args, **kwargs):
     profile_name = profile_name or profile_utils.DEFAULT_PROFILE_NAME
     profile = profile_utils.get_profile(profile_name)
     username = getattr(profile, 'USERNAME', None)
     if username:
         prompt.show_warning(auth_login_msg.format('authentication', 'login'))
     f = func(profile_name, profile, *args, **kwargs)
     if username:
         profile_utils.remove_profile_value(profile.NAME, username)
     return f
 def wrapper(profile_name, *args, **kwargs):
     profile_name = profile_name or profile_utils.DEFAULT_PROFILE_NAME
     keyargs, removal, formatargs = profile_utils.get_auth_check_and_removal(funcname, profile_name)
     if kwargs:
         kwargs.update(keyargs)
     else:
         kwargs = keyargs
     if removal:
         prompt.show_auth_login_msg(formatargs)
     f = func(profile_name, *args, **kwargs)
     if removal:
         for rem in removal:
             profile_utils.remove_profile_value(profile.NAME, rem)
     return f
def configure_login_authenticate(profile_name, login=False, authenticate=False):
    info = {}
    remove_info = None
    if login:
        info['USERNAME'], info['PASSWORD'] = prompt.retry_once_for_assertions(prompt.configure_login_info)
        remove_info = profile_utils.AUTHENTICATE_INFO
        if not info['PASSWORD']:
            info.pop('PASSWORD')
    elif authenticate:
        info['APP_SECRET'] = prompt.retry_once_for_assertions(prompt.configure_secret_info)
        remove_info = profile_utils.LOGIN_INFO
    if remove_info:
        for inf in remove_info:
            profile_utils.remove_profile_value(profile_name, inf)
    return info