Python package to interact with multiple authentication services
Project description
py-multiauth
Installation
pip install py-multiauth
Supported methods
Name | Authenticate | Refresh | Extra | Proxy support |
---|---|---|---|---|
API_KEY |
✓ | ✓ | ||
AWS |
✓ | ✓ | Signature | |
BASIC |
✓ | ✓ | ||
REST |
✓ | ✓ | ✓ | |
DIGEST |
✓ | ✓ | ||
GRAPHQL |
✓ | ✓ | ||
HAWK |
✓ | ✓ | ||
MANUAL |
✓ | ✓ | ||
OAUTH |
✓ | ✓ | ✓ |
Usage
Local CLI
Take a look at the documentation to fill you .authrc.json
and run:
multiauth validate -f .authrc.json
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.
Setup the developer environment:
make
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-3.0.0rc3.tar.gz
(48.0 kB
view hashes)
Built Distribution
Close
Hashes for py_multiauth-3.0.0rc3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 49ac5d200b30e22e523c4bf40d6b3fc4efd8191172ee753e3c35f093c2341462 |
|
MD5 | 22dd32a9c6b0a5699a0486ec5c2b9c78 |
|
BLAKE2b-256 | e0a2436afb808a8fc95ea3cc300d976cb2179e2c89b54576021d59f5157cc84b |