Name: nyt-pyiap
Owner: NYT Newsroom Developers
Description: A set of Python functions and middlewares for common frameworks for validating JWT tokens set by Google IAP.
Created: 2017-05-09 17:50:19.0
Updated: 2018-05-22 23:01:49.0
Pushed: 2018-05-01 19:53:25.0
Homepage: null
Size: 30
Language: Python
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Validating JWT tokens from the Google Identity-Aware Proxy as middleware.
install -e git+git@github.com:newsdev/nyt-pyiap.git
Update your settings.py
file to add the Django middleware.
LEWARE_CLASSES = [
.
yiap.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.Update your Flask app.py
to wrap your instantiated Flask()
application's wsgi_app
with the VerifyJWTMiddleware
.
= Flask(__name__)
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.TBD.