OXIESEC PANEL
- Current Dir:
/
/
opt
/
cloudlinux
/
venv
/
lib
/
python3.11
/
site-packages
/
jwt
Server IP: 2a02:4780:11:1084:0:327f:3464:10
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
09/05/2025 09:34:06 AM
rwxr-xr-x
📄
__init__.py
1.63 KB
12/18/2024 10:23:15 AM
rw-r--r--
📁
__pycache__
-
02/07/2025 10:01:50 PM
rwxr-xr-x
📄
algorithms.py
29.1 KB
12/18/2024 10:23:15 AM
rw-r--r--
📄
api_jwk.py
4.1 KB
12/18/2024 10:23:15 AM
rw-r--r--
📄
api_jws.py
10.84 KB
12/18/2024 10:23:15 AM
rw-r--r--
📄
api_jwt.py
12.34 KB
12/18/2024 10:23:15 AM
rw-r--r--
📄
exceptions.py
1.02 KB
12/18/2024 10:23:15 AM
rw-r--r--
📄
help.py
1.71 KB
12/18/2024 10:23:15 AM
rw-r--r--
📄
jwk_set_cache.py
959 bytes
12/18/2024 10:23:15 AM
rw-r--r--
📄
jwks_client.py
4.12 KB
12/18/2024 10:23:15 AM
rw-r--r--
📄
py.typed
0 bytes
12/18/2024 10:23:15 AM
rw-r--r--
📄
types.py
99 bytes
12/18/2024 10:23:15 AM
rw-r--r--
📄
utils.py
3.81 KB
12/18/2024 10:23:15 AM
rw-r--r--
📄
warnings.py
59 bytes
12/18/2024 10:23:15 AM
rw-r--r--
Editing: jwk_set_cache.py
Close
import time from typing import Optional from .api_jwk import PyJWKSet, PyJWTSetWithTimestamp class JWKSetCache: def __init__(self, lifespan: int) -> None: self.jwk_set_with_timestamp: Optional[PyJWTSetWithTimestamp] = None self.lifespan = lifespan def put(self, jwk_set: PyJWKSet) -> None: if jwk_set is not None: self.jwk_set_with_timestamp = PyJWTSetWithTimestamp(jwk_set) else: # clear cache self.jwk_set_with_timestamp = None def get(self) -> Optional[PyJWKSet]: if self.jwk_set_with_timestamp is None or self.is_expired(): return None return self.jwk_set_with_timestamp.get_jwk_set() def is_expired(self) -> bool: return ( self.jwk_set_with_timestamp is not None and self.lifespan > -1 and time.monotonic() > self.jwk_set_with_timestamp.get_timestamp() + self.lifespan )