Python channels.auth.AuthMiddlewareStack() Examples
The following are 3
code examples of channels.auth.AuthMiddlewareStack().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
channels.auth
, or try the search function
.
Example #1
Source File: asgi.py From cjworkbench with GNU Affero General Public License v3.0 | 6 votes |
def create_application() -> ProtocolTypeRouter: """Create an ASGI application.""" # Load static modules on startup. # # This means starting a kernel and validating all static modules. There are # two good reasons to load during startup: # # 1. In dev mode, this reports errors in modules ASAP -- during startup # 2. In production, this import line costs time -- better to incur that # cost during startup than to incur it when responding to some random # request. cjwstate.modules.init_module_system() if not settings.I_AM_TESTING: # Only the test environment, Django runs migrations itself. We can't # use MODULE_REGISTRY until it migrates. MODULE_REGISTRY.all_latest() return ProtocolTypeRouter( { "websocket": AuthMiddlewareStack( SetCurrentLocaleAsgiMiddleware(create_url_router()) ) } )
Example #2
Source File: asgi.py From cjworkbench with GNU Affero General Public License v3.0 | 5 votes |
def create_url_router() -> AuthMiddlewareStack: return AuthMiddlewareStack( URLRouter([url(r"workflows/(?P<workflow_id>\d+)", WorkflowConsumer)]) )
Example #3
Source File: authentication.py From TheSpaghettiDetective with GNU Affero General Public License v3.0 | 5 votes |
def TokenAuthMiddlewareStack(inner): return PrinterWSAuthMiddleWare(AuthMiddlewareStack(inner))