snakeboot 0.5.0__tar.gz → 0.5.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.
- {snakeboot-0.5.0 → snakeboot-0.5.2}/PKG-INFO +1 -1
- {snakeboot-0.5.0 → snakeboot-0.5.2}/pyproject.toml +1 -1
- {snakeboot-0.5.0 → snakeboot-0.5.2}/pyproject.toml.orig +1 -1
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/oauth2/jwt_bearer_authentication.py +3 -2
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/rest/bearer_authentication.py +4 -2
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/rest/controller_endpoint_factory.py +10 -2
- {snakeboot-0.5.0 → snakeboot-0.5.2}/LICENSE +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/README.md +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/__init__.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/component_scan/__init__.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/component_scan/application_root.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/component_scan/component_scan.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/configuration/__init__.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/configuration/cache_properties.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/configuration/configuration.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/configuration/configuration_errors.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/configuration/configuration_properties.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/configuration/configuration_sources.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/configuration/database_properties.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/configuration/django_properties.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/configuration/load_configuration.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/configuration/oauth2_properties.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/configuration/properties_rules.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/configuration/section.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/configuration/section_prefix.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/django/__init__.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/django/django_atomic_transaction_manager.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/django_application/__init__.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/django_application/apps.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/django_application/container_sections.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/django_application/django_configurer.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/django_application/django_settings.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/django_application/entry_points.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/django_application/installed_apps.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/django_application/settings.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/django_application/transaction_manager.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/events/__init__.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/events/application_event_listener.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/events/application_event_publisher.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/events/application_event_publisher_injectable.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/events/event_listener_markers.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/oauth2/__init__.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/openapi/__init__.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/openapi/openapi_definition.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/py.typed +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/rest/__init__.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/rest/authenticated_principal.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/rest/controller_scan.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/rest/error_answer.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/rest/rest_api.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/rest/rest_controller.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/rest/rest_controller_advice.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/rest/rest_controller_errors.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/rest/rest_controller_mappings.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/rest/route_markers.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/rest/urls.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/testing/__init__.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/testing/declared_classes.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/testing/recording_transaction_manager.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/transaction/__init__.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/transaction/after_commit.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/transaction/transaction_manager.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/transaction/transaction_manager_not_installed_error.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/transaction/transaction_manager_registry.py +0 -0
- {snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/transaction/transactional.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: snakeboot
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.2
|
|
4
4
|
Summary: Spring Boot ergonomics for hexagonal Python: @transactional, application events, a component scan, typed configuration with profiles and singleton REST controllers on Django Ninja, wired by wireup.
|
|
5
5
|
Keywords: spring-boot,hexagonal-architecture,ddd,django,django-ninja,wireup,dependency-injection,transactional
|
|
6
6
|
Author: Wouter Deketelaere
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "snakeboot"
|
|
3
|
-
version = "0.5.
|
|
3
|
+
version = "0.5.2"
|
|
4
4
|
description = "Spring Boot ergonomics for hexagonal Python: @transactional, application events, a component scan, typed configuration with profiles and singleton REST controllers on Django Ninja, wired by wireup."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "MIT"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "snakeboot"
|
|
3
|
-
version = "0.5.
|
|
3
|
+
version = "0.5.2"
|
|
4
4
|
description = "Spring Boot ergonomics for hexagonal Python: @transactional, application events, a component scan, typed configuration with profiles and singleton REST controllers on Django Ninja, wired by wireup."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "MIT"
|
|
@@ -15,14 +15,15 @@ KEY_LIFESPAN_SECONDS: Final = 300
|
|
|
15
15
|
"""How long the issuer's public keys are kept before they are fetched again (a key rotation takes at most this)."""
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
class JwtBearerAuthentication(BearerAuthentication):
|
|
18
|
+
class JwtBearerAuthentication(BearerAuthentication, component=False):
|
|
19
19
|
"""Accepts the signed JWT access tokens of one authorization server, like Spring's oauth2 resource server.
|
|
20
20
|
|
|
21
21
|
A token is valid when the issuer's public key (fetched from `jwks_uri` and cached) verifies its signature, its
|
|
22
22
|
`iss` is `issuer_uri`, its `aud` holds `audience` and it has not expired. The principal is its `sub`. Every other
|
|
23
23
|
token, and every token while the keys cannot be fetched, is answered with 401.
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
It is not a component itself: an application turns it on with one subclass in its component scan and the table
|
|
26
|
+
`[oauth2]` in application.toml:
|
|
26
27
|
|
|
27
28
|
class PlayerTokens(JwtBearerAuthentication):
|
|
28
29
|
\"\"\"The access tokens that Keycloak gives the platform's players.\"\"\"
|
|
@@ -21,9 +21,11 @@ class BearerAuthentication(ABC):
|
|
|
21
21
|
"""
|
|
22
22
|
|
|
23
23
|
@override
|
|
24
|
-
def __init_subclass__(cls, **kwargs: Any) -> None:
|
|
24
|
+
def __init_subclass__(cls, *, component: bool = True, **kwargs: Any) -> None:
|
|
25
|
+
"""Registers a concrete subclass; `component=False` marks a base meant to be extended, such as
|
|
26
|
+
JwtBearerAuthentication, so a module that imports it to extend it does not hold two components."""
|
|
25
27
|
super().__init_subclass__(**kwargs)
|
|
26
|
-
if not getattr(cls.authenticate, "__isabstractmethod__", False):
|
|
28
|
+
if component and not getattr(cls.authenticate, "__isabstractmethod__", False):
|
|
27
29
|
injectable(cls, as_type=BearerAuthentication)
|
|
28
30
|
|
|
29
31
|
@abstractmethod
|
|
@@ -5,6 +5,7 @@ from typing import Any
|
|
|
5
5
|
|
|
6
6
|
from django.http import HttpRequest, HttpResponse
|
|
7
7
|
from ninja import NinjaAPI
|
|
8
|
+
from wireup import ScopedSyncContainer
|
|
8
9
|
from wireup.integration.django import get_request_container
|
|
9
10
|
|
|
10
11
|
from snakeboot.rest.rest_controller_errors import InvalidRestControllerError
|
|
@@ -14,8 +15,15 @@ ErrorAnswer = Callable[[HttpRequest, Exception], HttpResponse]
|
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
def resolve_from_wireup_request_scope(controller_class: type) -> object:
|
|
17
|
-
"""Asks wireup for the controller during the current request; a singleton is the same object every time.
|
|
18
|
-
|
|
18
|
+
"""Asks wireup for the controller during the current request; a singleton is the same object every time.
|
|
19
|
+
|
|
20
|
+
Under WSGI the request scope is synchronous. Under ASGI it is asynchronous, and its `get` returns a coroutine; a
|
|
21
|
+
controller endpoint is synchronous, so it resolves synchronously, as wireup's own class-based views do.
|
|
22
|
+
"""
|
|
23
|
+
scope = get_request_container()
|
|
24
|
+
if isinstance(scope, ScopedSyncContainer):
|
|
25
|
+
return scope.get(controller_class)
|
|
26
|
+
return scope._synchronous_get(controller_class) # reason: wireup resolves its sync views so under ASGI
|
|
19
27
|
|
|
20
28
|
|
|
21
29
|
class ControllerEndpointFactory:
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/django/django_atomic_transaction_manager.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
|
|
File without changes
|
{snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/events/application_event_publisher_injectable.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
|
|
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
|
{snakeboot-0.5.0 → snakeboot-0.5.2}/src/snakeboot/transaction/transaction_manager_registry.py
RENAMED
|
File without changes
|
|
File without changes
|