Skip to main content

Flask-Rebar-Auth0

Simple Flask-Rebar authenticator for Auth0. Your access tokens need to be JWT tokens for this authenticator to work.

Initialization

# Config
app.config.from_mapping({
    "AUTH0_ENDPOINT": "perdu.auth0.com",      # The Auth0 domain for your tenant
    "AUTH0_ALGORITHMS": ["RS256"],            # The authorized algorithms, you should not have to change it
    "AUTH0_AUDIENCE": "https://api.perdu.com" # The API Identifier as set on Auth0

    "AUTH0_HEADER_AUTHENTICATION": True       # USe the authentication by header
    "AUTH0_HEADER_NAME": "Authorization"      # (OPTIONAL) Change the header used
    "AUTH0_HEADER_PREFIX": "Bearer"           # (OPTIONAL) Change the prefix used
    # OR
    "AUTH0_COOKIE_AUTHENTICATION": True       # Use the authentication by cookie
    "AUTH0_COOKIE_NAME": "Some Cookie"        # Name of the cookie containing the access token
})

# Create
authenticator = Auth0Authenticator(app)

@authenticator.identity_handler
def lookup_cognito_user(claims: Dict[str, Any]) -> Any:
    """Built a user object from the claims"""
    return { "id": claims["sub"] }

Usage

from flask_rebar_auth0 import get_authenticated_user


@registry.handles(
    rule="/users/me",
    method="GET",
    marshal_schema=UserSchema(),
    authenticator=authenticator, # Use the authenticator
)
def get_user():
    return get_authenticated_user() # Get the user data created by the identity_handler


@registry.handles(
    rule="/users/me/location",
    method="GET",
    marshal_schema=UserLocationSchema(),
    authenticator=authenticator.with_scopes(["read:location"]), # Require some scopes to access the ressource
)
def get_user_location():
    user = get_authenticated_user()
    return locationService.get(user)

Metadata

Release files for flask-rebar-auth0 0.1.1

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

Source distribution (sdist)

Source distribution for flask-rebar-auth0 0.1.1
File Size Uploaded Provenance Actions
flask-rebar-auth0-0.1.1.tar.gz 2.4 kB Without provenance Details for flask-rebar-auth0-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for flask-rebar-auth0 0.1.1
File Interpreter ABI Platform Actions
flask_rebar_auth0-0.1.1-py3-none-any.whl Python 3 none any Details for flask_rebar_auth0-0.1.1-py3-none-any.whl

Total release size: 4.7 kB

Release files / flask-rebar-auth0-0.1.1.tar.gz

Download URL flask-rebar-auth0-0.1.1.tar.gz
Size 2.4 kB
Tags Source
SHA-256 checksum
How to use checksums
af02cf21dadeb4edb065d0a4a7881bd9d2f731bd85b1b791288b1532b6ff9a63
BLAKE2b-256 checksum
How to use checksums
73446cece1cc324b710684f0c78d8b4fa410ed3c3821891c4b85f06e3939d148
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Release files / flask_rebar_auth0-0.1.1-py3-none-any.whl

Download URL flask_rebar_auth0-0.1.1-py3-none-any.whl
Size 2.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0d8c583a59e1f06304aba4a15f872e27d66b6e92fdd40b96fa85bd705eb198ae
BLAKE2b-256 checksum
How to use checksums
4b4d80dbf7e580d3cfc293d132b6020eb230a283a8dcde5eacf09ca22808e85f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Security for flask-rebar-auth0 0.1.1

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