How to use the tokendito.aws_helpers.ensure_keys_work 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 / tool.py View on Github external
# Collect and organize user specific information
    helpers.process_options(args)

    # Authenticate okta and AWS also use assumerole to assign the role
    logging.debug("Authenticate user with Okta and AWS.")

    secret_session_token = okta_helpers.authenticate_user(
        settings.okta_org, settings.okta_username, settings.okta_password)

    saml_response_string, saml_xml = aws_helpers.authenticate_to_roles(
        secret_session_token, settings.okta_aws_app_url)

    assume_role_response, role_name = aws_helpers.select_assumeable_role(
        saml_response_string, saml_xml)

    aws_helpers.ensure_keys_work(assume_role_response)

    helpers.set_local_credentials(assume_role_response, role_name,
                                  settings.aws_region, settings.aws_output)