iaptoolkit 0.3.7a2__tar.gz → 0.3.7a4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {iaptoolkit-0.3.7a2 → iaptoolkit-0.3.7a4}/PKG-INFO +1 -1
- {iaptoolkit-0.3.7a2 → iaptoolkit-0.3.7a4}/pyproject.toml +1 -1
- {iaptoolkit-0.3.7a2 → iaptoolkit-0.3.7a4}/src/iaptoolkit/jwt/verify.py +1 -1
- {iaptoolkit-0.3.7a2 → iaptoolkit-0.3.7a4}/src/iaptoolkit/jwt/verify_async.py +10 -5
- {iaptoolkit-0.3.7a2 → iaptoolkit-0.3.7a4}/LICENSE +0 -0
- {iaptoolkit-0.3.7a2 → iaptoolkit-0.3.7a4}/README.md +0 -0
- {iaptoolkit-0.3.7a2 → iaptoolkit-0.3.7a4}/src/iaptoolkit/__init__.py +0 -0
- {iaptoolkit-0.3.7a2 → iaptoolkit-0.3.7a4}/src/iaptoolkit/constants.py +0 -0
- {iaptoolkit-0.3.7a2 → iaptoolkit-0.3.7a4}/src/iaptoolkit/exceptions.py +0 -0
- {iaptoolkit-0.3.7a2 → iaptoolkit-0.3.7a4}/src/iaptoolkit/headers.py +0 -0
- {iaptoolkit-0.3.7a2 → iaptoolkit-0.3.7a4}/src/iaptoolkit/jwt/__init__.py +0 -0
- {iaptoolkit-0.3.7a2 → iaptoolkit-0.3.7a4}/src/iaptoolkit/jwt/constants.py +0 -0
- {iaptoolkit-0.3.7a2 → iaptoolkit-0.3.7a4}/src/iaptoolkit/jwt/flask.py +0 -0
- {iaptoolkit-0.3.7a2 → iaptoolkit-0.3.7a4}/src/iaptoolkit/jwt/metrics.py +0 -0
- {iaptoolkit-0.3.7a2 → iaptoolkit-0.3.7a4}/src/iaptoolkit/jwt/quart.py +0 -0
- {iaptoolkit-0.3.7a2 → iaptoolkit-0.3.7a4}/src/iaptoolkit/tokens/__init__.py +0 -0
- {iaptoolkit-0.3.7a2 → iaptoolkit-0.3.7a4}/src/iaptoolkit/tokens/service_account.py +0 -0
- {iaptoolkit-0.3.7a2 → iaptoolkit-0.3.7a4}/src/iaptoolkit/tokens/structs.py +0 -0
- {iaptoolkit-0.3.7a2 → iaptoolkit-0.3.7a4}/src/iaptoolkit/tokens/token_datastore.py +0 -0
- {iaptoolkit-0.3.7a2 → iaptoolkit-0.3.7a4}/src/iaptoolkit/utils/__init__.py +0 -0
- {iaptoolkit-0.3.7a2 → iaptoolkit-0.3.7a4}/src/iaptoolkit/utils/urls.py +0 -0
|
@@ -52,7 +52,7 @@ class GoogleIAPKeys:
|
|
|
52
52
|
|
|
53
53
|
@property
|
|
54
54
|
def should_refresh(self) -> bool:
|
|
55
|
-
if self._retrieved_timestamp > datetime.datetime.now() - datetime.timedelta(
|
|
55
|
+
if self._retrieved_timestamp > datetime.datetime.now(tz=datetime.UTC) - datetime.timedelta(
|
|
56
56
|
seconds=self._key_ttl_seconds
|
|
57
57
|
):
|
|
58
58
|
return False
|
|
@@ -24,9 +24,8 @@ class GoogleIAPKeys_Async(GoogleIAPKeys):
|
|
|
24
24
|
_key_ttl_seconds: int = 300 # 5 mins
|
|
25
25
|
_certs: dict
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
def __init__(self, key_ttl_seconds: int = 300) -> None:
|
|
28
28
|
self._key_ttl_seconds = key_ttl_seconds
|
|
29
|
-
await self.refresh_async()
|
|
30
29
|
|
|
31
30
|
async def refresh_async(self):
|
|
32
31
|
await asyncio.to_thread(self.refresh)
|
|
@@ -40,13 +39,19 @@ class GoogleIAPKeys_Async(GoogleIAPKeys):
|
|
|
40
39
|
|
|
41
40
|
google_public_keys_async: GoogleIAPKeys_Async | None = None
|
|
42
41
|
|
|
42
|
+
async def get_google_public_keys() -> GoogleIAPKeys_Async:
|
|
43
|
+
global google_public_keys_async # Use as singleton
|
|
44
|
+
if not google_public_keys_async:
|
|
45
|
+
google_public_keys_async = GoogleIAPKeys_Async()
|
|
46
|
+
await google_public_keys_async.refresh_async()
|
|
47
|
+
return google_public_keys_async
|
|
48
|
+
|
|
49
|
+
|
|
43
50
|
|
|
44
51
|
async def verify_iap_jwt_async(iap_jwt: str, expected_audience: str|None) -> str:
|
|
45
52
|
# Rudimentary async wrapper func for verify_iap_jwt using asyncio threads until google.auth.jwt_async is public
|
|
46
53
|
|
|
47
|
-
|
|
48
|
-
if not google_public_keys_async:
|
|
49
|
-
google_public_keys_async = GoogleIAPKeys_Async()
|
|
54
|
+
google_public_keys_async = await get_google_public_keys()
|
|
50
55
|
|
|
51
56
|
try:
|
|
52
57
|
decoded_jwt = await asyncio.to_thread(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|