Created
April 16, 2019 18:36
-
-
Save inklesspen/41042ee0864aa27a2f18c91c2714371c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import base64 | |
import json | |
def extract_jwt_claims(req): | |
header = req.headers.get('X-Endpoint-API-UserInfo') | |
if header is None: | |
return None | |
val = json.loads(base64.urlsafe_b64decode(header)) | |
claims_json = val['claims'] | |
claims = json.loads(claims_json) | |
return claims | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment