This commit is contained in:
Inex Code 2024-07-04 21:02:56 +04:00
parent db91a60938
commit 323383329a
2 changed files with 3 additions and 3 deletions

View file

@ -13,9 +13,6 @@ class IsAuthenticated(BasePermission):
message = "You must be authenticated to access this resource."
def has_permission(self, source: typing.Any, info: Info, **kwargs) -> bool:
connection_params = info.context.get("connection_params")
print("Printing connection params from the ws connect!")
print(connection_params)
token = info.context["request"].headers.get("Authorization")
if token is None:
token = info.context["request"].query_params.get("token")

View file

@ -142,6 +142,9 @@ def authenticated(info: strawberry.types.Info) -> bool:
def reject_if_unauthenticated(info: strawberry.types.Info):
connection_params = info.context.get("connection_params")
print("Printing connection params from the ws connect!")
print(connection_params)
if not authenticated(info):
raise Exception(IsAuthenticated().message)