Skip to main content

NYT PyIAP

Validating JWT tokens from the Google Identity-Aware Proxy as middleware.

Install

pip install -e git+git@github.com:newsdev/nyt-pyiap.git

Usage

Django

Add to settings

Update your settings.py file to add the Django middleware.

MIDDLEWARE_CLASSES = [
  ...
  'pyiap.django.VerifyJWTMiddleware',
  ...
]

The request object in views.py will have two new attributes added: - request.jwt_user_id: The Google internal ID of the user who has been verified by IAP. - request.jwt_user_email: The email address and email type of the user who has been verified by IAP.

Flask

Update your Flask app.py to wrap your instantiated Flask() application’s wsgi_app with the VerifyJWTMiddleware.

app = Flask(__name__)
app.wsgi_app = VerifyJWTMiddleware(app.wsgi_app)

The request.environ object in app.py will have two new attributes added: - request.environ['jwt_user_id']: The Google internal ID of the user who has been verified by IAP. - request.environ['jwt_user_email']: The email address and email type of the user who has been verified by IAP.

Contributing

TBD.

Metadata

Release files for nyt-pyiap 0.1.9

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

Source distribution (sdist)

Source distribution for nyt-pyiap 0.1.9
File Size Uploaded Provenance
nyt-pyiap-0.1.9.tar.gz 4.7 kB Without provenance Details

Release files / nyt-pyiap-0.1.9.tar.gz

Download URL nyt-pyiap-0.1.9.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
6709e994b5be32c0146311dea02b13fcbc9d6d06e731d63c407871682c624776
BLAKE2b-256 checksum
How to use checksums
6eaa9defe5214837fb5e2ed2de95ad443b5b9a9bfbf2acf872b20e6792c8e056
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for nyt-pyiap 0.1.9

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.

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