cardo-python-utils 0.5.dev55__py3-none-any.whl → 0.5.dev56__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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cardo-python-utils
3
- Version: 0.5.dev55
3
+ Version: 0.5.dev56
4
4
  Summary: Python library enhanced with a wide range of functions for different scenarios.
5
5
  Author-email: CardoAI <hello@cardoai.com>
6
6
  License: MIT
@@ -1,4 +1,4 @@
1
- cardo_python_utils-0.5.dev55.dist-info/licenses/LICENSE,sha256=N-YtxDy8n5A1Mo7JKKItNIlboiK_pMOZ48ojx76jo3g,1046
1
+ cardo_python_utils-0.5.dev56.dist-info/licenses/LICENSE,sha256=N-YtxDy8n5A1Mo7JKKItNIlboiK_pMOZ48ojx76jo3g,1046
2
2
  python_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  python_utils/choices.py,sha256=_sLNkSnQqhg55gGKNRsOQCJ75W6gnz8J8Q00528MEYk,2548
4
4
  python_utils/data_structures.py,sha256=ZqkZYPy20zyGYOVhwb9qst4vF_P7X2A9z5E36rMUC6I,16820
@@ -25,7 +25,7 @@ python_utils/django/admin/templates/__init__.py,sha256=LxCKcnJ1Ty48CFDJ8XtAZYTW4
25
25
  python_utils/django/admin/templates/user_groups_changelist.html,sha256=KbO6bsH-nh3DDYCq4UB8j25NdjLP_nh_GuGZ4lYSarM,182
26
26
  python_utils/django/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
27
27
  python_utils/django/api/drf.py,sha256=ar94uAVIaHDxzi3K7ubNSJDuysUWjV_xv0sFXtkJEuc,3101
28
- python_utils/django/api/ninja.py,sha256=Rz7331hYmKo4jyxtuvEKzOaNUjdmuCpXeHYkWGf0NsA,4863
28
+ python_utils/django/api/ninja.py,sha256=CpNwVEiAsaaZs9DjM3bpDN8I1tuAw0VIlpwdXaikxNg,4845
29
29
  python_utils/django/api/utils.py,sha256=ycpSnTtGcfdGP1_Hk0P2c8ZNId70xOYtjx1m0nAUWRM,3465
30
30
  python_utils/django/auth/service.py,sha256=ggv_qc5B3vmoamoqLiEvU5XWJWcVr57rL0INz5826HE,7485
31
31
  python_utils/django/celery/__init__.py,sha256=eqKpBqhClH-7oK-kD1SUEpzt4Gqu7VWLWmhFUktee0A,79
@@ -64,7 +64,7 @@ python_utils/django/storage/__init__.py,sha256=mNn2YmD7pkXhBLHMM1444BLsCMq78YdYx
64
64
  python_utils/django/storage/tenant_aware_storage.py,sha256=5dDes6xLv7_R8hIBbFIzRvPL7HL9K_RM-G6LI8qUSxM,2550
65
65
  python_utils/django/tests/__init__.py,sha256=Nkt0a7LEHyjLvuEBZ7113VjjAWJlyZlMy-H-JZ5tNcs,252
66
66
  python_utils/django/tests/conftest.py,sha256=KozXmXUWVcDLbkVAb7Aq4sDydGLh2YZkbRa4tkA8Z6U,3167
67
- cardo_python_utils-0.5.dev55.dist-info/METADATA,sha256=493CmMRlAB8Nmk60wyMjUXF6iNUuAVhs9dnOs4Qx3lU,3007
68
- cardo_python_utils-0.5.dev55.dist-info/WHEEL,sha256=YCfwYGOYMi5Jhw2fU4yNgwErybb2IX5PEwBKV4ZbdBo,91
69
- cardo_python_utils-0.5.dev55.dist-info/top_level.txt,sha256=zAx6OfEsjJs8BEW3okSiG_j9gpkI69xWShzum6oBgKI,13
70
- cardo_python_utils-0.5.dev55.dist-info/RECORD,,
67
+ cardo_python_utils-0.5.dev56.dist-info/METADATA,sha256=2G2QizKWVRPWVYcU-sxCpkml-g2RMvnxyQmDT0VOvZU,3007
68
+ cardo_python_utils-0.5.dev56.dist-info/WHEEL,sha256=YCfwYGOYMi5Jhw2fU4yNgwErybb2IX5PEwBKV4ZbdBo,91
69
+ cardo_python_utils-0.5.dev56.dist-info/top_level.txt,sha256=zAx6OfEsjJs8BEW3okSiG_j9gpkI69xWShzum6oBgKI,13
70
+ cardo_python_utils-0.5.dev56.dist-info/RECORD,,
@@ -6,7 +6,7 @@ from jwt.exceptions import ExpiredSignatureError, InvalidTokenError, PyJWKClient
6
6
  from django.conf import settings
7
7
  from django.http import HttpRequest
8
8
  from ninja.security import HttpBearer
9
- from ninja.errors import AuthenticationError, AuthorizationError, HttpError
9
+ from ninja.errors import AuthenticationError, HttpError
10
10
 
11
11
  from .utils import (
12
12
  acreate_or_update_user,
@@ -64,13 +64,13 @@ class AuthBearer(HttpBearer):
64
64
  except ExpiredSignatureError as e:
65
65
  raise AuthenticationError("Token has expired.") from e
66
66
  except (InvalidTokenError, PyJWKClientError) as e:
67
- raise AuthorizationError(f"Invalid token: {str(e)}") from e
67
+ raise AuthenticationError(f"Invalid token: {str(e)}") from e
68
68
 
69
69
  def _get_username(self, payload: TokenPayload) -> str:
70
70
  try:
71
71
  return payload["preferred_username"]
72
72
  except KeyError as e:
73
- raise AuthorizationError("Invalid token: 'preferred_username' claim not present.") from e
73
+ raise AuthenticationError("Invalid token: 'preferred_username' claim not present.") from e
74
74
 
75
75
  def _verify_scopes(self, request, token_payload):
76
76
  allowed_scopes = self._get_view_allowed_scopes(request)