mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Limit OAuth scopes for Netatmo and Home Assistant Cloud (#31538)
* Limit OAuth scopes for Netatmo and Home Assistant Cloud * Fix tests by making order of scopes predictable
This commit is contained in:
parent
bf1b78f621
commit
080f9725dc
@ -25,24 +25,22 @@ class NetatmoFlowHandler(
|
|||||||
@property
|
@property
|
||||||
def extra_authorize_data(self) -> dict:
|
def extra_authorize_data(self) -> dict:
|
||||||
"""Extra data that needs to be appended to the authorize url."""
|
"""Extra data that needs to be appended to the authorize url."""
|
||||||
return {
|
scopes = [
|
||||||
"scope": (
|
"read_camera",
|
||||||
" ".join(
|
"read_homecoach",
|
||||||
[
|
"read_presence",
|
||||||
"read_station",
|
"read_smokedetector",
|
||||||
"read_camera",
|
"read_station",
|
||||||
"access_camera",
|
"read_thermostat",
|
||||||
"write_camera",
|
"write_camera",
|
||||||
"read_presence",
|
"write_thermostat",
|
||||||
"access_presence",
|
]
|
||||||
"read_homecoach",
|
|
||||||
"read_smokedetector",
|
if self.flow_impl.name != "Home Assistant Cloud":
|
||||||
"read_thermostat",
|
scopes.extend(["access_camera", "access_presence"])
|
||||||
"write_thermostat",
|
scopes.sort()
|
||||||
]
|
|
||||||
)
|
return {"scope": " ".join(scopes)}
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
async def async_step_user(self, user_input=None):
|
async def async_step_user(self, user_input=None):
|
||||||
"""Handle a flow start."""
|
"""Handle a flow start."""
|
||||||
|
@ -54,15 +54,15 @@ async def test_full_flow(hass, aiohttp_client, aioclient_mock):
|
|||||||
|
|
||||||
scope = "+".join(
|
scope = "+".join(
|
||||||
[
|
[
|
||||||
"read_station",
|
|
||||||
"read_camera",
|
|
||||||
"access_camera",
|
"access_camera",
|
||||||
"write_camera",
|
|
||||||
"read_presence",
|
|
||||||
"access_presence",
|
"access_presence",
|
||||||
|
"read_camera",
|
||||||
"read_homecoach",
|
"read_homecoach",
|
||||||
|
"read_presence",
|
||||||
"read_smokedetector",
|
"read_smokedetector",
|
||||||
|
"read_station",
|
||||||
"read_thermostat",
|
"read_thermostat",
|
||||||
|
"write_camera",
|
||||||
"write_thermostat",
|
"write_thermostat",
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user