Python package to interact with multiple authentication services
Project description
py-multiauth
![codecov](https://pypi-camo.freetls.fastly.net/70c55325c0a6614e7be2fc8a05e493642461987c/68747470733a2f2f636f6465636f762e696f2f67682f4573636170652d546563686e6f6c6f676965732f70792d6d756c7469617574682f6272616e63682f6d61696e2f67726170682f62616467652e7376673f746f6b656e3d4e4c3134384d4e4b4145)
Installation
pip install py-multiauth
Supported methods
Name | Authenticate | Refresh | Extra |
---|---|---|---|
API_KEY |
✓ | ||
AWS |
✓ | ✓ | Signature |
BASIC |
✓ | ||
REST |
✓ | ✓ | |
DIGEST |
✓ | ||
GRAPHQL |
✓ | ||
HAWK |
✓ | ||
MANUAL |
✓ | ||
OAUTH |
✓ | ✓ |
Usage
Loading a configuration file
Currently, we support 4 way of loading a configuration file.
# Using constructor argument
MultiAuth(authrc_file='path.json')
# Using environment variable
os.environ['AUTHRC'] = 'path.json'
# Using autodection
os.paths.exists('.authrc')?
# Using autodection from user home directory
os.path.exists(os.path.expanduser('~/.multiauth/.authrc'))?
Managing authentication flow
MultiAuth supports context singleton. From that, you can instanciate MultiAuth and re-use the same class in another package as far it is sharing the same context.
auth = MultiAuth(auths=.., users=.., authrc=.., logger=..)
# Sending the requests to get the correct headers
auth.authenticate_users()
# Getting the header before sending a HTTP request
auth_headers = auth.reauthenticate(username=.., additional_headers=.., public=..)
r = requests.get('https://example.com', headers=auth_headers[0])
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
License ![PyPI - License](https://pypi-camo.freetls.fastly.net/252a8a817fe1c9a03b108891f7fc26487812fffb/68747470733a2f2f696d672e736869656c64732e696f2f707970692f6c2f70792d6d756c746961757468)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
py_multiauth-2.0.0rc12.tar.gz
(42.8 kB
view hashes)
Built Distribution
Close
Hashes for py_multiauth-2.0.0rc12-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2bd497c30390c0f76b899f2042d08caabc0b8b76ca335e0d219900b4e5a1529a |
|
MD5 | 818e6484c857f9ea1e72d5c7c955a241 |
|
BLAKE2b-256 | ba9144a92a41e33a7680d43c3ce488a632b7d87e3075081e60bd56c757f467eb |