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

Feature/linux keyring #3

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion aws-federated-auth.spec
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ a = Analysis(
binaries=[],
datas=[('shib', 'shib')],
hiddenimports=[],
hookspath=[],
hookspath=['hooks'],
hooksconfig={},
runtime_hooks=[],
excludes=[],
Expand Down
8 changes: 8 additions & 0 deletions hooks/hook-keyrings.cryptfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from PyInstaller.utils.hooks import collect_submodules, copy_metadata

# Collect backends
hiddenimports = collect_submodules('keyrings.cryptfile')

# Keyring performs backend plugin discovery using setuptools entry points, which are listed in the metadata. Therefore,
# we need to copy the metadata, otherwise no backends will be found at run-time.
datas = copy_metadata('keyrings.cryptfile')
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ dependencies = [
"requests",
"boto3",
"keyring",
"keyrings.cryptfile; sys_platform == 'linux'",
]

[tool.setuptools.packages]
Expand Down
13 changes: 3 additions & 10 deletions shib/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
import getpass
import logging
import requests
import distutils

import sys
import argparse
Expand All @@ -77,11 +76,6 @@
log_channel.setFormatter(formatter)
logger.addHandler(log_channel)

def str2bool(string):
try:
return bool(distutils.util.strtobool(string))
except:
raise ValueError

def main():
"""Main: Set up variables argparse, failing back to environment variables.
Expand All @@ -103,10 +97,7 @@ def main():
parser.add_argument('--list',
help= 'Don\'t generate profiles, just list'
' available options passing filters.',
type=str2bool,
nargs='?',
const=True,
default=False)
action='store_true')
parser.add_argument('--assertionconsumer',
help='The shibboleth protected site you want to log into.'
' Defaults to https://signin.aws.amazon.com/saml'
Expand Down Expand Up @@ -260,6 +251,8 @@ def main():

try:
import keyring
if sys.platform == 'linux':
from keyrings import cryptfile
except ImportError:
keyring = None

Expand Down