OXIESEC PANEL
- Current Dir:
/
/
snap
/
core24
/
888
/
usr
/
lib
/
python3
/
dist-packages
/
jwt
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
03/18/2025 08:12:15 AM
rwxr-xr-x
📄
__init__.py
1.57 KB
06/15/2023 03:07:16 AM
rw-r--r--
📁
__pycache__
-
03/18/2025 08:12:15 AM
rwxr-xr-x
📄
algorithms.py
29.1 KB
06/15/2023 03:07:16 AM
rw-r--r--
📄
api_jwk.py
4.1 KB
06/15/2023 03:07:16 AM
rw-r--r--
📄
api_jws.py
10.84 KB
06/15/2023 03:07:16 AM
rw-r--r--
📄
api_jwt.py
11.55 KB
06/15/2023 03:07:16 AM
rw-r--r--
📄
exceptions.py
1.02 KB
06/15/2023 03:07:16 AM
rw-r--r--
📄
help.py
1.71 KB
06/15/2023 03:07:16 AM
rw-r--r--
📄
jwk_set_cache.py
959 bytes
06/15/2023 03:07:16 AM
rw-r--r--
📄
jwks_client.py
3.96 KB
06/15/2023 03:07:16 AM
rw-r--r--
📄
py.typed
0 bytes
06/15/2023 03:07:16 AM
rw-r--r--
📄
types.py
99 bytes
06/15/2023 03:07:16 AM
rw-r--r--
📄
utils.py
3.81 KB
06/15/2023 03:07:16 AM
rw-r--r--
📄
warnings.py
59 bytes
06/15/2023 03:07:16 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 )