File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 6
6
import requests
7
7
from aiohttp import hdrs , web
8
8
from google .protobuf import json_format
9
+ from jwt import PyJWK
9
10
from jwt .algorithms import RSAAlgorithm
10
11
from temporalio .api .cloud .cloudservice .v1 import GetUsersRequest
11
12
from temporalio .api .common .v1 import Payloads
@@ -90,20 +91,20 @@ async def handler(req: web.Request):
90
91
jwks = requests .get (jwks_url ).json ()
91
92
92
93
# Extract Temporal Cloud's public key
93
- public_key = None
94
+ pyjwk = None
94
95
for key in jwks ["keys" ]:
95
96
if key ["kid" ] == kid :
96
97
# Convert JWKS key to PEM format
97
- public_key = RSAAlgorithm . from_jwk (key )
98
+ pyjwk = PyJWK . from_dict (key )
98
99
break
99
100
100
- if public_key is None :
101
+ if pyjwk is None :
101
102
raise ValueError ("Public key not found in JWKS" )
102
103
103
104
# Decode the jwt, verifying against Temporal Cloud's public key
104
105
decoded = jwt .decode (
105
106
encoded ,
106
- public_key ,
107
+ pyjwk . key ,
107
108
algorithms = [algorithm ],
108
109
audience = [
109
110
"https://saas-api.tmprl.cloud" ,
You can’t perform that action at this time.
0 commit comments