pypomes-iam 0.0.6__tar.gz → 0.0.8__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-iam might be problematic. Click here for more details.
- {pypomes_iam-0.0.6 → pypomes_iam-0.0.8}/PKG-INFO +1 -1
- {pypomes_iam-0.0.6 → pypomes_iam-0.0.8}/pyproject.toml +1 -1
- {pypomes_iam-0.0.6 → pypomes_iam-0.0.8}/src/pypomes_iam/__init__.py +4 -4
- pypomes_iam-0.0.6/src/pypomes_iam/iam_jusbr.py → pypomes_iam-0.0.8/src/pypomes_iam/jusbr_pomes.py +10 -4
- {pypomes_iam-0.0.6 → pypomes_iam-0.0.8}/.gitignore +0 -0
- {pypomes_iam-0.0.6 → pypomes_iam-0.0.8}/LICENSE +0 -0
- {pypomes_iam-0.0.6 → pypomes_iam-0.0.8}/README.md +0 -0
- /pypomes_iam-0.0.6/src/pypomes_iam/iam_provider.py → /pypomes_iam-0.0.8/src/pypomes_iam/provider_pomes.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pypomes_iam
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.8
|
|
4
4
|
Summary: A collection of Python pomes, penyeach (IAM modules)
|
|
5
5
|
Project-URL: Homepage, https://github.com/TheWiseCoder/PyPomes-IAM
|
|
6
6
|
Project-URL: Bug Tracker, https://github.com/TheWiseCoder/PyPomes-IAM/issues
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
from .
|
|
1
|
+
from .jusbr_pomes import (
|
|
2
2
|
jusbr_setup, jusbr_get_token, jusbr_set_scope
|
|
3
3
|
)
|
|
4
|
-
from .
|
|
4
|
+
from .provider_pomes import (
|
|
5
5
|
provider_register, provider_get_token
|
|
6
6
|
)
|
|
7
7
|
|
|
8
8
|
__all__ = [
|
|
9
|
-
#
|
|
9
|
+
# jusbr_pomes
|
|
10
10
|
"jusbr_setup", "jusbr_get_token", "jusbr_set_scope",
|
|
11
|
-
#
|
|
11
|
+
# provider_pomes
|
|
12
12
|
"provider_register", "provider_get_token"
|
|
13
13
|
]
|
|
14
14
|
|
pypomes_iam-0.0.6/src/pypomes_iam/iam_jusbr.py → pypomes_iam-0.0.8/src/pypomes_iam/jusbr_pomes.py
RENAMED
|
@@ -14,6 +14,7 @@ from typing import Any, Final
|
|
|
14
14
|
JUSBR_CLIENT_ID: Final[str] = env_get_str(key=f"{APP_PREFIX}_JUSBR_CLIENT_ID")
|
|
15
15
|
JUSBR_CLIENT_SECRET: Final[str] = env_get_str(key=f"{APP_PREFIX}_JUSBR_CLIENT_SECRET")
|
|
16
16
|
JUSBR_LOGIN_TIMEOUT: Final[int] = env_get_int(key=f"{APP_PREFIX}_JUSBR_LOGIN_TIMEOUT")
|
|
17
|
+
|
|
17
18
|
JUSBR_CALLBACK_ENDPOINT: Final[str] = env_get_str(key=f"{APP_PREFIX}_JUSBR_CALLBACK_ENDPOINT",
|
|
18
19
|
def_value="/iam/jusbr:callback")
|
|
19
20
|
JUSBR_TOKEN_ENDPOINT: Final[str] = env_get_str(key=f"{APP_PREFIX}_JUSBR_TOKEN_ENDPOINT",
|
|
@@ -22,6 +23,8 @@ JUSBR_LOGIN_ENDPOINT: Final[str] = env_get_str(key=f"{APP_PREFIX}_JUSBR_LOGIN_EN
|
|
|
22
23
|
def_value="/iam/jusbr:login")
|
|
23
24
|
JUSBR_LOGOUT_ENDPOINT: Final[str] = env_get_str(key=f"{APP_PREFIX}_JUSBR_LOGOUT_ENDPOINT",
|
|
24
25
|
def_value="/iam/jusbr:logout")
|
|
26
|
+
|
|
27
|
+
JUSBR_CALLBACK_URL: Final[str] = env_get_str(key=f"{APP_PREFIX}_JUSBR_CALLBACK_URL")
|
|
25
28
|
JUSBR_AUTH_URL: Final[str] = env_get_str(
|
|
26
29
|
key=f"{APP_PREFIX}JUSBR_AUTH_URL",
|
|
27
30
|
def_value="https://sso.stg.cloud.pje.jus.br/auth/realms/pje/protocol/openid-connect/auth"
|
|
@@ -30,7 +33,6 @@ JUSBR_TOKEN_URL: Final[str] = env_get_str(
|
|
|
30
33
|
key=f"{APP_PREFIX}JUSBR_TOKEN_URL",
|
|
31
34
|
def_value="https://sso.stg.cloud.pje.jus.br/auth/realms/pje/protocol/openid-connect/token"
|
|
32
35
|
)
|
|
33
|
-
JUSBR_CALLBACK_URL: Final[str] = env_get_str(key=f"{APP_PREFIX}_JUSBR_CALLBACK_URL")
|
|
34
36
|
|
|
35
37
|
# safe memory cache - structure:
|
|
36
38
|
# {
|
|
@@ -56,6 +58,7 @@ _jusbr_registry: dict[str, Any] = {
|
|
|
56
58
|
"client-secret": None,
|
|
57
59
|
"login-timeout": None,
|
|
58
60
|
"auth-url": None,
|
|
61
|
+
"callback-url": None,
|
|
59
62
|
"token-url": None,
|
|
60
63
|
"users": []
|
|
61
64
|
}
|
|
@@ -73,6 +76,7 @@ def jusbr_setup(flask_app: Flask,
|
|
|
73
76
|
login_endpoint: str = JUSBR_LOGIN_ENDPOINT,
|
|
74
77
|
logout_endpoint: str = JUSBR_LOGOUT_ENDPOINT,
|
|
75
78
|
auth_url: str = JUSBR_AUTH_URL,
|
|
79
|
+
callback_url: str = JUSBR_CALLBACK_URL,
|
|
76
80
|
token_url: str = JUSBR_TOKEN_URL,
|
|
77
81
|
logger: Logger = None) -> None:
|
|
78
82
|
"""
|
|
@@ -89,6 +93,7 @@ def jusbr_setup(flask_app: Flask,
|
|
|
89
93
|
:param login_endpoint: endpoint for redirecting user to JusBR login page
|
|
90
94
|
:param logout_endpoint: endpoint for terminating user access to JusBR
|
|
91
95
|
:param auth_url: URL to access the JusBR login page
|
|
96
|
+
:param callback_url: URL for JusBR to callback on login
|
|
92
97
|
:param token_url: URL for obtaing or refreshing the token
|
|
93
98
|
:param logger: optional logger
|
|
94
99
|
"""
|
|
@@ -103,6 +108,7 @@ def jusbr_setup(flask_app: Flask,
|
|
|
103
108
|
"client-secret": client_secret,
|
|
104
109
|
"login-timeout": login_timeout,
|
|
105
110
|
"auth-url": auth_url,
|
|
111
|
+
"callback-url": callback_url,
|
|
106
112
|
"token-url": token_url
|
|
107
113
|
})
|
|
108
114
|
|
|
@@ -161,7 +167,7 @@ def service_login() -> Response:
|
|
|
161
167
|
user_data["cache-obj"] = safe_cache
|
|
162
168
|
auth_url: str = (f"{_jusbr_registry["auth-url"]}?response_type=code"
|
|
163
169
|
f"&client_id={_jusbr_registry["client-id"]}"
|
|
164
|
-
f"&redirect_url={_jusbr_registry["
|
|
170
|
+
f"&redirect_url={_jusbr_registry["callback-url"]}"
|
|
165
171
|
f"&state={oauth_state}")
|
|
166
172
|
if user_data.get("oauth-scope"):
|
|
167
173
|
auth_url += f"&scope={user_data.get("oauth-scope")}"
|
|
@@ -199,7 +205,7 @@ def service_logout() -> Response:
|
|
|
199
205
|
# methods=["POST"])
|
|
200
206
|
def service_callback() -> Response:
|
|
201
207
|
"""
|
|
202
|
-
Entry point for the callback from JusBR on authentication.
|
|
208
|
+
Entry point for the callback from JusBR on authentication operation.
|
|
203
209
|
|
|
204
210
|
:return: the response containing the token, or *NOT AUTHORIZED*
|
|
205
211
|
"""
|
|
@@ -225,7 +231,7 @@ def service_callback() -> Response:
|
|
|
225
231
|
body_data: dict[str, Any] = {
|
|
226
232
|
"grant_type": "authorization_code",
|
|
227
233
|
"code": code,
|
|
228
|
-
"redirec_url": _jusbr_registry.get("
|
|
234
|
+
"redirec_url": _jusbr_registry.get("callback-url"),
|
|
229
235
|
}
|
|
230
236
|
token = __post_jusbr(user_data=user_data,
|
|
231
237
|
body_data=body_data,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|