Python package to interact with multiple authentication services
Project description
py-multiauth
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
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.0rc7.tar.gz
(39.1 kB
view details)
Built Distribution
File details
Details for the file py_multiauth-2.0.0rc7.tar.gz
.
File metadata
- Download URL: py_multiauth-2.0.0rc7.tar.gz
- Upload date:
- Size: 39.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a0e1f1ea6532ae29f8c1ad98a3b06659cf25b838b7e4976d733f3a861ed2179a |
|
MD5 | 157ada8d81c10811054daaa7e11c85d6 |
|
BLAKE2b-256 | 66652c5f1fa7e48e47d2f8c74a258b9c79580b7952e43822d2efd8fb3861b50c |
File details
Details for the file py_multiauth-2.0.0rc7-py3-none-any.whl
.
File metadata
- Download URL: py_multiauth-2.0.0rc7-py3-none-any.whl
- Upload date:
- Size: 54.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5221c7c51aa007c2d23db06a54ff9721565a332d58bac9ec6340e9d704396023 |
|
MD5 | 90444256425ca71080b12ff913b924fb |
|
BLAKE2b-256 | 85fe24dd1da8b599b1f8fb7a428787d742b1c004405f5fd0843b12922a1a04d7 |