Skip to content

Commit

Permalink
remove pyopenssl, boto3 (#56)
Browse files Browse the repository at this point in the history
Co-authored-by: Yaroslav Kudrin <Iaroslav_Kudrin@epam.com>
  • Loading branch information
kudrinyaroslav and Yaroslav Kudrin committed Aug 31, 2021
1 parent b8c5bf8 commit fad9514
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
boto3>=1.9.0
botocore>=1.12.36
requests>=2.19.0
pyOpenSSL>=18.0.0
beautifulsoup4>=4.6.0
9 changes: 6 additions & 3 deletions tokendito/aws_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
import logging
import sys

import boto3
from botocore import UNSIGNED
from botocore.client import Config
from botocore.exceptions import ClientError
import botocore.session
import requests
from tokendito import helpers

Expand Down Expand Up @@ -108,8 +108,9 @@ def handle_assume_role(role_arn, provider_arn, encoded_xml, duration, default_er
:return: AssumeRoleWithSaml API responses
"""
logging.debug(f"Attempting session time [{duration}]")
client = boto3.client("sts", config=Config(signature_version=UNSIGNED))
try:
session = botocore.session.get_session()
client = session.create_client("sts", config=Config(signature_version=UNSIGNED))
assume_role_response = client.assume_role_with_saml(
RoleArn=role_arn,
PrincipalArn=provider_arn,
Expand Down Expand Up @@ -155,7 +156,9 @@ def ensure_keys_work(assume_role_response):
aws_session_token = assume_role_response["Credentials"]["SessionToken"]

try:
client = boto3.client(
session = botocore.session.get_session()

client = session.create_client(
"sts",
aws_access_key_id=aws_access_key,
aws_secret_access_key=aws_secret_key,
Expand Down

0 comments on commit fad9514

Please sign in to comment.