Skip to main content

macauthlib: library for implementing MAC Access Authentication

This is a low-level library for implementing MAC Access Authentication, a simple HTTP request-signing scheme described in:

http://tools.ietf.org/html/draft-ietf-oauth-v2-http-mac-01

To access resources using MAC Access Authentication, the client must have obtained a set of MAC credentials including an id and secret key. They use these credentials to make signed requests to the server.

When accessing a protected resource, the server will generate a 401 challenge response with the scheme “MAC” as follows:

> GET /protected_resource HTTP/1.1
> Host: example.com

< HTTP/1.1 401 Unauthorized
< WWW-Authenticate: MAC

The client will use their MAC credentials to build a request signature and include it in the Authorization header like so:

> GET /protected_resource HTTP/1.1
> Host: example.com
> Authorization: MAC id="h480djs93hd8",
>                    ts="1336363200",
>                    nonce="dj83hs9s",
>                    mac="bhCQXTVyfj5cmA9uKkPFx1zeOXM="

< HTTP/1.1 200 OK
< Content-Type: text/plain
<
< For your eyes only:  secret data!

This library provices the low-level functions necessary to implement such an authentication scheme. For MAC Auth clients, it provides the following function:

  • sign_request(req, id, key, hashmod=sha1): sign a request using

    MAC Access Auth.

For MAC Auth servers, it provides the following functions:

  • get_id(req): get the claimed MAC Auth id

    from the request.

  • check_signature(req, key, hashmod=sha1): check that the request was

    signed with the given key.

0.3.0 - 2012-07-11

  • Simplify API of the NonceCache class; it now provides a single method check_nonce() rather than separate is_fresh() and add_nonce() methods.

0.2.0 - 2012-06-01

  • Fix a race condition bug in NonceCache.

0.1.0 - 2012-02-27

  • Initial release.

Metadata

Release files for macauthlib 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for macauthlib 0.3.0
File Size Uploaded Provenance Actions
macauthlib-0.3.0.tar.gz 11.6 kB Without provenance Details for macauthlib-0.3.0.tar.gz

Release files / macauthlib-0.3.0.tar.gz

Download URL macauthlib-0.3.0.tar.gz
Size 11.6 kB
Tags Source
SHA-256 checksum
How to use checksums
69b80f4729edc0585995f11be2a02bbb026ceb6ac5c3ac0c56c2d595b2dad772
BLAKE2b-256 checksum
How to use checksums
2a9baa74c9b762765954f39273858f1e2b5cde626ba2f576aaaed78ecbf1db5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for macauthlib 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page