mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
Whitelist Android/iOS auth callbacks (#30082)
* Whitelist Android/iOS * Add iOS alternate flavor URLs * Update indieauth.py Co-authored-by: Robbie Trencheny <me@robbiet.us>
This commit is contained in:
@@ -166,3 +166,24 @@ async def test_find_link_tag_max_size(hass, mock_session):
|
||||
redirect_uris = await indieauth.fetch_redirect_uris(hass, "http://127.0.0.1:8000")
|
||||
|
||||
assert redirect_uris == ["http://127.0.0.1:8000/wine"]
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"client_id", ["https://home-assistant.io/android", "https://home-assistant.io/iOS"]
|
||||
)
|
||||
async def test_verify_redirect_uri_android_ios(client_id):
|
||||
"""Test that we verify redirect uri correctly for Android/iOS."""
|
||||
with patch.object(
|
||||
indieauth, "fetch_redirect_uris", side_effect=lambda *_: mock_coro([])
|
||||
):
|
||||
assert await indieauth.verify_redirect_uri(
|
||||
None, client_id, "homeassistant://auth-callback"
|
||||
)
|
||||
|
||||
assert not await indieauth.verify_redirect_uri(
|
||||
None, client_id, "homeassistant://something-else"
|
||||
)
|
||||
|
||||
assert not await indieauth.verify_redirect_uri(
|
||||
None, "https://incorrect.com", "homeassistant://auth-callback"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user