mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-22 04:01:27 +00:00
test
This commit is contained in:
parent
db91a60938
commit
323383329a
|
@ -13,9 +13,6 @@ class IsAuthenticated(BasePermission):
|
||||||
message = "You must be authenticated to access this resource."
|
message = "You must be authenticated to access this resource."
|
||||||
|
|
||||||
def has_permission(self, source: typing.Any, info: Info, **kwargs) -> bool:
|
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")
|
token = info.context["request"].headers.get("Authorization")
|
||||||
if token is None:
|
if token is None:
|
||||||
token = info.context["request"].query_params.get("token")
|
token = info.context["request"].query_params.get("token")
|
||||||
|
|
|
@ -142,6 +142,9 @@ def authenticated(info: strawberry.types.Info) -> bool:
|
||||||
|
|
||||||
|
|
||||||
def reject_if_unauthenticated(info: strawberry.types.Info):
|
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):
|
if not authenticated(info):
|
||||||
raise Exception(IsAuthenticated().message)
|
raise Exception(IsAuthenticated().message)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue