[middleware] convert acl_middleware function to class
This commit is contained in:
parent
65e0d09ff8
commit
26e0bb8716
|
@ -1,8 +1,10 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
from starlette.requests import Request
|
from starlette.requests import Request
|
||||||
from starlette.exceptions import HTTPException
|
from starlette.exceptions import HTTPException
|
||||||
|
from starlette.middleware.base import BaseHTTPMiddleware
|
||||||
|
|
||||||
async def acl_middleware(request: Request, call_next):
|
class AclMiddleware(BaseHTTPMiddleware):
|
||||||
|
async def dispatch(self, request: Request, call_next):
|
||||||
""" Checks the "acls" key in the scope and applies the
|
""" Checks the "acls" key in the scope and applies the
|
||||||
corresponding functions in the current module's acl lib.
|
corresponding functions in the current module's acl lib.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue