Skip to content

Commit a216e70

Browse files
Merge pull request awslabs#29 from JordonPhillips/doc-update
Update README and add user agent suffix
2 parents af46070 + 29805e0 commit a216e70

File tree

6 files changed

+72
-10
lines changed

6 files changed

+72
-10
lines changed

.pylintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ confidence=
5959
# --enable=similarities". If you want to run only the classes checker, but have
6060
# no Warning level messages displayed, use"--disable=all --enable=classes
6161
# --disable=W"
62-
disable=R0201,W0613,I0021,I0020,C0111,W1618,W1619,R0902,R0903,W0231,W0611,R0913,W0703,C0330,R0204,I0011,R0904
62+
disable=R0201,W0613,I0021,I0020,C0111,W1618,W1619,R0902,R0903,W0231,W0611,R0913,W0703,C0330,R0204,I0011,R0904,R0205
6363

6464

6565
[REPORTS]

README.rst

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ AWS Process Credential Providers
88
A collection of process-based credential providers to be used with the AWS CLI
99
and related tools.
1010

11+
This is an experimental package, breaking changes may occur on any minor
12+
version bump.
13+
1114

1215
Installation
1316
------------
@@ -68,3 +71,33 @@ Example adfs configuration::
6871
credential_process = awsprocesscreds-saml -e 'https://corp.example.com/adfs/ls/IdpInitiatedSignOn.aspx?loginToRp=urn:amazon:webservices' -u Monty -p adfs -a arn:aws:iam::123456789012:role/ADFS-Dev
6972

7073
.. _AWS CLI Config docs: http://docs.aws.amazon.com/cli/latest/topic/config-vars.html#cli-aws-help-config-vars
74+
75+
76+
Custom Providers
77+
----------------
78+
79+
The mechanism this package uses to provide credentials is generally available,
80+
and not specific to this package. It can be used to implement any custom
81+
credential provider that will work with the AWS CLI, boto3, and other SDKs as
82+
they implement support.
83+
84+
A detailed breakdown of this mechanism along with a live demo of implementing a
85+
credential provider that hooks into the macOS keychain can be seen on this
86+
recorded talk from re:Invent 2017:
87+
`AWS CLI: 2107 and Beyond <https://youtu.be/W8IyScUGuGI?t=1260>`_
88+
89+
The CLI will call the process provided as the value for ``credential_process``.
90+
This process must return credentials on stdout in the following JSON form::
91+
92+
{
93+
"Version": 1,
94+
"AccessKeyId": "string",
95+
"SecretAccessKey": "string",
96+
"SessionToken": "string",
97+
"Expiration": "2019-01-31T21:45:41+00:00"
98+
}
99+
100+
Where ``Expiration`` is an RFC 3339 compatible timestamp. As the expiration
101+
time nears, the process will be called again to get a new set of credentials.
102+
The ``Version`` denotes the version of this format, whose only current valid
103+
value is ``1``. The remaining keys are the AWS credentials you wish to use.

awsprocesscreds/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import logging
22

3+
__version__ = '0.0.2'
4+
35

46
class NullHandler(logging.Handler):
57
def emit(self, record):

awsprocesscreds/saml.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# pylint: disable=R1710
12
import base64
23
import getpass
34
import logging
@@ -15,6 +16,7 @@
1516
from botocore.credentials import CachedCredentialFetcher
1617
import botocore.session
1718

19+
import awsprocesscreds
1820
from .compat import escape
1921

2022

@@ -370,7 +372,12 @@ def _get_credentials(self):
370372

371373
def _create_client(self):
372374
return self._client_creator(
373-
'sts', config=Config(signature_version=botocore.UNSIGNED)
375+
'sts', config=Config(
376+
signature_version=botocore.UNSIGNED,
377+
user_agent_extra=(
378+
'awsprocesscreds-saml/%s' % awsprocesscreds.__version__
379+
)
380+
)
374381
)
375382

376383
def _get_role_and_principal_arn(self, assertion):

requirements-dev.txt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ pytest-catchlog==1.2.2
55
coverage==4.3.4
66
flake8==3.5.0
77
mock==2.0.0
8-
# Pylint will fail on py3. Locking to a commit on master
9-
# until pylint2 is released.
10-
-e git://github.com/PyCQA/pylint.git@7cb3ffddfd96f5e099ca697f6b1e30e727544627#egg=pylint
11-
pydocstyle==2.1.1
8+
# The latest version of pylint only works on python3.
9+
pylint==2.2.2 ; python_version >= '3.6'
10+
astroid==2.1.0 ; python_version >= '3.6'
11+
# For python2, there are a few bugs in the latest versions of 1.x,
12+
# so we're locking to a specific version that we know works.
13+
pylint==1.9.3 ; python_version <= '2.7'
14+
astroid==1.6.5 ; python_version <= '2.7'
15+
pydocstyle==2.1.1

setup.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
11
#!/usr/bin/env python
2+
import codecs
3+
import os.path
4+
import re
25
from setuptools import setup, find_packages
36

4-
with open('README.rst') as readme_file:
5-
README = readme_file.read()
7+
HERE = os.path.abspath(os.path.dirname(__file__))
8+
9+
10+
def read(*parts):
11+
return codecs.open(os.path.join(HERE, *parts), 'r').read()
12+
13+
14+
def find_version(*file_paths):
15+
version_file = read(*file_paths)
16+
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
17+
version_file, re.M)
18+
if version_match:
19+
return version_match.group(1)
20+
raise RuntimeError("Unable to find version string.")
21+
622

723

824
install_requires = [
@@ -13,9 +29,9 @@
1329

1430
setup(
1531
name='awsprocesscreds',
16-
version='0.0.1',
32+
version=find_version('awsprocesscreds', '__init__.py'),
1733
description='AWS Process Credential Providers.',
18-
long_description=README,
34+
long_description=read('README.rst'),
1935
author='Amazon Web Services',
2036
url='https://github.com/awslabs/awsprocesscreds',
2137
packages=find_packages(exclude=['tests']),

0 commit comments

Comments
 (0)