mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-17 14:16:29 +00:00
Bugfix Proxy with new token (#690)
* Update proxy.py * Update security.py
This commit is contained in:
parent
5cbdbffbb2
commit
dd25c29544
@ -23,7 +23,11 @@ class APIProxy(CoreSysAttributes):
|
|||||||
def _check_access(self, request):
|
def _check_access(self, request):
|
||||||
"""Check the Hass.io token."""
|
"""Check the Hass.io token."""
|
||||||
hassio_token = request.headers.get(HEADER_HA_ACCESS)
|
hassio_token = request.headers.get(HEADER_HA_ACCESS)
|
||||||
addon = self.sys_addons.from_uuid(hassio_token)
|
addon = self.sys_addons.from_token(hassio_token)
|
||||||
|
|
||||||
|
# Need removed with 131
|
||||||
|
if not addon:
|
||||||
|
addon = self.sys_addons.from_uuid(hassio_token)
|
||||||
|
|
||||||
if not addon:
|
if not addon:
|
||||||
_LOGGER.warning("Unknown HomeAssistant API access!")
|
_LOGGER.warning("Unknown HomeAssistant API access!")
|
||||||
@ -178,7 +182,11 @@ class APIProxy(CoreSysAttributes):
|
|||||||
response = await server.receive_json()
|
response = await server.receive_json()
|
||||||
hassio_token = (response.get('api_password') or
|
hassio_token = (response.get('api_password') or
|
||||||
response.get('access_token'))
|
response.get('access_token'))
|
||||||
addon = self.sys_addons.from_uuid(hassio_token)
|
addon = self.sys_addons.from_token(hassio_token)
|
||||||
|
|
||||||
|
# Need removed with 131
|
||||||
|
if not addon:
|
||||||
|
addon = self.sys_addons.from_uuid(hassio_token)
|
||||||
|
|
||||||
if not addon or not addon.access_homeassistant_api:
|
if not addon or not addon.access_homeassistant_api:
|
||||||
_LOGGER.warning("Unauthorized websocket access!")
|
_LOGGER.warning("Unauthorized websocket access!")
|
||||||
|
@ -51,7 +51,7 @@ class SecurityMiddleware(CoreSysAttributes):
|
|||||||
raise HTTPUnauthorized()
|
raise HTTPUnauthorized()
|
||||||
|
|
||||||
# Home-Assistant
|
# Home-Assistant
|
||||||
# UUID check need removed with 130
|
# UUID check need removed with 131
|
||||||
if hassio_token in (self.sys_homeassistant.uuid,
|
if hassio_token in (self.sys_homeassistant.uuid,
|
||||||
self.sys_homeassistant.hassio_token):
|
self.sys_homeassistant.hassio_token):
|
||||||
_LOGGER.debug("%s access from Home-Assistant", request.path)
|
_LOGGER.debug("%s access from Home-Assistant", request.path)
|
||||||
@ -66,7 +66,7 @@ class SecurityMiddleware(CoreSysAttributes):
|
|||||||
addon = None
|
addon = None
|
||||||
if hassio_token and not request_from:
|
if hassio_token and not request_from:
|
||||||
addon = self.sys_addons.from_token(hassio_token)
|
addon = self.sys_addons.from_token(hassio_token)
|
||||||
# Need removed with 130
|
# Need removed with 131
|
||||||
if not addon:
|
if not addon:
|
||||||
addon = self.sys_addons.from_uuid(hassio_token)
|
addon = self.sys_addons.from_uuid(hassio_token)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user