[auth] dont activate authenticationMiddleware if secret is missing. NO SECRET ONLY IN FULLY PUBLIC DOMAINS!!!

This commit is contained in:
Maxime Alves LIRMM@home 2022-01-21 14:39:34 +01:00
parent 979007f287
commit 2e5680d29a

View File

@ -129,10 +129,11 @@ class HalfAPI(Starlette):
self.add_route('/', JSONRoute(schemas)) self.add_route('/', JSONRoute(schemas))
self.add_middleware( if SECRET:
AuthenticationMiddleware, self.add_middleware(
backend=JWTAuthenticationBackend() AuthenticationMiddleware,
) backend=JWTAuthenticationBackend()
)
if not PRODUCTION: if not PRODUCTION:
self.add_middleware( self.add_middleware(