How to use the tokendito.settings.role_arn function in tokendito

To help you get started, we’ve selected a few tokendito examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dowjones / tokendito / tokendito / helpers.py View on Github external
: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
github dowjones / tokendito / tokendito / helpers.py View on Github external
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
github dowjones / tokendito / tokendito / helpers.py View on Github external
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
github dowjones / tokendito / tokendito / helpers.py View on Github external
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