39
|
1 import logging
|
|
2
|
|
3 import bottle
|
|
4 import jwt
|
|
5 from rdflib import URIRef
|
|
6
|
|
7 log = logging.getLogger(__name__)
|
|
8
|
|
9 jwks_client = jwt.PyJWKClient(uri='https://authenticate.bigasterisk.com/.well-known/pomerium/jwks.json')
|
|
10
|
|
11
|
|
12 def bottleGetAgent() -> URIRef:
|
|
13 pomAssertion = bottle.request.headers.get('X-Pomerium-Jwt-Assertion', None)
|
|
14
|
|
15 sk = jwks_client.get_signing_key_from_jwt(pomAssertion)
|
41
|
16 j = jwt.decode(pomAssertion, key=sk.key, algorithms=['ES256'], audience="bigasterisk.com")
|
39
|
17
|
|
18 foaf = {
|
|
19 'drewpca@gmail.com': 'http://bigasterisk.com/foaf.rdf#drewp',
|
|
20 'kelsimp@gmail.com': 'http://bigasterisk.com/kelsi/foaf.rdf#kelsi',
|
|
21 }[j['email']]
|
|
22 return URIRef(foaf)
|