Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set signature_version=botocore.UNSIGNED for assume_role_with_saml() requests #484

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions gimme_aws_creds/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
# extras
import boto3
import requests
import botocore
import botocore.config
from botocore.exceptions import ClientError
from okta.api_client import APIClient
from okta.errors.error import Error as OktaError
Expand Down Expand Up @@ -188,15 +190,13 @@ def _get_partition_and_region_from_saml_acs(saml_acs_url):
def _get_sts_creds(partition, region, assertion, idp, role, duration=3600):
""" using the assertion and arns return aws sts creds """

session = boto3.session.Session(profile_name=None)

# If a region was passed, use that
if region is not None:
client = session.client('sts', region)
# Use the first available region
else:
regions = session.get_available_regions('sts', partition)
client = session.client('sts', regions[0])
if region is None:
# Use the first available region
region = session.get_available_regions('sts', partition)[0]

config = botocore.config.Config(signature_version=botocore.UNSIGNED)
client = boto3.client('sts', region, config=config)

response = client.assume_role_with_saml(
RoleArn=role,
Expand Down
Loading