mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-25 18:16:32 +00:00
Allow Supervisor token authentication from landing page (#5321)
The landing page provides the Supervisor token as authentication, so consider the landingpage as new enough too.
This commit is contained in:
parent
f530db98ff
commit
ee5ded29ac
@ -9,6 +9,8 @@ from aiohttp.web import Request, RequestHandler, Response, middleware
|
|||||||
from aiohttp.web_exceptions import HTTPBadRequest, HTTPForbidden, HTTPUnauthorized
|
from aiohttp.web_exceptions import HTTPBadRequest, HTTPForbidden, HTTPUnauthorized
|
||||||
from awesomeversion import AwesomeVersion
|
from awesomeversion import AwesomeVersion
|
||||||
|
|
||||||
|
from supervisor.homeassistant.const import LANDINGPAGE
|
||||||
|
|
||||||
from ...addons.const import RE_SLUG
|
from ...addons.const import RE_SLUG
|
||||||
from ...const import (
|
from ...const import (
|
||||||
REQUEST_FROM,
|
REQUEST_FROM,
|
||||||
@ -288,8 +290,10 @@ class SecurityMiddleware(CoreSysAttributes):
|
|||||||
@middleware
|
@middleware
|
||||||
async def core_proxy(self, request: Request, handler: RequestHandler) -> Response:
|
async def core_proxy(self, request: Request, handler: RequestHandler) -> Response:
|
||||||
"""Validate user from Core API proxy."""
|
"""Validate user from Core API proxy."""
|
||||||
if request[REQUEST_FROM] != self.sys_homeassistant or version_is_new_enough(
|
if (
|
||||||
self.sys_homeassistant.version, _CORE_VERSION
|
request[REQUEST_FROM] != self.sys_homeassistant
|
||||||
|
or self.sys_homeassistant.version == LANDINGPAGE
|
||||||
|
or version_is_new_enough(self.sys_homeassistant.version, _CORE_VERSION)
|
||||||
):
|
):
|
||||||
return await handler(request)
|
return await handler(request)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user