Remove direct authentication via trusted networks or API password (#27656)
* Remove direct authentication via trusted networks and API password * Fix tests
This commit is contained in:
1 parent
97478d1ef4
commit
3231e22ddf
33 files changed
+114
-423
No files matched your search
@@ -13,11 +13,12 @@ from aiohttp.hdrs import (
|
||||
)
|
||||
import pytest
|
||||
|
||||
from homeassistant.const import HTTP_HEADER_HA_AUTH
|
||||
from homeassistant.setup import async_setup_component
|
||||
from homeassistant.components.http.cors import setup_cors
|
||||
from homeassistant.components.http.view import HomeAssistantView
|
||||
|
||||
from . import HTTP_HEADER_HA_AUTH
|
||||
|
||||
|
||||
TRUSTED_ORIGIN = "https://home-assistant.io"
|
||||
|
||||
@@ -91,13 +92,13 @@ async def test_cors_preflight_allowed(client):
|
||||
headers={
|
||||
ORIGIN: TRUSTED_ORIGIN,
|
||||
ACCESS_CONTROL_REQUEST_METHOD: "GET",
|
||||
ACCESS_CONTROL_REQUEST_HEADERS: "x-ha-access",
|
||||
ACCESS_CONTROL_REQUEST_HEADERS: "x-requested-with",
|
||||
},
|
||||
)
|
||||
|
||||
assert req.status == 200
|
||||
assert req.headers[ACCESS_CONTROL_ALLOW_ORIGIN] == TRUSTED_ORIGIN
|
||||
assert req.headers[ACCESS_CONTROL_ALLOW_HEADERS] == HTTP_HEADER_HA_AUTH.upper()
|
||||
assert req.headers[ACCESS_CONTROL_ALLOW_HEADERS] == "X-REQUESTED-WITH"
|
||||
|
||||
|
||||
async def test_cors_middleware_with_cors_allowed_view(hass):
|
||||
|
||||
Reference in new issue
Block a user