From bd4813105d0246cf19f199a1e381acf3d6900d1d Mon Sep 17 00:00:00 2001 From: Matt Date: Wed, 13 May 2020 17:29:49 -0700 Subject: [PATCH] Add unsigned config option to auth w/o aws creds * botocore requires the Config(signature_version=botocore.UNSIGNED) configuration option when declaring the client in order to allow for authentication without a local aws credential cache * implemented in order to use warrant in a third party client application Signed-off-by: Matt --- setup.py | 9 +++++---- warrant/__init__.py | 4 ++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index f51d154c..48af3c86 100644 --- a/setup.py +++ b/setup.py @@ -1,12 +1,13 @@ import os from setuptools import setup, find_packages -from pip.req import parse_requirements +from pip._internal.req import parse_requirements +from pip._internal.req.req_file import ParsedRequirement install_reqs = parse_requirements('requirements.txt', session=False) test_reqs = parse_requirements('requirements_test.txt', session=False) -version = '0.6.1' +version = '0.7.0' README="""Python class to integrate Boto3's Cognito client so it is easy to login users. With SRP support.""" @@ -28,9 +29,9 @@ packages=find_packages(), url='https://github.com/capless/warrant', license='Apache License 2.0', - install_requires=[str(ir.req) for ir in install_reqs], + install_requires=[str(x.requirement) for x in install_reqs], extras_require={ - 'test': [str(ir.req) for ir in test_reqs] + 'test': [str(x.requirement) for x in test_reqs] }, include_package_data=True, zip_safe=True, diff --git a/warrant/__init__.py b/warrant/__init__.py index 2a0c2313..96a8f50b 100644 --- a/warrant/__init__.py +++ b/warrant/__init__.py @@ -1,5 +1,6 @@ import ast import boto3 +import botocore import datetime import re import requests @@ -169,6 +170,9 @@ def __init__( if user_pool_region: boto3_client_kwargs['region_name'] = user_pool_region + config = botocore.config.Config(signature_version=botocore.UNSIGNED) + boto3_client_kwargs['config'] = config + self.client = boto3.client('cognito-idp', **boto3_client_kwargs) def get_keys(self):