mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-19 07:06:30 +00:00
Update auth.py (#771)
This commit is contained in:
parent
cecad526a2
commit
9591e71138
@ -2,12 +2,13 @@
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
from aiohttp import BasicAuth
|
from aiohttp import BasicAuth
|
||||||
from aiohttp.hdrs import CONTENT_TYPE, AUTHORIZATION
|
from aiohttp.web_exceptions import HTTPUnauthorized
|
||||||
|
from aiohttp.hdrs import CONTENT_TYPE, AUTHORIZATION, WWW_AUTHENTICATE
|
||||||
|
|
||||||
from .utils import api_process
|
from .utils import api_process
|
||||||
from ..const import REQUEST_FROM, CONTENT_TYPE_JSON, CONTENT_TYPE_URL
|
from ..const import REQUEST_FROM, CONTENT_TYPE_JSON, CONTENT_TYPE_URL
|
||||||
from ..coresys import CoreSysAttributes
|
from ..coresys import CoreSysAttributes
|
||||||
from ..exceptions import APIError, APIForbidden
|
from ..exceptions import APIForbidden
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -55,4 +56,6 @@ class APIAuth(CoreSysAttributes):
|
|||||||
data = await request.post()
|
data = await request.post()
|
||||||
return await self._process_dict(request, addon, data)
|
return await self._process_dict(request, addon, data)
|
||||||
|
|
||||||
raise APIError("Auth method not detected!")
|
raise HTTPUnauthorized(headers={
|
||||||
|
WWW_AUTHENTICATE: "Basic realm=\"Hass.io Authentication\""
|
||||||
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user