sharedkernel 2.2.3__tar.gz → 2.2.5__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.
- {sharedkernel-2.2.3 → sharedkernel-2.2.5}/PKG-INFO +5 -1
- {sharedkernel-2.2.3 → sharedkernel-2.2.5}/README.md +4 -0
- {sharedkernel-2.2.3 → sharedkernel-2.2.5}/setup.py +1 -1
- sharedkernel-2.2.5/sharedkernel/database/pagination_response_dto.py +15 -0
- {sharedkernel-2.2.3 → sharedkernel-2.2.5}/sharedkernel/jwt_service.py +17 -19
- {sharedkernel-2.2.3 → sharedkernel-2.2.5}/sharedkernel/objects/user_info.py +2 -3
- {sharedkernel-2.2.3 → sharedkernel-2.2.5}/sharedkernel.egg-info/PKG-INFO +5 -1
- sharedkernel-2.2.3/sharedkernel/database/pagination_response_dto.py +0 -16
- {sharedkernel-2.2.3 → sharedkernel-2.2.5}/setup.cfg +0 -0
- {sharedkernel-2.2.3 → sharedkernel-2.2.5}/sharedkernel/common.py +0 -0
- {sharedkernel-2.2.3 → sharedkernel-2.2.5}/sharedkernel/data_format_converter.py +0 -0
- {sharedkernel-2.2.3 → sharedkernel-2.2.5}/sharedkernel/database/__init__.py +0 -0
- {sharedkernel-2.2.3 → sharedkernel-2.2.5}/sharedkernel/database/audit_model.py +0 -0
- {sharedkernel-2.2.3 → sharedkernel-2.2.5}/sharedkernel/database/mongo_generic_audit_repository.py +0 -0
- {sharedkernel-2.2.3 → sharedkernel-2.2.5}/sharedkernel/database/mongo_generic_repository.py +0 -0
- {sharedkernel-2.2.3 → sharedkernel-2.2.5}/sharedkernel/date_converter.py +0 -0
- {sharedkernel-2.2.3 → sharedkernel-2.2.5}/sharedkernel/diff_utils.py +0 -0
- {sharedkernel-2.2.3 → sharedkernel-2.2.5}/sharedkernel/enum/__init__.py +0 -0
- {sharedkernel-2.2.3 → sharedkernel-2.2.5}/sharedkernel/enum/error_code.py +0 -0
- {sharedkernel-2.2.3 → sharedkernel-2.2.5}/sharedkernel/enum/sort_order.py +0 -0
- {sharedkernel-2.2.3 → sharedkernel-2.2.5}/sharedkernel/exception/__init__.py +0 -0
- {sharedkernel-2.2.3 → sharedkernel-2.2.5}/sharedkernel/exception/exception.py +0 -0
- {sharedkernel-2.2.3 → sharedkernel-2.2.5}/sharedkernel/exception/exception_handlers.py +0 -0
- {sharedkernel-2.2.3 → sharedkernel-2.2.5}/sharedkernel/normalizer/__init__.py +0 -0
- {sharedkernel-2.2.3 → sharedkernel-2.2.5}/sharedkernel/normalizer/number_normalizer.py +0 -0
- {sharedkernel-2.2.3 → sharedkernel-2.2.5}/sharedkernel/normalizer/phone_number_normalizer.py +0 -0
- {sharedkernel-2.2.3 → sharedkernel-2.2.5}/sharedkernel/normalizer/string_normalizer.py +0 -0
- {sharedkernel-2.2.3 → sharedkernel-2.2.5}/sharedkernel/objects/__init__.py +0 -0
- {sharedkernel-2.2.3 → sharedkernel-2.2.5}/sharedkernel/objects/base_document.py +0 -0
- {sharedkernel-2.2.3 → sharedkernel-2.2.5}/sharedkernel/objects/json_string_model.py +0 -0
- {sharedkernel-2.2.3 → sharedkernel-2.2.5}/sharedkernel/objects/jwt_model.py +0 -0
- {sharedkernel-2.2.3 → sharedkernel-2.2.5}/sharedkernel/objects/result.py +0 -0
- {sharedkernel-2.2.3 → sharedkernel-2.2.5}/sharedkernel/regex_masking.py +0 -0
- {sharedkernel-2.2.3 → sharedkernel-2.2.5}/sharedkernel/s3_uploader.py +0 -0
- {sharedkernel-2.2.3 → sharedkernel-2.2.5}/sharedkernel/string_extentions.py +0 -0
- {sharedkernel-2.2.3 → sharedkernel-2.2.5}/sharedkernel.egg-info/SOURCES.txt +0 -0
- {sharedkernel-2.2.3 → sharedkernel-2.2.5}/sharedkernel.egg-info/dependency_links.txt +0 -0
- {sharedkernel-2.2.3 → sharedkernel-2.2.5}/sharedkernel.egg-info/requires.txt +0 -0
- {sharedkernel-2.2.3 → sharedkernel-2.2.5}/sharedkernel.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sharedkernel
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.5
|
|
4
4
|
Summary: sharekernel is a shared package between all python projects
|
|
5
5
|
Author: Smilinno
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -29,6 +29,10 @@ Dynamic: summary
|
|
|
29
29
|
this is a shared kernel package
|
|
30
30
|
|
|
31
31
|
# Change Log
|
|
32
|
+
### Version 2.2.5
|
|
33
|
+
- add org_token to user_info Object
|
|
34
|
+
### Version 2.2.4
|
|
35
|
+
- make pagination response default values to None
|
|
32
36
|
### Version 2.2.3
|
|
33
37
|
- add paginate to mongo repository
|
|
34
38
|
### Version 2.2.2
|
|
@@ -37,7 +37,7 @@ setup(
|
|
|
37
37
|
"deepdiff",
|
|
38
38
|
],
|
|
39
39
|
# *strongly* suggested for sharing
|
|
40
|
-
version="2.2.
|
|
40
|
+
version="2.2.5",
|
|
41
41
|
description="sharekernel is a shared package between all python projects",
|
|
42
42
|
long_description=long_description,
|
|
43
43
|
long_description_content_type="text/markdown",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from typing import List, TypeVar, Generic
|
|
2
|
+
|
|
3
|
+
from pydantic import BaseModel
|
|
4
|
+
|
|
5
|
+
T = TypeVar("T", bound=BaseModel)
|
|
6
|
+
|
|
7
|
+
class PaginationResponseDto(BaseModel, Generic[T]):
|
|
8
|
+
data: List[T] | None = []
|
|
9
|
+
total_items: int | None = 0
|
|
10
|
+
page_size: int | None = 0
|
|
11
|
+
current_page: int | None = 0
|
|
12
|
+
total_pages: int | None = 0
|
|
13
|
+
has_next: bool | None = False
|
|
14
|
+
has_prev: bool | None = False
|
|
15
|
+
|
|
@@ -6,10 +6,11 @@ from sharedkernel.exception.exception import UnAuthorizedException
|
|
|
6
6
|
from sharedkernel.objects import JwtModel
|
|
7
7
|
from sharedkernel.objects.user_info import current_user_info, UserInfo
|
|
8
8
|
|
|
9
|
+
|
|
9
10
|
class JWTBearer(HTTPBearer):
|
|
10
11
|
|
|
11
|
-
def __init__(self,jwt_config:JwtModel, auto_error: bool = True):
|
|
12
|
-
self.jwt_config=jwt_config
|
|
12
|
+
def __init__(self, jwt_config: JwtModel, auto_error: bool = True):
|
|
13
|
+
self.jwt_config = jwt_config
|
|
13
14
|
super(JWTBearer, self).__init__(auto_error=auto_error)
|
|
14
15
|
|
|
15
16
|
async def __call__(self, request: Request):
|
|
@@ -22,26 +23,23 @@ class JWTBearer(HTTPBearer):
|
|
|
22
23
|
|
|
23
24
|
nameid = decoded_token.get("nameid") or decoded_token.get("id")
|
|
24
25
|
|
|
25
|
-
user_info = UserInfo(
|
|
26
|
-
nameid=nameid, email=decoded_token.get("email"), unique_name=decoded_token.get("unique_name")
|
|
27
|
-
)
|
|
26
|
+
user_info = UserInfo(nameid=nameid, role=decoded_token.get("role"))
|
|
28
27
|
|
|
29
28
|
current_user_info.set(user_info)
|
|
30
29
|
|
|
31
30
|
except:
|
|
32
|
-
raise UnAuthorizedException()
|
|
33
|
-
|
|
31
|
+
raise UnAuthorizedException()
|
|
34
32
|
|
|
35
33
|
def verify(self, token: str) -> dict:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
34
|
+
decoded_token = jwt.decode(
|
|
35
|
+
jwt=token.replace("Bearer", "").strip(),
|
|
36
|
+
key=self.jwt_config.secret_key,
|
|
37
|
+
algorithms=self.jwt_config.algorithms,
|
|
38
|
+
audience=self.jwt_config.audience,
|
|
39
|
+
issuer=self.jwt_config.issuer,
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
if decoded_token["exp"] < time.time():
|
|
43
|
+
raise UnAuthorizedException()
|
|
44
|
+
|
|
45
|
+
return decoded_token
|
|
@@ -4,10 +4,9 @@ from contextvars import ContextVar
|
|
|
4
4
|
|
|
5
5
|
class UserInfo(BaseModel):
|
|
6
6
|
nameid: str
|
|
7
|
-
unique_name: str | None = None
|
|
8
|
-
email: str | None = None
|
|
9
7
|
role: str | None = None
|
|
10
|
-
|
|
8
|
+
org_token: str | None = None
|
|
9
|
+
org_user_id: str | None = None
|
|
11
10
|
|
|
12
11
|
current_user_info: ContextVar[UserInfo] = ContextVar("current_user_info")
|
|
13
12
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sharedkernel
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.5
|
|
4
4
|
Summary: sharekernel is a shared package between all python projects
|
|
5
5
|
Author: Smilinno
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -29,6 +29,10 @@ Dynamic: summary
|
|
|
29
29
|
this is a shared kernel package
|
|
30
30
|
|
|
31
31
|
# Change Log
|
|
32
|
+
### Version 2.2.5
|
|
33
|
+
- add org_token to user_info Object
|
|
34
|
+
### Version 2.2.4
|
|
35
|
+
- make pagination response default values to None
|
|
32
36
|
### Version 2.2.3
|
|
33
37
|
- add paginate to mongo repository
|
|
34
38
|
### Version 2.2.2
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
from typing import List, TypeVar, Generic
|
|
2
|
-
|
|
3
|
-
from pydantic import BaseModel
|
|
4
|
-
# from pydantic.generics import GenericModel
|
|
5
|
-
|
|
6
|
-
T = TypeVar("T", bound=BaseModel)
|
|
7
|
-
|
|
8
|
-
class PaginationResponseDto(BaseModel, Generic[T]):
|
|
9
|
-
data: List[T]
|
|
10
|
-
total_items: int
|
|
11
|
-
page_size: int
|
|
12
|
-
current_page: int
|
|
13
|
-
total_pages: int
|
|
14
|
-
has_next: bool
|
|
15
|
-
has_prev: bool
|
|
16
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sharedkernel-2.2.3 → sharedkernel-2.2.5}/sharedkernel/database/mongo_generic_audit_repository.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
|
{sharedkernel-2.2.3 → sharedkernel-2.2.5}/sharedkernel/normalizer/phone_number_normalizer.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
|