Skip to content

Commit 9db5246

Browse files
VaibhavSingh8lakshayman
authored andcommitted
added rsa token and adjusted logic accordingly
1 parent 706782e commit 9db5246

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

todo/middlewares/jwt_auth.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ def __call__(self, request):
4747
],
4848
)
4949
return JsonResponse(
50-
data=error_response.model_dump(mode="json", exclude_none=True), status=status.HTTP_401_UNAUTHORIZED
50+
data=error_response.model_dump(mode="json", exclude_none=True),
51+
status=status.HTTP_401_UNAUTHORIZED
5152
)
5253

5354
except (TokenMissingError, TokenExpiredError, TokenInvalidError) as e:
@@ -66,7 +67,8 @@ def __call__(self, request):
6667
],
6768
)
6869
return JsonResponse(
69-
data=error_response.model_dump(mode="json", exclude_none=True), status=status.HTTP_401_UNAUTHORIZED
70+
data=error_response.model_dump(mode="json", exclude_none=True),
71+
status=status.HTTP_401_UNAUTHORIZED
7072
)
7173

7274
def _try_authentication(self, request) -> bool:
@@ -186,7 +188,8 @@ def _handle_rds_auth_error(self, exception):
186188
errors=[ApiErrorDetail(title=ApiErrors.AUTHENTICATION_FAILED, detail=str(exception))],
187189
)
188190
return JsonResponse(
189-
data=error_response.model_dump(mode="json", exclude_none=True), status=status.HTTP_401_UNAUTHORIZED
191+
data=error_response.model_dump(mode="json", exclude_none=True),
192+
status=status.HTTP_401_UNAUTHORIZED
190193
)
191194

192195
def _handle_google_auth_error(self, exception):
@@ -196,7 +199,8 @@ def _handle_google_auth_error(self, exception):
196199
errors=[ApiErrorDetail(title=ApiErrors.AUTHENTICATION_FAILED, detail=str(exception))],
197200
)
198201
return JsonResponse(
199-
data=error_response.model_dump(mode="json", exclude_none=True), status=status.HTTP_401_UNAUTHORIZED
202+
data=error_response.model_dump(mode="json", exclude_none=True),
203+
status=status.HTTP_401_UNAUTHORIZED
200204
)
201205

202206

@@ -233,4 +237,4 @@ def get_current_user_info(request) -> dict:
233237
}
234238
)
235239

236-
return user_info
240+
return user_info

todo/views/auth.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
from todo.constants.messages import ApiErrors, AppMessages
1414
from todo.middlewares.jwt_auth import get_current_user_info
1515

16-
1716
class GoogleLoginView(APIView):
1817
@extend_schema(
1918
operation_id="google_login",
@@ -156,7 +155,6 @@ def _set_auth_cookies(self, response, tokens):
156155
"ext-refresh", tokens["refresh_token"], max_age=settings.GOOGLE_JWT["REFRESH_TOKEN_LIFETIME"], **config
157156
)
158157

159-
160158
class GoogleLogoutView(APIView):
161159
@extend_schema(
162160
operation_id="google_logout",

0 commit comments

Comments
 (0)