spakky-fastapi 0.13.0__tar.gz → 0.16.0__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.
Files changed (17) hide show
  1. {spakky_fastapi-0.13.0 → spakky_fastapi-0.16.0}/PKG-INFO +2 -2
  2. {spakky_fastapi-0.13.0 → spakky_fastapi-0.16.0}/pyproject.toml +2 -2
  3. spakky_fastapi-0.13.0/spakky_fastapi/aspects/jwt_auth.py → spakky_fastapi-0.16.0/spakky_fastapi/extensions/auth.py +7 -7
  4. spakky_fastapi-0.16.0/spakky_fastapi/plugins/jwt_auth.py +13 -0
  5. spakky_fastapi-0.13.0/spakky_fastapi/plugins/jwt_auth.py +0 -10
  6. {spakky_fastapi-0.13.0 → spakky_fastapi-0.16.0}/README.md +0 -0
  7. {spakky_fastapi-0.13.0 → spakky_fastapi-0.16.0}/spakky_fastapi/__init__.py +0 -0
  8. {spakky_fastapi-0.13.0 → spakky_fastapi-0.16.0}/spakky_fastapi/error.py +0 -0
  9. {spakky_fastapi-0.13.0/spakky_fastapi/aspects → spakky_fastapi-0.16.0/spakky_fastapi/extensions}/__init__.py +0 -0
  10. {spakky_fastapi-0.13.0 → spakky_fastapi-0.16.0}/spakky_fastapi/middlewares/__init__.py +0 -0
  11. {spakky_fastapi-0.13.0 → spakky_fastapi-0.16.0}/spakky_fastapi/middlewares/error_handling.py +0 -0
  12. {spakky_fastapi-0.13.0 → spakky_fastapi-0.16.0}/spakky_fastapi/plugins/__init__.py +0 -0
  13. {spakky_fastapi-0.13.0 → spakky_fastapi-0.16.0}/spakky_fastapi/plugins/fast_api.py +0 -0
  14. {spakky_fastapi-0.13.0 → spakky_fastapi-0.16.0}/spakky_fastapi/post_processor.py +0 -0
  15. {spakky_fastapi-0.13.0 → spakky_fastapi-0.16.0}/spakky_fastapi/py.typed +0 -0
  16. {spakky_fastapi-0.13.0 → spakky_fastapi-0.16.0}/spakky_fastapi/stereotypes/__init__.py +0 -0
  17. {spakky_fastapi-0.13.0 → spakky_fastapi-0.16.0}/spakky_fastapi/stereotypes/api_controller.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: spakky-fastapi
3
- Version: 0.13.0
3
+ Version: 0.16.0
4
4
  Summary: Highly abstracted Framework core to use DDD & DI/IoC & AOP & Etc...
5
5
  Author: Spakky
6
6
  Author-email: sejong418@icloud.com
@@ -11,7 +11,7 @@ Classifier: Programming Language :: Python :: 3.11
11
11
  Classifier: Programming Language :: Python :: 3.12
12
12
  Requires-Dist: fastapi (>=0.109.2,<0.110.0)
13
13
  Requires-Dist: orjson (>=3.9.15,<4.0.0)
14
- Requires-Dist: spakky-core (>=0.14,<0.15)
14
+ Requires-Dist: spakky-core (>=0.15,<0.16)
15
15
  Requires-Dist: websockets (>=12.0,<13.0)
16
16
  Description-Content-Type: text/markdown
17
17
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "spakky-fastapi"
3
- version = "0.13.0"
3
+ version = "0.16.0"
4
4
  description = "Highly abstracted Framework core to use DDD & DI/IoC & AOP & Etc..."
5
5
  authors = ["Spakky <sejong418@icloud.com>"]
6
6
  readme = "README.md"
@@ -12,7 +12,7 @@ build-backend = "poetry.core.masonry.api"
12
12
  [tool.poetry.dependencies]
13
13
  python = ">=3.10"
14
14
  fastapi = "^0.109.2"
