pypomes-iam 0.3.7__tar.gz → 0.3.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-iam might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pypomes_iam
3
- Version: 0.3.7
3
+ Version: 0.3.9
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
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
6
6
 
7
7
  [project]
8
8
  name = "pypomes_iam"
9
- version = "0.3.7"
9
+ version = "0.3.9"
10
10
  authors = [
11
11
  { name="GT Nunes", email="wisecoder01@gmail.com" }
12
12
  ]
@@ -1,5 +1,5 @@
1
1
  from .iam_pomes import (
2
- IamServer, register_logger,
2
+ IamServer, logger_register,
3
3
  login_callback, token_exchange,
4
4
  user_login, user_logout, user_token
5
5
  )
@@ -18,7 +18,7 @@ from .token_pomes import (
18
18
 
19
19
  __all__ = [
20
20
  # iam_pomes
21
- "IamServer", "register_logger",
21
+ "IamServer", "logger_register",
22
22
  "login_callback", "token_exchange",
23
23
  "user_login", "user_logout", "user_token",
24
24
  # jusbr_pomes
@@ -16,7 +16,7 @@ from .iam_common import (
16
16
  from .token_pomes import token_validate
17
17
 
18
18
 
19
- def register_logger(logger: Logger) -> None:
19
+ def logger_register(logger: Logger) -> None:
20
20
  """
21
21
  Register the logger for IAM operations.
22
22
 
@@ -31,34 +31,32 @@ JUSBR_URL_AUTH_BASE: Final[str] = env_get_str(key=f"{APP_PREFIX}_JUSBR_URL_AUTH_
31
31
 
32
32
 
33
33
  def jusbr_setup(flask_app: Flask,
34
+ base_url: str = JUSBR_URL_AUTH_BASE,
34
35
  client_id: str = JUSBR_CLIENT_ID,
35
36
  client_secret: str = JUSBR_CLIENT_SECRET,
36
37
  client_timeout: int = JUSBR_CLIENT_TIMEOUT,
37
- public_key_lifetime: int = JUSBR_PUBLIC_KEY_LIFETIME,
38
- recipient_attribute: str = JUSBR_RECIPIENT_ATTR,
39
- callback_endpoint: str = JUSBR_ENDPOINT_CALLBACK,
40
- token_endpoint: str = JUSBR_ENDPOINT_TOKEN,
41
- login_endpoint: str = JUSBR_ENDPOINT_LOGIN,
42
- logout_endpoint: str = JUSBR_ENDPOINT_LOGOUT,
43
- base_url: str = JUSBR_URL_AUTH_BASE,
44
- logger: Logger = None) -> None:
38
+ public_key_lifetime: int | None = JUSBR_PUBLIC_KEY_LIFETIME,
39
+ recipient_attribute: str | None = JUSBR_RECIPIENT_ATTR,
40
+ callback_endpoint: str | None = JUSBR_ENDPOINT_CALLBACK,
41
+ login_endpoint: str | None = JUSBR_ENDPOINT_LOGIN,
42
+ logout_endpoint: str | None = JUSBR_ENDPOINT_LOGOUT,
43
+ token_endpoint: str | None = JUSBR_ENDPOINT_TOKEN) -> None:
45
44
  """
46
45
  Configure the JusBR IAM.
47
46
 
48
47
  This should be invoked only once, before the first access to a JusBR service.
49
48
 
50
49
  :param flask_app: the Flask application
50
+ :param base_url: base URL to request JusBR services
51
51
  :param client_id: the client's identification with JusBR
52
52
  :param client_secret: the client's password with JusBR
53
53
  :param client_timeout: timeout for login authentication (in seconds,defaults to no timeout)
54
54
  :param public_key_lifetime: how long to use JusBR's public key, before refreshing it (in seconds)
55
55
  :param recipient_attribute: attribute in the token's payload holding the token's subject
56
56
  :param callback_endpoint: endpoint for the callback from JusBR
57
- :param token_endpoint: endpoint for retrieving JusBR's authentication token
58
57
  :param login_endpoint: endpoint for redirecting user to JusBR's login page
59
58
  :param logout_endpoint: endpoint for terminating user access to JusBR
60
- :param base_url: base URL to request JusBR services
61
- :param logger: optional logger
59
+ :param token_endpoint: endpoint for retrieving JusBR's authentication token
62
60
  """
63
61
  from .iam_services import service_login, service_logout, service_callback, service_token
64
62
 
@@ -75,11 +73,15 @@ def jusbr_setup(flask_app: Flask,
75
73
  "pk-expiration": sys.maxsize,
76
74
  "pk-lifetime": public_key_lifetime,
77
75
  "cache": cache,
78
- "logger": logger,
79
76
  "redirect-uri": None
80
77
  }
81
78
 
82
79
  # establish the endpoints
80
+ if callback_endpoint:
81
+ flask_app.add_url_rule(rule=callback_endpoint,
82
+ endpoint="jusbr-callback",
83
+ view_func=service_callback,
84
+ methods=["GET"])
83
85
  if login_endpoint:
84
86
  flask_app.add_url_rule(rule=login_endpoint,
85
87
  endpoint="jusbr-login",
@@ -90,11 +92,6 @@ def jusbr_setup(flask_app: Flask,
90
92
  endpoint="jusbr-logout",
91
93
  view_func=service_logout,
92
94
  methods=["GET"])
93
- if callback_endpoint:
94
- flask_app.add_url_rule(rule=callback_endpoint,
95
- endpoint="jusbr-callback",
96
- view_func=service_callback,
97
- methods=["GET"])
98
95
  if token_endpoint:
99
96
  flask_app.add_url_rule(rule=token_endpoint,
100
97
  endpoint="jusbr-token",
@@ -34,38 +34,36 @@ KEYCLOAK_URL_AUTH_BASE: Final[str] = env_get_str(key=f"{APP_PREFIX}_KEYCLOAK_URL
34
34
 
35
35
 
36
36
  def keycloak_setup(flask_app: Flask,
37
+ base_url: str = KEYCLOAK_URL_AUTH_BASE,
38
+ realm: str = KEYCLOAK_REALM,
37
39
  client_id: str = KEYCLOAK_CLIENT_ID,
38
40
  client_secret: str = KEYCLOAK_CLIENT_SECRET,
39
41
  client_timeout: int = KEYCLOAK_CLIENT_TIMEOUT,
40
- public_key_lifetime: int = KEYCLOAK_PUBLIC_KEY_LIFETIME,
41
- recipient_attribute: str = KEYCLOAK_RECIPIENT_ATTR,
42
- realm: str = KEYCLOAK_REALM,
43
- callback_endpoint: str = KEYCLOAK_ENDPOINT_CALLBACK,
44
- exchange_endpoint: str = KEYCLOAK_ENDPOINT_EXCHANGE,
45
- login_endpoint: str = KEYCLOAK_ENDPOINT_LOGIN,
46
- logout_endpoint: str = KEYCLOAK_ENDPOINT_LOGOUT,
47
- token_endpoint: str = KEYCLOAK_ENDPOINT_TOKEN,
48
- base_url: str = KEYCLOAK_URL_AUTH_BASE,
49
- logger: Logger = None) -> None:
42
+ public_key_lifetime: int | None = KEYCLOAK_PUBLIC_KEY_LIFETIME,
43
+ recipient_attribute: str | None = KEYCLOAK_RECIPIENT_ATTR,
44
+ callback_endpoint: str | None = KEYCLOAK_ENDPOINT_CALLBACK,
45
+ login_endpoint: str | None = KEYCLOAK_ENDPOINT_LOGIN,
46
+ logout_endpoint: str | None = KEYCLOAK_ENDPOINT_LOGOUT,
47
+ token_endpoint: str | None = KEYCLOAK_ENDPOINT_TOKEN,
48
+ exchange_endpoint: str | None = KEYCLOAK_ENDPOINT_EXCHANGE) -> None:
50
49
  """
51
50
  Configure the Keycloak IAM.
52
51
 
53
52
  This should be invoked only once, before the first access to a Keycloak service.
54
53
 
55
54
  :param flask_app: the Flask application
55
+ :param base_url: base URL to request Keycloak services
56
+ :param realm: the Keycloak realm
56
57
  :param client_id: the client's identification with JusBR
57
58
  :param client_secret: the client's password with JusBR
58
59
  :param client_timeout: timeout for login authentication (in seconds,defaults to no timeout)
59
60
  :param public_key_lifetime: how long to use Keycloak's public key, before refreshing it (in seconds)
60
61
  :param recipient_attribute: attribute in the token's payload holding the token's subject
61
- :param realm: the Keycloak realm
62
62
  :param callback_endpoint: endpoint for the callback from the front end
63
- :param exchange_endpoint: endpoint fro requesting token exchange
64
- :param token_endpoint: endpoint for retrieving Keycloak's authentication token
65
63
  :param login_endpoint: endpoint for redirecting user to Keycloak's login page
66
64
  :param logout_endpoint: endpoint for terminating user access to Keycloak
67
- :param base_url: base URL to request Keycloak services
68
- :param logger: optional logger
65
+ :param token_endpoint: endpoint for retrieving Keycloak's authentication token
66
+ :param exchange_endpoint: endpoint for requesting token exchange
69
67
  """
70
68
  from .iam_services import (
71
69
  service_login, service_logout, service_callback, service_exchange, service_token
@@ -84,11 +82,15 @@ def keycloak_setup(flask_app: Flask,
84
82
  "pk-expiration": sys.maxsize,
85
83
  "pk-lifetime": public_key_lifetime,
86
84
  "cache": cache,
87
- "logger": logger,
88
85
  "redirect-uri": None
89
86
  }
90
87
 
91
88
  # establish the endpoints
89
+ if callback_endpoint:
90
+ flask_app.add_url_rule(rule=callback_endpoint,
91
+ endpoint="keycloak-callback",
92
+ view_func=service_callback,
93
+ methods=["GET"])
92
94
  if login_endpoint:
93
95
  flask_app.add_url_rule(rule=login_endpoint,
94
96
  endpoint="keycloak-login",
@@ -99,11 +101,6 @@ def keycloak_setup(flask_app: Flask,
99
101
  endpoint="keycloak-logout",
100
102
  view_func=service_logout,
101
103
  methods=["GET"])
102
- if callback_endpoint:
103
- flask_app.add_url_rule(rule=callback_endpoint,
104
- endpoint="keycloak-callback",
105
- view_func=service_callback,
106
- methods=["GET"])
107
104
  if token_endpoint:
108
105
  flask_app.add_url_rule(rule=token_endpoint,
109
106
  endpoint="keycloak-token",
File without changes
File without changes
File without changes