# Handy shortcut for applying all three layers at once
def TokenAuthMiddlewareStack(inner):
"""
middleware to support websocket ssh connection
from both session or by queries
"""
return AuthMiddlewareStack(TokenAuthMiddleware(inner))
class TokenAuthMiddleware:
def __init__(self, app):
self.app = app
async def __call__(self, scope, receive, send):
print(scope) <------------ when i try to see then nothing is presented token, session-id, and csrf(idk if csrf should be present!)
user = await get_user_from_headers_or_queries(scope)
if user is not None:
scope["user"] = user
return await self.app(scope, receive, send)
I'm trying to put Auth on django-eventstream urls but it seems im not able to get the appropriate headers to work with.
what have i tried is:-
settings.py
asgi.py
middelware.py
any help ?