Skip to main content

yhttp-auth

PyPI Build Coverage Status

Authentication extension for yhttp.

Install

pip install yhttp-auth

Usage

from yhttp import Application
from yhttp.ext.auth import install as auth_install


app = Application('0.1.0', 'foo')
auth = auth_install(app)
app.settings.merge(f'''
auth:
  redis:
    host: localhost
    port: 6379
    db: 0

  token:
    algorithm: HS256
    secret: foobar

  refresh:
    key: yhttp-refresh-token
    algorithm: HS256
    secret: quxquux
    secure: true
    httponly: true
    maxage: 2592000  # 1 Month
    domain: example.com
''')


@app.route('/reftokens')
@yhttp.statuscode(yhttp.statuses.created)
def create(req):
    app.auth.set_refreshtoken(req, 'alice', dict(baz='qux'))

@app.route('/tokens')
@yhttp.statuscode(yhttp.statuses.created)
@yhttp.text
def refresh(req):
    reftoken = app.auth.verify_refreshtoken(req)
    return app.auth.dump_from_refreshtoken(reftoken, dict(foo='bar'))

@app.route('/admin')
@auth(roles='admin, god')
@yhttp.text
def get(req):
    return req.identity.roles

app.ready()

Command line interface

setup.py

setup(
    ...
    entry_points={
        'console_scripts': [
            'myapp = myapp:app.climain'
        ]
    },
    ...
)
myapp auth --help

Contribution

python-makelib

Install python-makelib.

Metadata

Release files for yhttp-auth 12.0.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 yhttp-auth 12.0.0
File Size Uploaded Provenance
yhttp_auth-12.0.0.tar.gz 11.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for yhttp-auth 12.0.0
File Interpreter ABI Platform
yhttp_auth-12.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 19.1 kB

Release files / yhttp_auth-12.0.0.tar.gz

Download URL yhttp_auth-12.0.0.tar.gz
Size 11.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c9b532d15fd21fc5464e0e8070f2666b754018ac59cbaf16fc7d0977a22fcb3e
BLAKE2b-256 checksum
How to use checksums
70a3d5956808d1e1fe26c5e95ae6f7bf3a8b3cecdb8743a6eda86bf434874289
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / yhttp_auth-12.0.0-py3-none-any.whl

Download URL yhttp_auth-12.0.0-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
30e04f4a8d08bdb49b67c1d3fc51fd27315aa1d28ef107572c88fb1c8cab0aaf
BLAKE2b-256 checksum
How to use checksums
b4ea25072be136b28f278fbfc4b5346f088f69238fca653f58bab20c01cc95f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for yhttp-auth 12.0.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.

Release history Release notifications | RSS feed

This release

12.0.0 This release

2 release files No provenance

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