15
- spakky-core = "^0.14"
15
+ spakky-core = "^0.15"
16
16
  websockets = "^12.0"
17
17
  orjson = "^3.9.15"
18
18
 
@@ -32,7 +32,7 @@ IAuthenticatedFunction: TypeAlias = (
32
32
 
33
33
 
34
34
  @dataclass
35
- class JWTAuth(FunctionAnnotation):
35
+ class Auth(FunctionAnnotation):
36
36
  token_url: InitVar[str]
37
37
  authenticator: OAuth2PasswordBearer = field(init=False)
38
38
  token_keywords: list[str] = field(init=False, default_factory=list)
@@ -52,7 +52,7 @@ class JWTAuth(FunctionAnnotation):
52
52
 
53
53
  @Order(1)
54
54
  @Aspect()
55
- class JWTAuthAdvisor(IAdvisor):
55
+ class AuthenticationAdvisor(IAdvisor):
56
56
  __logger: Logger
57
57
  __key: Key
58
58
 
@@ -61,9 +61,9 @@ class JWTAuthAdvisor(IAdvisor):
61
61
  self.__logger = logger
62
62
  self.__key = key
63
63
 
64
- @Around(lambda x: JWTAuth.contains(x) and not iscoroutinefunction(x))
64
+ @Around(lambda x: Auth.contains(x) and not iscoroutinefunction(x))
65
65
  def around(self, joinpoint: Func, *args: Any, **kwargs: Any) -> Any:
66
- annotation: JWTAuth = JWTAuth.single(joinpoint)
66
+ annotation: Auth = Auth.single(joinpoint)
67
67
  for keyword in annotation.token_keywords:
68
68
  token: str = kwargs[keyword]
69
69
  try:
@@ -81,7 +81,7 @@ class JWTAuthAdvisor(IAdvisor):
81
81
 
82
82
  @Order(1)
83
83
  @AsyncAspect()
84
- class AsyncJWTAuthAdvisor(IAsyncAdvisor):
84
+ class AsyncAuthenticationAdvisor(IAsyncAdvisor):
85
85
  __logger: Logger
86
86
  __key: Key
87
87
 
@@ -90,9 +90,9 @@ class AsyncJWTAuthAdvisor(IAsyncAdvisor):
90
90
  self.__logger = logger
91
91
  self.__key = key
92
92
 
93
- @Around(lambda x: JWTAuth.contains(x) and iscoroutinefunction(x))
93
+ @Around(lambda x: Auth.contains(x) and iscoroutinefunction(x))
94
94
  async def around_async(self, joinpoint: AsyncFunc, *args: Any, **kwargs: Any) -> Any:
95
- annotation: JWTAuth = JWTAuth.single(joinpoint)
95
+ annotation: Auth = Auth.single(joinpoint)
96
96
  for keyword in annotation.token_keywords:
97
97
  token: str = kwargs[keyword]
98
98
  try:
@@ -0,0 +1,13 @@
1
+ from spakky.application.interfaces.pluggable import IPluggable
2
+ from spakky.application.interfaces.registry import IRegistry
3
+
4
+ from spakky_fastapi.extensions.auth import (
5
+ AsyncAuthenticationAdvisor,
6
+ AuthenticationAdvisor,
7
+ )
8
+
9
+
10
+ class JWTAuthPlugin(IPluggable):
11
+ def register(self, registry: IRegistry) -> None:
12
+ registry.register_bean(AuthenticationAdvisor)
13
+ registry.register_bean(AsyncAuthenticationAdvisor)
@@ -1,10 +0,0 @@
1
- from spakky.application.interfaces.pluggable import IPluggable
2
- from spakky.application.interfaces.registry import IRegistry
3
-
4
- from spakky_fastapi.aspects.jwt_auth import AsyncJWTAuthAdvisor, JWTAuthAdvisor
5
-
6
-
7
- class JWTAuthPlugin(IPluggable):
8
- def register(self, registry: IRegistry) -> None:
9
- registry.register_bean(JWTAuthAdvisor)
10
- registry.register_bean(AsyncJWTAuthAdvisor)