Skip to content

Commit

Permalink
Add license info for third-party code and tidy up
Browse files Browse the repository at this point in the history
  • Loading branch information
trewq34 committed Sep 15, 2021
1 parent 0ad3572 commit bdd2c20
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 8 deletions.
11 changes: 3 additions & 8 deletions auther/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def configure(**kwargs):
prefix = getattr(globals()[provider], f'{provider.replace("_", "").title()}Provider').prefix()
except AttributeError:
raise ProviderNotFound(f"The provider {provider} doesn't have the correct module structure.")
except NameError:
except (NameError, KeyError):
raise ProviderNotFound(f"The provider {provider} doesn't exist")

options = {}
Expand Down Expand Up @@ -60,7 +60,7 @@ def login(**kwargs):
config = getattr(globals()[provider], f'{provider.replace("_", "").title()}Provider').get_config(kwargs['aws_config'], kwargs['profile'], provider, opt_list)
except AttributeError:
raise ProviderNotFound(f"The provider {provider} doesn't have the correct module structure.")
except NameError:
except (NameError, KeyError):
raise ProviderNotFound(f"The provider {provider} doesn't exist")

opts = {
Expand All @@ -71,11 +71,6 @@ def login(**kwargs):

for option in provider_options:
opts[option.get('function')] = config.get(f"{provider}_{option.get('function')}")
# username = next((config.get(f"{provider}_{option.get('function')}") for option in provider_options if option.get('function') == 'username'), None)
# idp_url = next((config.get(f"{provider}_{option.get('function')}") for option in provider_options if option.get('function') == 'idp_url'), None)

# if not opts.get('username'):
# raise ProviderNotConfigured(f"The provider {provider} doesn't have the correct option structure")

opts['password'] = click.prompt(f'Enter the password for {opts.get("username")}', type=str, hide_input=True)

Expand All @@ -87,7 +82,7 @@ def login(**kwargs):

roles = auth_provider.login()
if not roles:
raise ProviderAuthenticationError(f'Provider {provider} return no available roles')
raise ProviderAuthenticationError(f'Provider {provider} returned no available roles')

if len(roles) > 1:
_output_roles(roles)
Expand Down
6 changes: 6 additions & 0 deletions auther/providers/helpers/azuread.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
"""
Original code from David Poirier's aws_azuread_login project (https://github.com/david-poirier/aws_azuread_login) and licensed under Apache-2.0
Modified to work with one or many IAM roles
"""

import uuid
import zlib
import base64
Expand Down
17 changes: 17 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
from setuptools import setup, find_namespace_packages

with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()

setup(
name="auther",
version="0.0.3",
author="Kamran Ali",
author_email="[email protected]",
description="Command line tool for AWS CLI authentication",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/trewq34/auther",
project_urls={
"Bug Tracker": "https://github.com/trewq34/auther/issues",
},
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
packages=[package for package in find_namespace_packages('.') if 'auther' in package],
install_requires=[
"Click",
Expand Down

0 comments on commit bdd2c20

Please sign in to comment.