File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66import requests
77from aiohttp import hdrs , web
88from google .protobuf import json_format
9+ from jwt import PyJWK
910from jwt .algorithms import RSAAlgorithm
1011from temporalio .api .cloud .cloudservice .v1 import GetUsersRequest
1112from temporalio .api .common .v1 import Payloads
@@ -90,20 +91,20 @@ async def handler(req: web.Request):
9091 jwks = requests .get (jwks_url ).json ()
9192
9293 # Extract Temporal Cloud's public key
93- public_key = None
94+ pyjwk = None
9495 for key in jwks ["keys" ]:
9596 if key ["kid" ] == kid :
9697 # Convert JWKS key to PEM format
97- public_key = RSAAlgorithm . from_jwk (key )
98+ pyjwk = PyJWK . from_dict (key )
9899 break
99100
100- if public_key is None :
101+ if pyjwk is None :
101102 raise ValueError ("Public key not found in JWKS" )
102103
103104 # Decode the jwt, verifying against Temporal Cloud's public key
104105 decoded = jwt .decode (
105106 encoded ,
106- public_key ,
107+ pyjwk . key ,
107108 algorithms = [algorithm ],
108109 audience = [
109110 "https://saas-api.tmprl.cloud" ,
You can’t perform that action at this time.
0 commit comments