kopia lustrzana https://github.com/cirospaciari/socketify.py
rodzic
29cafd0414
commit
976c22f02f
|
@ -15,6 +15,8 @@ class User:
|
||||||
class Query:
|
class Query:
|
||||||
@strawberry.field
|
@strawberry.field
|
||||||
def user(self) -> Optional[User]:
|
def user(self) -> Optional[User]:
|
||||||
|
# self.context is an dict with headers, query, and params properties
|
||||||
|
# headers and query are dict and params an array with route parameters
|
||||||
return User(name="Hello")
|
return User(name="Hello")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ async def auth(res, req, data=None):
|
||||||
user = await get_user(req.get_header('authorization'))
|
user = await get_user(req.get_header('authorization'))
|
||||||
if not user:
|
if not user:
|
||||||
res.write_status(403).end("not authorized")
|
res.write_status(403).end("not authorized")
|
||||||
|
#returning Falsy in middlewares just stop the execution of the next middleware
|
||||||
return False
|
return False
|
||||||
|
|
||||||
#returns extra data
|
#returns extra data
|
||||||
|
|
Ładowanie…
Reference in New Issue