jaaql-middleware-python 4.26.0__tar.gz → 4.26.2__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.
- {jaaql-middleware-python-4.26.0/jaaql_middleware_python.egg-info → jaaql-middleware-python-4.26.2}/PKG-INFO +1 -1
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/constants.py +2 -1
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/documentation/documentation_internal.py +13 -9
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/mvc/base_controller.py +9 -4
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/mvc/controller.py +2 -2
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/mvc/exception_queries.py +2 -2
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/mvc/generated_queries.py +1 -1
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/mvc/model.py +44 -26
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/scripts/01.install_domains.generated.sql +1 -1
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/scripts/02.install_super_user.exceptions.sql +4 -2
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2/jaaql_middleware_python.egg-info}/PKG-INFO +1 -1
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/LICENSE.txt +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/README.md +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/__init__.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/config/__init__.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/config/config-docker.ini +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/config/config-test.ini +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/config/config.ini +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/config_constants.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/db/__init__.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/db/db_interface.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/db/db_pg_interface.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/db/db_utils.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/db/db_utils_no_circ.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/documentation/__init__.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/documentation/documentation_public.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/documentation/documentation_shared.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/email/__init__.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/email/email_manager.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/email/email_manager_service.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/email/patch_ems.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/exceptions/__init__.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/exceptions/custom_http_status.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/exceptions/http_status_exception.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/exceptions/jaaql_interpretable_handled_errors.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/exceptions/not_yet_implement_exception.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/generated_constants.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/interpreter/__init__.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/interpreter/interpret_jaaql.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/jaaql.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/migrations/__init__.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/migrations/migrations.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/mvc/__init__.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/mvc/base_model.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/mvc/controller_interface.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/mvc/handmade_queries.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/mvc/model_interface.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/mvc/response.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/openapi/__init__.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/openapi/swagger_documentation.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/patch.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/scripts/03.install_super_user.handwritten.sql +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/scripts/04.install_jaaql_data_structures.generated.sql +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/scripts/05.install_static_data.generated.sql +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/scripts/06.install_jaaql.exceptions.sql +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/scripts/ZZZZ.generated_functions_views_and_permissions.sql +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/scripts/ZZZZ.reset_references.sql +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/scripts/swagger_template.html +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/services/__init__.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/services/cached_canned_query_service.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/services/migrations_manager_service.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/services/patch_mms.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/services/patch_shared_var_service.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/services/shared_var_service.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/utilities/__init__.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/utilities/crypt_utils.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/utilities/options.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/utilities/utils.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/utilities/utils_no_project_imports.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/utilities/vault.py +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql_middleware_python.egg-info/SOURCES.txt +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql_middleware_python.egg-info/dependency_links.txt +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql_middleware_python.egg-info/requires.txt +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql_middleware_python.egg-info/top_level.txt +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/setup.cfg +0 -0
- {jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: jaaql-middleware-python
|
|
3
|
-
Version: 4.26.
|
|
3
|
+
Version: 4.26.2
|
|
4
4
|
Summary: The jaaql package, allowing for rapid development and deployment of RESTful HTTP applications
|
|
5
5
|
Home-page: https://github.com/JAAQL/JAAQL-middleware-python
|
|
6
6
|
Author: Software Quality Measurement and Improvement bv
|
|
@@ -53,6 +53,7 @@ CRON_month = "month"
|
|
|
53
53
|
CRON_dayOfWeek = "dayOfWeek"
|
|
54
54
|
|
|
55
55
|
REGEX__dmbs_object_name = r'^[0-9a-zA-Z_]{1,63}$'
|
|
56
|
+
REGEX__dmbs_procedure_name = r'^[0-9a-zA-Z_$.]{1,63}$'
|
|
56
57
|
|
|
57
58
|
SEPARATOR__comma_space = ", "
|
|
58
59
|
SEPARATOR__comma = ","
|
|
@@ -181,5 +182,5 @@ ROLE__postgres = "postgres"
|
|
|
181
182
|
|
|
182
183
|
PROTOCOL__postgres = "postgresql://"
|
|
183
184
|
|
|
184
|
-
VERSION = "4.26.
|
|
185
|
+
VERSION = "4.26.2"
|
|
185
186
|
|
|
@@ -355,15 +355,19 @@ DOCUMENTATION__oidc_user_registries = SwaggerDocumentation(
|
|
|
355
355
|
],
|
|
356
356
|
response=SwaggerResponse(
|
|
357
357
|
description="Providers response",
|
|
358
|
-
response=
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
358
|
+
response=SwaggerArgumentResponse(
|
|
359
|
+
name="providers",
|
|
360
|
+
description="A list of the providers",
|
|
361
|
+
arg_type=SwaggerList(
|
|
362
|
+
ARG_RES__provider,
|
|
363
|
+
SwaggerArgumentResponse(
|
|
364
|
+
name=KG__identity_provider_service__logo_url,
|
|
365
|
+
description="The logo url for the provider",
|
|
366
|
+
arg_type=str,
|
|
367
|
+
example=["/identity-logos/azure.png"]
|
|
368
|
+
)
|
|
365
369
|
)
|
|
366
|
-
|
|
370
|
+
)
|
|
367
371
|
)
|
|
368
372
|
)
|
|
369
373
|
)
|
|
@@ -400,7 +404,7 @@ DOCUMENTATION__oidc_exchange_code = SwaggerDocumentation(
|
|
|
400
404
|
name="Fetch OIDC code",
|
|
401
405
|
description="Exchanges OIDC auth code for auth token, returns the token",
|
|
402
406
|
method=REST__POST,
|
|
403
|
-
|
|
407
|
+
body=[
|
|
404
408
|
SwaggerArgumentResponse(
|
|
405
409
|
name=KEY__code,
|
|
406
410
|
description="The OIDC Auth code",
|
{jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/mvc/base_controller.py
RENAMED
|
@@ -364,18 +364,22 @@ class BaseJAAQLController:
|
|
|
364
364
|
if method.arguments[0] == ARG_RESP__allow_all:
|
|
365
365
|
was_allow_all = True
|
|
366
366
|
|
|
367
|
+
only_args = False
|
|
367
368
|
if len(method.body) != 0 or was_allow_all:
|
|
368
369
|
BaseJAAQLController.enforce_content_type_json()
|
|
369
370
|
data = request.json
|
|
370
371
|
else:
|
|
371
372
|
content_type = request.headers.get('Content-Type', '')
|
|
372
373
|
if 'charset=' not in content_type and len(kwargs) == 0:
|
|
373
|
-
|
|
374
|
+
only_args = True
|
|
374
375
|
|
|
375
376
|
if isinstance(data, list):
|
|
376
377
|
combined_data = data
|
|
377
378
|
else:
|
|
378
|
-
|
|
379
|
+
if only_args:
|
|
380
|
+
combined_data = {**request.args}
|
|
381
|
+
else:
|
|
382
|
+
combined_data = {**request.form, **request.args, **data, **kwargs}
|
|
379
383
|
|
|
380
384
|
if len(combined_data) != len(request.form) + len(request.args) + len(data) + len(kwargs):
|
|
381
385
|
raise HttpStatusException(ERR__duplicated_field, HTTPStatus.BAD_REQUEST)
|
|
@@ -663,8 +667,9 @@ class BaseJAAQLController:
|
|
|
663
667
|
if jaaql_resp.raw_response is not None:
|
|
664
668
|
resp = jaaql_resp.raw_response
|
|
665
669
|
resp = Response(resp, mimetype=jaaql_resp.response_type, status=jaaql_resp.response_code)
|
|
666
|
-
|
|
667
|
-
|
|
670
|
+
|
|
671
|
+
for key, val in jaaql_resp.raw_headers.items():
|
|
672
|
+
resp.headers.add(key, val)
|
|
668
673
|
|
|
669
674
|
if request.cookies.get(COOKIE_JAAQL_AUTH) is not None and COOKIE_JAAQL_AUTH not in jaaql_resp.cookies:
|
|
670
675
|
resp.headers.add("Set-Cookie", format_cookie(COOKIE_JAAQL_AUTH, request.cookies.get(COOKIE_JAAQL_AUTH),
|
|
@@ -20,11 +20,11 @@ class JAAQLController(BaseJAAQLController):
|
|
|
20
20
|
|
|
21
21
|
@self.publish_route('/oauth/token', DOCUMENTATION__oauth_token)
|
|
22
22
|
def fetch_oauth_token(http_inputs: dict, ip_address: str, response: JAAQLResponse):
|
|
23
|
-
return self.model.get_auth_token(**http_inputs, ip_address=ip_address, response=response)
|
|
23
|
+
return self.model.get_auth_token(**http_inputs, ip_address=ip_address, response=response, is_refresh=False)
|
|
24
24
|
|
|
25
25
|
@self.publish_route('/oauth/cookie', DOCUMENTATION__oauth_cookie)
|
|
26
26
|
def fetch_oauth_cookie(http_inputs: dict, ip_address: str, response: JAAQLResponse):
|
|
27
|
-
self.model.get_auth_token(**http_inputs, ip_address=ip_address, response=response, cookie=True)
|
|
27
|
+
self.model.get_auth_token(**http_inputs, ip_address=ip_address, response=response, cookie=True, is_refresh=False)
|
|
28
28
|
|
|
29
29
|
@self.publish_route('/logout-cookie', DOCUMENTATION__logout_cookie)
|
|
30
30
|
def fetch_oauth_cookie(response: JAAQLResponse):
|
{jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/mvc/exception_queries.py
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"""
|
|
2
|
-
This script was generated from jaaql.exceptions.fxli at 2025-02-06,
|
|
2
|
+
This script was generated from jaaql.exceptions.fxli at 2025-02-06, 11:10:33
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
5
|
from jaaql.utilities.crypt_utils import get_repeatable_salt
|
|
@@ -72,7 +72,7 @@ QUERY__fetch_providers_from_tenant_and_database = """
|
|
|
72
72
|
UR.discovery_url,
|
|
73
73
|
DUR.federation_procedure,
|
|
74
74
|
DUR.client_id,
|
|
75
|
-
DUR.client_secret
|
|
75
|
+
DUR.client_secret
|
|
76
76
|
FROM identity_provider_service IPS
|
|
77
77
|
INNER JOIN user_registry UR ON
|
|
78
78
|
IPS.name = UR.provider
|
|
@@ -460,19 +460,21 @@ WHERE
|
|
|
460
460
|
def fetch_user_registries_for_tenant(self, inputs: dict):
|
|
461
461
|
schema = inputs.get(KEY__schema, None)
|
|
462
462
|
if not schema:
|
|
463
|
-
schema = application__select(self.jaaql_lookup_connection, inputs[KEY__application])[
|
|
463
|
+
schema = application__select(self.jaaql_lookup_connection, inputs[KEY__application])[KG__application__default_schema]
|
|
464
464
|
|
|
465
465
|
database = application_schema__select(self.jaaql_lookup_connection, inputs[KEY__application], schema)
|
|
466
466
|
providers = fetch_providers_from_tenant_and_database(self.jaaql_lookup_connection, inputs[KG__user_registry__tenant],
|
|
467
467
|
database[KG__application_schema__database])
|
|
468
468
|
|
|
469
|
-
return
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
469
|
+
return {
|
|
470
|
+
"providers": [
|
|
471
|
+
{
|
|
472
|
+
KG__user_registry__provider: provider[KG__identity_provider_service__name],
|
|
473
|
+
KG__identity_provider_service__logo_url: provider[KG__identity_provider_service__logo_url]
|
|
474
|
+
}
|
|
475
|
+
for provider in providers
|
|
476
|
+
]
|
|
477
|
+
}
|
|
476
478
|
|
|
477
479
|
def fetch_discovery_content(self, database: str, provider: str, tenant: str, discovery_url: str = None):
|
|
478
480
|
lookup = database + ":" + provider + ":" + tenant
|
|
@@ -486,7 +488,7 @@ WHERE
|
|
|
486
488
|
return discovery
|
|
487
489
|
|
|
488
490
|
def fetch_jwks_client(self, database: str, provider: str, tenant: str, discovery):
|
|
489
|
-
jwks_url = discovery.get("jwks_uri")
|
|
491
|
+
jwks_url = discovery.get("jwks_uri").replace("localhost", "host.docker.internal")
|
|
490
492
|
if not jwks_url:
|
|
491
493
|
raise Exception(f"Discovery document for {provider}, {tenant} did not have JWKS url")
|
|
492
494
|
lookup = database + ":" + provider + ":" + tenant
|
|
@@ -547,9 +549,14 @@ WHERE
|
|
|
547
549
|
token_request_payload["client_secret"] = database_user_registry[KG__database_user_registry__client_secret]
|
|
548
550
|
|
|
549
551
|
token_response = requests.post(
|
|
550
|
-
token_endpoint,
|
|
552
|
+
token_endpoint.replace("localhost", "host.docker.internal"),
|
|
551
553
|
data=token_request_payload,
|
|
552
554
|
)
|
|
555
|
+
|
|
556
|
+
if os.environ.get("JAAQL_DEBUGGING") == "TRUE":
|
|
557
|
+
print(token_response.status_code)
|
|
558
|
+
print(token_response.text)
|
|
559
|
+
|
|
553
560
|
token_data = token_response.json()
|
|
554
561
|
id_token = token_data.get('id_token')
|
|
555
562
|
|
|
@@ -581,27 +588,29 @@ WHERE
|
|
|
581
588
|
|
|
582
589
|
except HttpSingletonStatusException:
|
|
583
590
|
# User does not exist, federate it
|
|
591
|
+
print("federating user")
|
|
584
592
|
email = id_payload.get('email')
|
|
585
593
|
email_verified = id_payload.get('email_verified')
|
|
586
|
-
|
|
587
594
|
account_id = self.create_account_with_potential_api_key(self.jaaql_lookup_connection,
|
|
588
595
|
sub, provider, tenant,
|
|
589
|
-
email, registered=email_verified)
|
|
596
|
+
None, email, registered=email_verified)
|
|
597
|
+
print("new federated user with account id " + account_id)
|
|
590
598
|
account = account__select(self.jaaql_lookup_connection, self.get_db_crypt_key(), account_id)
|
|
591
|
-
db_params = {"tenant": tenant, "application": application, "account_id": account_id
|
|
599
|
+
db_params = {"tenant": tenant, "application": application, "account_id": account_id, "provider": provider,
|
|
600
|
+
"email": email}
|
|
592
601
|
parameters = fetch_parameters_for_federation_procedure(self.jaaql_lookup_connection,
|
|
593
602
|
database_user_registry[KG__database_user_registry__federation_procedure])
|
|
594
603
|
for claim in parameters:
|
|
595
604
|
claim_name = claim[KG__federation_procedure_parameter__name]
|
|
596
|
-
db_params[claim_name] =
|
|
605
|
+
db_params[claim_name] = id_payload.get(claim_name)
|
|
597
606
|
|
|
598
607
|
procedure_name = database_user_registry[KG__database_user_registry__federation_procedure]
|
|
599
|
-
if re.match(
|
|
608
|
+
if re.match(REGEX__dmbs_procedure_name, procedure_name) is None:
|
|
600
609
|
raise HttpStatusException("Unsafe data federation procedure")
|
|
601
610
|
|
|
602
611
|
procedure_params = []
|
|
603
612
|
for key, _ in db_params.items():
|
|
604
|
-
if re.match(REGEX__dmbs_object_name,
|
|
613
|
+
if re.match(REGEX__dmbs_object_name, key) is None:
|
|
605
614
|
raise HttpStatusException("Unsafe data federation parameter " + key)
|
|
606
615
|
procedure_params.append(f"{key} => :{key}")
|
|
607
616
|
|
|
@@ -612,10 +621,15 @@ WHERE
|
|
|
612
621
|
KEY__parameters: db_params
|
|
613
622
|
}
|
|
614
623
|
|
|
624
|
+
print("Preparing federating procedure")
|
|
625
|
+
|
|
615
626
|
submit(self.vault, self.config, self.get_db_crypt_key(),
|
|
616
627
|
self.jaaql_lookup_connection, submit_data, ROLE__jaaql,
|
|
617
628
|
None, self.cached_canned_query_service, as_objects=True, singleton=True)
|
|
618
629
|
|
|
630
|
+
print("Federated user")
|
|
631
|
+
print(submit_data)
|
|
632
|
+
|
|
619
633
|
salt_user = self.get_repeatable_salt(account[KG__account__id])
|
|
620
634
|
encrypted_salted_ip_address = jaaql__encrypt(ip_address, self.get_db_crypt_key(), salt_user) # An optimisation, it is used later twice
|
|
621
635
|
address = execute_supplied_statement_singleton(self.jaaql_lookup_connection,
|
|
@@ -627,7 +641,7 @@ WHERE
|
|
|
627
641
|
jwt_data = {
|
|
628
642
|
KEY__account_id: str(account[KG__account__id]),
|
|
629
643
|
KEY__username: sub,
|
|
630
|
-
KEY__password:
|
|
644
|
+
KEY__password: None,
|
|
631
645
|
KEY__ip_address: ip_address,
|
|
632
646
|
KEY__ip_id: str(address),
|
|
633
647
|
KEY__created: datetime.now().isoformat(),
|
|
@@ -649,7 +663,7 @@ WHERE
|
|
|
649
663
|
schema = inputs.get(KEY__schema, None)
|
|
650
664
|
application = application__select(self.jaaql_lookup_connection, inputs[KEY__application])
|
|
651
665
|
if not schema:
|
|
652
|
-
schema = application[
|
|
666
|
+
schema = application[KG__application__default_schema]
|
|
653
667
|
|
|
654
668
|
database = application_schema__select(self.jaaql_lookup_connection, inputs[KEY__application], schema)
|
|
655
669
|
user_registry = user_registry__select(self.jaaql_lookup_connection, inputs[KG__user_registry__provider], inputs[KG__user_registry__tenant])
|
|
@@ -665,14 +679,14 @@ WHERE
|
|
|
665
679
|
|
|
666
680
|
parameters = fetch_parameters_for_federation_procedure(self.jaaql_lookup_connection,
|
|
667
681
|
database_user_registry[KG__database_user_registry__federation_procedure])
|
|
668
|
-
scope_list =
|
|
682
|
+
scope_list = [parameter[KG__federation_procedure_parameter__name] for parameter in parameters]
|
|
669
683
|
client_id = urllib.parse.quote(database_user_registry[KG__database_user_registry__client_id])
|
|
670
684
|
|
|
671
685
|
nonce = secrets.token_urlsafe(32)
|
|
672
686
|
state = secrets.token_urlsafe(32)
|
|
673
687
|
code_verifier = secrets.token_urlsafe(64)
|
|
674
688
|
code_challenge = self.generate_code_challenge(code_verifier)
|
|
675
|
-
redirect_uri = application[KG__application__base_url + "/" + inputs[KEY__redirect_uri]
|
|
689
|
+
redirect_uri = application[KG__application__base_url] + "/" + inputs[KEY__redirect_uri]
|
|
676
690
|
|
|
677
691
|
oidc_session = crypt_utils.jwt_encode(self.vault.get_obj(VAULT_KEY__jwt_crypt_key), {
|
|
678
692
|
"redirect_uri": redirect_uri,
|
|
@@ -695,8 +709,9 @@ WHERE
|
|
|
695
709
|
if scope not in default_scopes:
|
|
696
710
|
default_scopes.append(scope)
|
|
697
711
|
|
|
698
|
-
redirect = auth_endpoint + f"?client_id={client_id}&response_type=code&code_challenge_method=S256&
|
|
699
|
-
|
|
712
|
+
redirect = auth_endpoint + f"?client_id={client_id}&response_type=code&code_challenge_method=S256&scope={
|
|
713
|
+
urllib.parse.quote(" ".join(["openid"]))}&nonce={nonce}&state={
|
|
714
|
+
state}&code_challenge={code_challenge}&redirect_uri={urllib.parse.quote(redirect_uri, safe='')}"
|
|
700
715
|
|
|
701
716
|
response.response_code = HTTPStatus.FOUND
|
|
702
717
|
response.raw_headers["Location"] = redirect
|
|
@@ -914,7 +929,7 @@ WHERE
|
|
|
914
929
|
try:
|
|
915
930
|
account = fetch_account_from_id(self.jaaql_lookup_connection, decoded[KEY__account_id], singleton_code=HTTPStatus.UNAUTHORIZED,
|
|
916
931
|
singleton_message=ERR__invalid_token)
|
|
917
|
-
if account[KG__account__api_key] != decoded[KEY__password]:
|
|
932
|
+
if decoded[KEY__password] is not None and account[KG__account__api_key] != decoded[KEY__password]:
|
|
918
933
|
raise HttpSingletonStatusException(ERR__invalid_token, HTTPStatus.UNAUTHORIZED)
|
|
919
934
|
except HttpSingletonStatusException:
|
|
920
935
|
raise UserUnauthorized()
|
|
@@ -933,7 +948,7 @@ WHERE
|
|
|
933
948
|
if datetime.fromisoformat(decoded[KEY__created]) + timedelta(milliseconds=self.refresh_expiry_ms) < datetime.now():
|
|
934
949
|
raise UserUnauthorized()
|
|
935
950
|
|
|
936
|
-
return self.get_auth_token(decoded[KEY__username], ip_address, cookie=cookie, remember_me=remember_me, response=response)
|
|
951
|
+
return self.get_auth_token(decoded[KEY__username], ip_address, cookie=cookie, remember_me=remember_me, response=response, is_refresh=True)
|
|
937
952
|
|
|
938
953
|
def get_bypass_user(self, username: str, ip_address: str, provider: str = None, tenant: str = None):
|
|
939
954
|
account = fetch_account_from_username(self.jaaql_lookup_connection, username, singleton_code=HTTPStatus.UNAUTHORIZED)
|
|
@@ -954,6 +969,7 @@ WHERE
|
|
|
954
969
|
self,
|
|
955
970
|
username: str, ip_address: str, password: str = None,
|
|
956
971
|
response: JAAQLResponse = None, remember_me: bool = False, cookie: bool = False,
|
|
972
|
+
is_refresh=False,
|
|
957
973
|
):
|
|
958
974
|
incorrect_credentials = False
|
|
959
975
|
account = None
|
|
@@ -975,10 +991,12 @@ WHERE
|
|
|
975
991
|
|
|
976
992
|
encrypted_salted_ip_address = jaaql__encrypt(ip_address, self.get_db_crypt_key(), salt_user) # An optimisation, it is used later twice
|
|
977
993
|
|
|
978
|
-
if
|
|
994
|
+
if is_refresh:
|
|
995
|
+
incorrect_credentials = not exists_matching_validated_ip_address(self.jaaql_lookup_connection, encrypted_salted_ip_address)
|
|
996
|
+
elif password is not None:
|
|
979
997
|
incorrect_credentials = jaaql__decrypt(account[KG__account__api_key], self.get_db_crypt_key()) != password
|
|
980
998
|
else:
|
|
981
|
-
incorrect_credentials =
|
|
999
|
+
incorrect_credentials = True
|
|
982
1000
|
|
|
983
1001
|
if incorrect_credentials:
|
|
984
1002
|
raise UserUnauthorized()
|
|
@@ -4,7 +4,7 @@ CREATE DOMAIN encrypted__email_server_password AS character varying(256);
|
|
|
4
4
|
CREATE DOMAIN encrypted__access_token AS character varying(64);
|
|
5
5
|
CREATE DOMAIN encrypted__oidc_client_id AS character varying(200);
|
|
6
6
|
CREATE DOMAIN encrypted__oidc_client_secret AS character varying(200);
|
|
7
|
-
CREATE DOMAIN encrypted__oidc_sub AS character varying(
|
|
7
|
+
CREATE DOMAIN encrypted__oidc_sub AS character varying(200);
|
|
8
8
|
CREATE DOMAIN encrypted__email AS character varying(255);
|
|
9
9
|
CREATE DOMAIN encrypted__salted_ip AS character varying(256);
|
|
10
10
|
CREATE DOMAIN encrypted__jaaql_username AS character varying(128);
|
|
@@ -9,8 +9,8 @@ DECLARE
|
|
|
9
9
|
account_id postgres_role;
|
|
10
10
|
BEGIN
|
|
11
11
|
if create_account.provider is not null then
|
|
12
|
-
SELECT requires_email_verification INTO requires_email_verification
|
|
13
|
-
FROM identity_provider_service
|
|
12
|
+
SELECT X.requires_email_verification INTO requires_email_verification
|
|
13
|
+
FROM identity_provider_service X
|
|
14
14
|
WHERE name = create_account.provider;
|
|
15
15
|
end if;
|
|
16
16
|
|
|
@@ -76,5 +76,7 @@ BEGIN
|
|
|
76
76
|
IF lacks_registered THEN
|
|
77
77
|
EXECUTE 'GRANT registered TO ' || quote_ident(mark_account_registered.id);
|
|
78
78
|
END IF;
|
|
79
|
+
|
|
80
|
+
UPDATE account A SET email_verified = true WHERE A.id = mark_account_registered.id;
|
|
79
81
|
END
|
|
80
82
|
$$ language plpgsql SECURITY DEFINER;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: jaaql-middleware-python
|
|
3
|
-
Version: 4.26.
|
|
3
|
+
Version: 4.26.2
|
|
4
4
|
Summary: The jaaql package, allowing for rapid development and deployment of RESTful HTTP applications
|
|
5
5
|
Home-page: https://github.com/JAAQL/JAAQL-middleware-python
|
|
6
6
|
Author: Software Quality Measurement and Improvement bv
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/config/config-docker.ini
RENAMED
|
File without changes
|
{jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/config/config-test.ini
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/db/db_pg_interface.py
RENAMED
|
File without changes
|
|
File without changes
|
{jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/db/db_utils_no_circ.py
RENAMED
|
File without changes
|
{jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/documentation/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/email/email_manager.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/exceptions/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/generated_constants.py
RENAMED
|
File without changes
|
{jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/interpreter/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/migrations/__init__.py
RENAMED
|
File without changes
|
{jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/migrations/migrations.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/mvc/controller_interface.py
RENAMED
|
File without changes
|
{jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/mvc/handmade_queries.py
RENAMED
|
File without changes
|
{jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/mvc/model_interface.py
RENAMED
|
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
|
{jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/services/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/services/patch_mms.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/utilities/__init__.py
RENAMED
|
File without changes
|
{jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/utilities/crypt_utils.py
RENAMED
|
File without changes
|
{jaaql-middleware-python-4.26.0 → jaaql-middleware-python-4.26.2}/jaaql/utilities/options.py
RENAMED
|
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
|