Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
:param role_arns: IAM roles ARN list assigned for the user
:param saml_xml: Decoded saml response from Okta
:param saml_response_string: http response from saml assertion to AWS
:return: User input index selected by the user, the arn of selected role
"""
logging.debug("Select the role user wants to pick [{}]".format(role_arns))
if settings.role_arn is None:
selected_role = prompt_role_choices(
role_arns, saml_xml, saml_response_string)
elif settings.role_arn in role_arns:
selected_role = settings.role_arn
else:
logging.error(
"User provided rolename does not exist [{}]".format(settings.role_arn))
sys.exit(2)
logging.debug("Selected role: [{}]".format(selected_role))
return selected_role
def select_role_arn(role_arns, saml_xml, saml_response_string):
"""Select the role user wants to pick.
:param role_arns: IAM roles ARN list assigned for the user
:param saml_xml: Decoded saml response from Okta
:param saml_response_string: http response from saml assertion to AWS
:return: User input index selected by the user, the arn of selected role
"""
logging.debug("Select the role user wants to pick [{}]".format(role_arns))
if settings.role_arn is None:
selected_role = prompt_role_choices(
role_arns, saml_xml, saml_response_string)
elif settings.role_arn in role_arns:
selected_role = settings.role_arn
else:
logging.error(
"User provided rolename does not exist [{}]".format(settings.role_arn))
sys.exit(2)
logging.debug("Selected role: [{}]".format(selected_role))
return selected_role
def select_role_arn(role_arns, saml_xml, saml_response_string):
"""Select the role user wants to pick.
:param role_arns: IAM roles ARN list assigned for the user
:param saml_xml: Decoded saml response from Okta
:param saml_response_string: http response from saml assertion to AWS
:return: User input index selected by the user, the arn of selected role
"""
logging.debug("Select the role user wants to pick [{}]".format(role_arns))
if settings.role_arn is None:
selected_role = prompt_role_choices(
role_arns, saml_xml, saml_response_string)
elif settings.role_arn in role_arns:
selected_role = settings.role_arn
else:
logging.error(
"User provided rolename does not exist [{}]".format(settings.role_arn))
sys.exit(2)
logging.debug("Selected role: [{}]".format(selected_role))
return selected_role
def select_role_arn(role_arns, saml_xml, saml_response_string):
"""Select the role user wants to pick.
:param role_arns: IAM roles ARN list assigned for the user
:param saml_xml: Decoded saml response from Okta
:param saml_response_string: http response from saml assertion to AWS
:return: User input index selected by the user, the arn of selected role
"""
logging.debug("Select the role user wants to pick [{}]".format(role_arns))
if settings.role_arn is None:
selected_role = prompt_role_choices(
role_arns, saml_xml, saml_response_string)
elif settings.role_arn in role_arns:
selected_role = settings.role_arn
else:
logging.error(
"User provided rolename does not exist [{}]".format(settings.role_arn))
sys.exit(2)
logging.debug("Selected role: [{}]".format(selected_role))
return selected_role