File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44
55[project ]
66name = " cardo-python-utils"
7- version = " 0.5.dev55 "
7+ version = " 0.5.dev56 "
88description = " Python library enhanced with a wide range of functions for different scenarios."
99readme = " README.rst"
1010requires-python = " >=3.8"
Original file line number Diff line number Diff line change 66from django .conf import settings
77from django .http import HttpRequest
88from ninja .security import HttpBearer
9- from ninja .errors import AuthenticationError , AuthorizationError , HttpError
9+ from ninja .errors import AuthenticationError , HttpError
1010
1111from .utils import (
1212 acreate_or_update_user ,
@@ -64,13 +64,13 @@ def _decode_token(self, token: str) -> TokenPayload:
6464 except ExpiredSignatureError as e :
6565 raise AuthenticationError ("Token has expired." ) from e
6666 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
6868
6969 def _get_username (self , payload : TokenPayload ) -> str :
7070 try :
7171 return payload ["preferred_username" ]
7272 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
7474
7575 def _verify_scopes (self , request , token_payload ):
7676 allowed_scopes = self ._get_view_allowed_scopes (request )
You can’t perform that action at this time.
0 commit comments