Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"""Tokendito retrieves AWS credentials after authenticating with Okta."""
# Set some required initial values
args = helpers.setup(args)
logging.debug(
"tokendito retrieves AWS credentials after authenticating with Okta."
)
# 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)
def set_okta_password():
"""Set okta password in a constant settings variable.
:param args: command line arguments
:return: okta_password
"""
logging.debug("Set okta password in a constant settings variable.")
while settings.okta_password == '':
okta_password = getpass.getpass()
setattr(settings, 'okta_password', to_unicode(okta_password))
logging.debug('password set interactively')
return settings.okta_password
def set_okta_password():
"""Set okta password in a constant settings variable.
:param args: command line arguments
:return: okta_password
"""
logging.debug("Set okta password in a constant settings variable.")
while settings.okta_password == '':
okta_password = getpass.getpass()
setattr(settings, 'okta_password', to_unicode(okta_password))
logging.debug('password set interactively')
return settings.okta_password