nlbone 0.7.12__py3-none-any.whl → 0.7.13__py3-none-any.whl

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.
@@ -1,5 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
+ from _decimal import Decimal
3
4
  from dataclasses import dataclass
4
5
  from datetime import datetime, timezone
5
6
  from enum import Enum
@@ -38,6 +39,8 @@ class DomainEvent(Message):
38
39
  for k, v in d.items():
39
40
  if isinstance(v, BaseId):
40
41
  d[k] = v.value
42
+ elif isinstance(v, Decimal):
43
+ d[k] = str(v)
41
44
  return d
42
45
 
43
46
 
@@ -50,7 +50,9 @@ def authenticate_admin_user(request, auth_service):
50
50
  pass
51
51
 
52
52
  def authenticate_user(request):
53
- token = request.cookies.get("access_token") or request.cookies.get("j_token")
53
+ token = request.cookies.get("access_token") or request.cookies.get("j_token") or request.headers.get("Authorization")
54
+ if request.headers.get("Authorization"):
55
+ scheme, token = request.headers.get("Authorization").split(" ", 1)
54
56
 
55
57
  if token:
56
58
  request.state.token = token
@@ -72,7 +74,9 @@ class AuthenticationMiddleware(BaseHTTPMiddleware):
72
74
  request.state.client_id = request.headers.get("X-Client-Id")
73
75
  request.state.user_id = None
74
76
  request.state.token = None
75
- if request.cookies.get("access_token"):
77
+ if request.headers.get('X-Client-Id') == 'website' and request.headers.get("Authorization"):
78
+ authenticate_user(request)
79
+ elif request.cookies.get("access_token"):
76
80
  authenticate_user(request)
77
81
  elif request.headers.get("Authorization"):
78
82
  authenticate_admin_user(request, auth_service=self._get_auth)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nlbone
3
- Version: 0.7.12
3
+ Version: 0.7.13
4
4
  Summary: Backbone package for interfaces and infrastructure in Python projects
5
5
  Author-email: Amir Hosein Kahkbazzadeh <a.khakbazzadeh@gmail.com>
6
6
  License: MIT
@@ -53,7 +53,7 @@ nlbone/core/application/registry.py,sha256=dTqV_4bkMsLJ60CesZuEel5xO36cD1qikiaCL
53
53
  nlbone/core/application/use_case.py,sha256=3GMQZ3CFK5cbLoBNBgohPft6GBq2j9_wr8iKRq_osQA,247
54
54
  nlbone/core/application/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
55
55
  nlbone/core/domain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
56
- nlbone/core/domain/base.py,sha256=CZvnZQ5qcAufLnyttBAr1dAKeAkqLpkjuMzFUldkHQI,2525
56
+ nlbone/core/domain/base.py,sha256=NoTn6I2cdN3WT9srPpFm-z4998GJjVhts_p8w6QIx7E,2625
57
57
  nlbone/core/domain/models.py,sha256=zHVrCl_8ogmShrH0lRZQam0BpMJ7iIM-ojKNoGVzx2M,3297
58
58
  nlbone/core/ports/__init__.py,sha256=syJg3fAjQALD5Rjfm9wi9bQpkIvNTWjE9AURBmy587o,132
59
59
  nlbone/core/ports/auth.py,sha256=C-GmUqHNx4bAku6KbW_OTpPXCEfurBWWyDi9KxpTi9M,553
@@ -83,7 +83,7 @@ nlbone/interfaces/api/dependencies/uow.py,sha256=QfLEvLYLNWZJQN1k-0q0hBVtUld3D75
83
83
  nlbone/interfaces/api/middleware/__init__.py,sha256=zbX2vaEAfxRMIYwO2MVY_2O6bqG5H9o7HqGpX14U3Is,158
84
84
  nlbone/interfaces/api/middleware/access_log.py,sha256=vIkxxxfy2HcjqqKb8XCfGCcSrivAC8u6ie75FMq5x-U,1032
85
85
  nlbone/interfaces/api/middleware/add_request_context.py,sha256=av-qs0biOYuF9R6RJOo2eYsFqDL9WRYWcjVakFhbt-w,1834
86
- nlbone/interfaces/api/middleware/authentication.py,sha256=NmCkN_PXBIMJ8tgKJU4C4JHq_9Ohe_-fwgiuv5uWlIk,2497
86
+ nlbone/interfaces/api/middleware/authentication.py,sha256=TaGDvOFmtN5YLVHbEFsB-7xVWYNVpaqtTTgCPZ0T7P0,2799
87
87
  nlbone/interfaces/api/pagination/__init__.py,sha256=pA1uC4rK6eqDI5IkLVxmgO2B6lExnOm8Pje2-hifJZw,431
88
88
  nlbone/interfaces/api/pagination/offset_base.py,sha256=AwuHLQELAKut58fQSL2hk-QhfwsG1coJWz-Jkh2gnmg,4113
89
89
  nlbone/interfaces/api/schema/__init__.py,sha256=LAqgynfupeqOQ6u0I5ucrcYnojRMZUg9yW8IjKSQTNI,119
@@ -107,8 +107,8 @@ nlbone/utils/http.py,sha256=MPDEyaC16AKsL0YH6sWCPp8NC2TgzEHpWERYK5HcaYQ,1001
107
107
  nlbone/utils/normalize_mobile.py,sha256=sGH4tV9gX-6eVKozviNWJhm1DN1J28Nj-ERldCYkS_E,732
108
108
  nlbone/utils/redactor.py,sha256=-V4HrHmHwPi3Kez587Ek1uJlgK35qGSrwBOvcbw8Jas,1279
109
109
  nlbone/utils/time.py,sha256=DjjyQ9GLsfXoT6NK8RDW2rOlJg3e6sF04Jw6PBUrSvg,1268
110
- nlbone-0.7.12.dist-info/METADATA,sha256=91FotKd3RsBPitL2kp2X_qbLuljuQiRZeSyK_IoZ8sA,2295
111
- nlbone-0.7.12.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
112
- nlbone-0.7.12.dist-info/entry_points.txt,sha256=CpIL45t5nbhl1dGQPhfIIDfqqak3teK0SxPGBBr7YCk,59
113
- nlbone-0.7.12.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
114
- nlbone-0.7.12.dist-info/RECORD,,
110
+ nlbone-0.7.13.dist-info/METADATA,sha256=zRldYwqSoAeRrBOTmqRFV2OH_hZKJgzagNkYHQryokA,2295
111
+ nlbone-0.7.13.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
112
+ nlbone-0.7.13.dist-info/entry_points.txt,sha256=CpIL45t5nbhl1dGQPhfIIDfqqak3teK0SxPGBBr7YCk,59
113
+ nlbone-0.7.13.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
114
+ nlbone-0.7.13.dist-info/RECORD,,