pypomes-jwt 0.5.8__tar.gz → 0.5.9__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.8 → pypomes_jwt-0.5.9}/PKG-INFO +1 -1
- {pypomes_jwt-0.5.8 → pypomes_jwt-0.5.9}/pyproject.toml +1 -1
- {pypomes_jwt-0.5.8 → pypomes_jwt-0.5.9}/src/pypomes_jwt/jwt_pomes.py +9 -9
- {pypomes_jwt-0.5.8 → pypomes_jwt-0.5.9}/.gitignore +0 -0
- {pypomes_jwt-0.5.8 → pypomes_jwt-0.5.9}/LICENSE +0 -0
- {pypomes_jwt-0.5.8 → pypomes_jwt-0.5.9}/README.md +0 -0
- {pypomes_jwt-0.5.8 → pypomes_jwt-0.5.9}/src/__init__.py +0 -0
- {pypomes_jwt-0.5.8 → pypomes_jwt-0.5.9}/src/pypomes_jwt/__init__.py +0 -0
- {pypomes_jwt-0.5.8 → pypomes_jwt-0.5.9}/src/pypomes_jwt/jwt_data.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pypomes_jwt
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.9
|
|
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
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import contextlib
|
|
2
2
|
from flask import Request, Response, request, jsonify
|
|
3
3
|
from logging import Logger
|
|
4
|
-
|
|
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
|
-
|
|
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
|
|
|
@@ -76,7 +76,7 @@ def jwt_set_service_access(reference_url: str,
|
|
|
76
76
|
:param logger: optional logger
|
|
77
77
|
"""
|
|
78
78
|
if logger:
|
|
79
|
-
logger.debug(msg=f"Register access data for
|
|
79
|
+
logger.debug(msg=f"Register access data for '{reference_url}'")
|
|
80
80
|
# extract the extra claims
|
|
81
81
|
pos: int = reference_url.find("?")
|
|
82
82
|
if pos > 0:
|
|
@@ -109,7 +109,7 @@ def jwt_remove_service_access(reference_url: str,
|
|
|
109
109
|
:param logger: optional logger
|
|
110
110
|
"""
|
|
111
111
|
if logger:
|
|
112
|
-
logger.debug(msg=f"Remove access data for
|
|
112
|
+
logger.debug(msg=f"Remove access data for '{reference_url}'")
|
|
113
113
|
|
|
114
114
|
__jwt_data.remove_access_data(reference_url=reference_url,
|
|
115
115
|
logger=logger)
|
|
@@ -130,7 +130,7 @@ def jwt_get_token(errors: list[str],
|
|
|
130
130
|
result: str | None = None
|
|
131
131
|
|
|
132
132
|
if logger:
|
|
133
|
-
logger.debug(msg=f"Obtain a JWT token for
|
|
133
|
+
logger.debug(msg=f"Obtain a JWT token for '{reference_url}'")
|
|
134
134
|
|
|
135
135
|
try:
|
|
136
136
|
token_data: dict[str, Any] = __jwt_data.get_token_data(reference_url=reference_url,
|
|
@@ -167,7 +167,7 @@ def jwt_get_token_data(errors: list[str],
|
|
|
167
167
|
result: dict[str, Any] | None = None
|
|
168
168
|
|
|
169
169
|
if logger:
|
|
170
|
-
logger.debug(msg=f"Retrieve JWT token data for
|
|
170
|
+
logger.debug(msg=f"Retrieve JWT token data for '{reference_url}'")
|
|
171
171
|
try:
|
|
172
172
|
result = __jwt_data.get_token_data(reference_url=reference_url,
|
|
173
173
|
logger=logger)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|