Skip to main content

Python package to interact with multiple authentication services

Project description

py-multiauth PyPI CI CD codecov

PyPI - Python Version PyPI - Downloads

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

MIT

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.0rc18.tar.gz (41.9 kB view details)

Uploaded Source

Built Distribution

py_multiauth-2.0.0rc18-py3-none-any.whl (55.0 kB view details)

Uploaded Python 3

File details

Details for the file py_multiauth-2.0.0rc18.tar.gz.

File metadata

  • Download URL: py_multiauth-2.0.0rc18.tar.gz
  • Upload date:
  • Size: 41.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for py_multiauth-2.0.0rc18.tar.gz
Algorithm Hash digest
SHA256 527789361f25394dad90f4962f382c309ebb447ed4b16197409835c63a3acace
MD5 8784d4a442818a2c09f3c7a35a971c19
BLAKE2b-256 afa3b438bf637ed768cafef53cb1291da9dc4725e6a869007139c20582dfad47

See more details on using hashes here.

Provenance

File details

Details for the file py_multiauth-2.0.0rc18-py3-none-any.whl.

File metadata

File hashes

Hashes for py_multiauth-2.0.0rc18-py3-none-any.whl
Algorithm Hash digest
SHA256 a3d6f3be8a3c35df1052d9b01e2aefbae1a42e75dc4b94e937528209176712f1
MD5 b3ee279ac8070d714a5e2340d8cdb03b
BLAKE2b-256 dace7abc8fabd8bfdd1644adfc7f227b66d553df31a60cda0cf80b3722307c86

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page