pypomes-jwt 0.5.2__tar.gz → 0.5.4__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.
Potentially problematic release.
This version of pypomes-jwt might be problematic. Click here for more details.
- {pypomes_jwt-0.5.2 → pypomes_jwt-0.5.4}/PKG-INFO +1 -2
- {pypomes_jwt-0.5.2 → pypomes_jwt-0.5.4}/pyproject.toml +2 -2
- {pypomes_jwt-0.5.2 → pypomes_jwt-0.5.4}/src/pypomes_jwt/jwt_data.py +4 -3
- {pypomes_jwt-0.5.2 → pypomes_jwt-0.5.4}/src/pypomes_jwt/jwt_pomes.py +5 -5
- {pypomes_jwt-0.5.2 → pypomes_jwt-0.5.4}/.gitignore +0 -0
- {pypomes_jwt-0.5.2 → pypomes_jwt-0.5.4}/LICENSE +0 -0
- {pypomes_jwt-0.5.2 → pypomes_jwt-0.5.4}/README.md +0 -0
- {pypomes_jwt-0.5.2 → pypomes_jwt-0.5.4}/src/__init__.py +0 -0
- {pypomes_jwt-0.5.2 → pypomes_jwt-0.5.4}/src/pypomes_jwt/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: pypomes_jwt
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.4
|
|
4
4
|
Summary: A collection of Python pomes, penyeach (JWT module)
|
|
5
5
|
Project-URL: Homepage, https://github.com/TheWiseCoder/PyPomes-JWT
|
|
6
6
|
Project-URL: Bug Tracker, https://github.com/TheWiseCoder/PyPomes-JWT/issues
|
|
@@ -11,7 +11,6 @@ Classifier: Programming Language :: Python :: 3
|
|
|
11
11
|
Requires-Python: >=3.12
|
|
12
12
|
Requires-Dist: pip>=24.3.1
|
|
13
13
|
Requires-Dist: pyjwt>=2.10.0
|
|
14
|
-
Requires-Dist: pyopenssl>=24.2.1
|
|
15
14
|
Requires-Dist: pypomes-core>=1.6.2
|
|
16
15
|
Requires-Dist: setuptools>=75.5.0
|
|
17
16
|
Requires-Dist: wheel>=0.45.0
|
|
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
|
|
|
6
6
|
|
|
7
7
|
[project]
|
|
8
8
|
name = "pypomes_jwt"
|
|
9
|
-
version = "0.5.
|
|
9
|
+
version = "0.5.4"
|
|
10
10
|
authors = [
|
|
11
11
|
{ name="GT Nunes", email="wisecoder01@gmail.com" }
|
|
12
12
|
]
|
|
@@ -21,7 +21,7 @@ classifiers = [
|
|
|
21
21
|
dependencies = [
|
|
22
22
|
"pip>=24.3.1",
|
|
23
23
|
"PyJWT>=2.10.0",
|
|
24
|
-
|
|
24
|
+
# "PyOpenSSL>=24.2.1", - pending fixing runtime error in jwt_data.py
|
|
25
25
|
"pypomes_core>=1.6.2",
|
|
26
26
|
"setuptools>=75.5.0",
|
|
27
27
|
"wheel>=0.45.0"
|
|
@@ -98,7 +98,7 @@ class JwtData:
|
|
|
98
98
|
"access-max-age": access_max_age,
|
|
99
99
|
"request-timeout": request_timeout,
|
|
100
100
|
"local-provider": local_provider,
|
|
101
|
-
"refresh-exp": datetime.now(timezone.utc) + timedelta(seconds=refresh_max_age)
|
|
101
|
+
"refresh-exp": datetime.now(tz=timezone.utc) + timedelta(seconds=refresh_max_age)
|
|
102
102
|
}
|
|
103
103
|
if algorithm in ["HS256", "HS512"]:
|
|
104
104
|
control_data["secret-key"] = secret_key
|
|
@@ -116,7 +116,8 @@ class JwtData:
|
|
|
116
116
|
custom_claims[key] = value
|
|
117
117
|
standard_claims["exp"] = datetime(year=2000,
|
|
118
118
|
month=1,
|
|
119
|
-
day=1
|
|
119
|
+
day=1,
|
|
120
|
+
tzinfo=timezone.utc)
|
|
120
121
|
# store access data
|
|
121
122
|
item_data = {
|
|
122
123
|
"control-data": control_data,
|
|
@@ -190,7 +191,7 @@ class JwtData:
|
|
|
190
191
|
control_data: dict[str, Any] = item_data.get("control-data")
|
|
191
192
|
custom_claims: dict[str, Any] = item_data.get("custom-claims")
|
|
192
193
|
standard_claims: dict[str, Any] = item_data.get("standard-claims")
|
|
193
|
-
just_now: datetime = datetime.now(timezone.utc)
|
|
194
|
+
just_now: datetime = datetime.now(tz=timezone.utc)
|
|
194
195
|
|
|
195
196
|
# is the current token still valid ?
|
|
196
197
|
if just_now > standard_claims.get("exp"):
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import contextlib
|
|
2
2
|
from flask import Request, Response, request, jsonify
|
|
3
3
|
from logging import Logger
|
|
4
|
-
from OpenSSL import crypto
|
|
4
|
+
# from OpenSSL import crypto
|
|
5
5
|
from pypomes_core import APP_PREFIX, env_get_str, env_get_bytes, env_get_int
|
|
6
6
|
from secrets import token_bytes
|
|
7
7
|
from typing import Any, Final, Literal
|
|
@@ -21,10 +21,10 @@ JWT_ENDPOINT_URL: Final[str] = env_get_str(key=f"{APP_PREFIX}_JWT_ENDPOINT_URL")
|
|
|
21
21
|
|
|
22
22
|
__priv_key: bytes = env_get_bytes(key=f"{APP_PREFIX}_JWT_RSA_PRIVATE_KEY")
|
|
23
23
|
__pub_key: bytes = env_get_bytes(key=f"{APP_PREFIX}_JWT_RSA_PUBLIC_KEY")
|
|
24
|
-
if not __priv_key or not __pub_key:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
# if not __priv_key or not __pub_key:
|
|
25
|
+
# pk = crypto.PKey()
|
|
26
|
+
# __priv_key = crypto.dump_privatekey(crypto.FILETYPE_PEM, pk)
|
|
27
|
+
# __pub_key = crypto.dump_publickey(crypto.FILETYPE_PEM, pk)
|
|
28
28
|
JWT_RSA_PRIVATE_KEY: Final[bytes] = __priv_key
|
|
29
29
|
JWT_RSA_PUBLIC_KEY: Final[bytes] = __pub_key
|
|
30
30
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|