Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def process_okta_aws_app_url():
"""Process Okta app url.
:param app_url: string with okta tile URL.
:return: None.
"""
if not validate_okta_aws_app_url(settings.okta_aws_app_url):
logging.error("Okta Application URL not found, or invalid. Please check "
"your configuration and try again.")
sys.exit(2)
url = urlparse(settings.okta_aws_app_url)
okta_org = '{}://{}'.format(url.scheme, url.netloc)
okta_aws_app_url = '{}{}'.format(okta_org, url.path)
setattr(settings, 'okta_org', okta_org)
setattr(settings, 'okta_aws_app_url', okta_aws_app_url)
def process_okta_aws_app_url():
"""Process Okta app url.
:param app_url: string with okta tile URL.
:return: None.
"""
if not validate_okta_aws_app_url(settings.okta_aws_app_url):
logging.error("Okta Application URL not found, or invalid. Please check "
"your configuration and try again.")
sys.exit(2)
url = urlparse(settings.okta_aws_app_url)
okta_org = '{}://{}'.format(url.scheme, url.netloc)
okta_aws_app_url = '{}{}'.format(okta_org, url.path)
setattr(settings, 'okta_org', okta_org)
setattr(settings, 'okta_aws_app_url', okta_aws_app_url)
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)