Mercurial > code > home > repos > href
view get_agent.py @ 41:293a694304b8
reformat
author | drewp@bigasterisk.com |
---|---|
date | Sat, 19 Nov 2022 17:18:55 -0800 |
parents | c538dc39b851 |
children | 530650b3bc40 |
line wrap: on
line source
import logging import bottle import jwt from rdflib import URIRef log = logging.getLogger(__name__) jwks_client = jwt.PyJWKClient(uri='https://authenticate.bigasterisk.com/.well-known/pomerium/jwks.json') def bottleGetAgent() -> URIRef: pomAssertion = bottle.request.headers.get('X-Pomerium-Jwt-Assertion', None) sk = jwks_client.get_signing_key_from_jwt(pomAssertion) j = jwt.decode(pomAssertion, key=sk.key, algorithms=['ES256'], audience="bigasterisk.com") foaf = { 'drewpca@gmail.com': 'http://bigasterisk.com/foaf.rdf#drewp', 'kelsimp@gmail.com': 'http://bigasterisk.com/kelsi/foaf.rdf#kelsi', }[j['email']] return URIRef(foaf)