Commit Graph

57 Commits

Author SHA1 Message Date
Franck Nijhof fcb612cd6f
Collection of code styling tweaks (#87344) 2023-02-03 23:51:27 +01:00
Marc Mueller 07a3046d11
Update pylint to 2.16.0 (#87083) 2023-02-02 12:49:01 +01:00
Paulus Schoutsen df0fc30695
Fix oauth2 error (#86634) 2023-01-25 20:50:16 +01:00
Allen Porter 1afb4897a8
Add a timeout during OAuth token exchange and additional debug logging (#85911) 2023-01-16 19:52:43 +01:00
Franck Nijhof d4f69a3652
String formatting and max line length - Part 7 (#84532)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-12-27 11:18:56 +01:00
Allen Porter b014d558ff
Add application credentials platform for nest and deprecate yaml for SDM API (#73050)
* Update the nest integration to be useable fully from the config flow

* Support discovery in nest config flow

* Remove configuration entries

* Remove unused import

* Remove dead code

* Update homeassistant/components/nest/strings.json

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Remove commented out code

* Use config flow for app auth reauthentication path

* Improves for re-auth for upgrading existing project and creds

* More dead code removal

* Apply suggestions from code review

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Remove outdated code

* Update homeassistant/components/nest/config_flow.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-06-15 07:15:53 -07:00
Joakim Plate 84779482b8
Don't set headers kwargs multiple times (#72779) 2022-05-31 13:08:50 -07:00
Paulus Schoutsen 6a3d2e54a2
Handle OAuth2 rejection (#72040) 2022-05-28 20:23:16 -07:00
Franck Nijhof 38ad1ef233
Use My Home Assistant for OAuth2 redirect callbacks (#72449)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2022-05-24 19:00:36 -07:00
Allen Porter 26ee289be3
Add return code to integration application credentials in config flow (#71986)
* Add return code to integration application credentials in config flow

* Update google tests to use new return code

* Update spotify test for no auth configured

* Add translation for oauth2_missing_credentials

* Add new return code to yolink

* Update homeassistant/strings.json

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

Co-authored-by: Franck Nijhof <frenck@frenck.nl>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-05-18 06:30:57 -07:00
Allen Porter 00b5d30e24
Add application credentials platform (#69148)
* Initial developer credentials scaffolding
- Support websocket list/add/delete
- Add developer credentials protocol from yaml config
- Handle OAuth credential registration and de-registration
- Tests for websocket and integration based registration

* Fix pydoc text

* Remove translations and update owners

* Update homeassistant/components/developer_credentials/__init__.py

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>

* Update homeassistant/components/developer_credentials/__init__.py

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>

* Remove _async_get_developer_credential

* Rename to application credentials platform

* Fix race condition and add import support

* Increase code coverage (92%)

* Increase test coverage 93%

* Increase test coverage (94%)

* Increase test coverage (97%)

* Increase test covearge (98%)

* Increase test coverage (99%)

* Increase test coverage (100%)

* Remove http router frozen comment

* Remove auth domain override on import

* Remove debug statement

* Don't import the same client id multiple times

* Add auth dependency for local oauth implementation

* Revert older oauth2 changes from merge

* Update homeassistant/components/application_credentials/__init__.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Move config credential import to its own fixture

* Override the mock_application_credentials_integration fixture instead per test

* Update application credentials

* Add dictionary typing

* Use f-strings as per feedback

* Add additional structure needed for an MVP application credential

Add additional structure needed for an MVP, including a target
component Xbox

* Add websocket to list supported integrations for frontend selector

* Application credentials config

* Import xbox credentials

* Remove unnecessary async calls

* Update script/hassfest/application_credentials.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update script/hassfest/application_credentials.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update script/hassfest/application_credentials.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update script/hassfest/application_credentials.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Import credentials with a fixed auth domain

Resolve an issue with compatibility of exisiting config entries when importing
client credentials

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-04-30 08:06:43 -07:00
Marc Mueller 9b9b553521
Disable no-self-use [pylint] (#70641)
* Disable no-self-use

* Remove disable comments
2022-04-25 07:41:01 -07:00
Allen Porter c07100e519
Move Local OAuth http endpoint registration to auth component (#69507) 2022-04-06 22:34:31 -07:00
Marc Mueller bfb1abd3a2
Add type ignore error codes [helpers] (#66776) 2022-02-18 11:31:37 +01:00
Marc Mueller d3b7bd25ef
Update typing (1) (#63922) 2022-01-11 21:26:03 +01:00
Ruslan Sayfutdinov 55f4962c06
Fix pylint plugin which checks relative imports (#62693) 2021-12-23 11:14:47 -08:00
J. Nick Koston 10d6247fee
Bump to aiohttp 3.8.0 (#58974) 2021-11-04 10:07:50 -05:00
Marc Mueller 3f1b4906bf
Use assignment expressions 35 (#58824) 2021-10-31 18:32:17 +01:00
Marc Mueller 238b488642
Use assignment expressions 03 (#57710) 2021-10-17 20:08:11 +02:00
Marc Mueller 77ee72cbb9
Import Callable from collections.abc (1) (#56775) 2021-09-29 16:32:11 +02:00
Marc Mueller 48bada5a18
Update pylint to 2.11.1 (#56364) 2021-09-18 13:52:59 +02:00
Ruslan Sayfutdinov 7195b8222b
Bump PyJWT to 2.1.0 (#55911) 2021-09-07 20:59:02 -07:00
Ruslan Sayfutdinov 391b2f8ccd
Add missing return type in Core constructors (#50884) 2021-05-20 18:53:29 +03:00
Martin Hjelmare e32dc306e1
Fix oauth2 helper user step typing (#50618) 2021-05-14 23:39:14 +02:00
Ruslan Sayfutdinov ce15f28642
Add missing type hints in http component (#50411) 2021-05-10 14:30:47 -07:00
Franck Nijhof 96f69fb9fb
Finalize clean up connection classes (#49895) 2021-05-04 20:08:51 +02:00
Ruslan Sayfutdinov 183220008d
Rename FlowResultDict to FlowResult (#49847) 2021-04-29 13:40:51 +02:00
Marc Mueller c07646db5d
Update typing syntax (#49480)
* Update typing syntax

* Replace typing imports with ones from collections where possible

* Changes after review
2021-04-20 17:40:41 +02:00
Ruslan Sayfutdinov 80f66f301b
Define data flow result type (#49260)
* Define data flow result type

* Revert explicit definitions

* Fix tests

* Specific mypy ignore
2021-04-15 07:17:07 -10:00
Franck Nijhof f0e5e616a7
Fix device discovery of OAuth2 config flows (#48326) 2021-03-25 10:35:01 -07:00
Marc Mueller 6fb2e63e49
Update typing 02 (#48014) 2021-03-17 18:34:19 +01:00
Franck Nijhof 5d5a110a20
None optional hass typing in base entity and notify (#47528) 2021-03-15 15:11:41 +01:00
J. Nick Koston da677f7d5a
Add support for discovery via DHCP (#45087)
* Add support for discovery via DHCP

* additional tesla ouis

* merge tests

* dhcp test

* merge requirements test

* dhcp test

* dhcp discovery

* dhcp discovery

* pylint

* pylint

* pylint

* fix

* Add matching tests

* 100% cover

* cleanup

* fix codespell

* Update exception handling

* remove unneeded comment

* fix options handling exception

* fix options handling exception
2021-01-14 09:09:08 +01:00
Allen Porter eb07282e9b
Add debug logging for failed OAuth token refreshes to help users diagnose (#44637) 2020-12-30 10:03:27 +01:00
Paulus Schoutsen f9fa24950b
OAuth2 to use current request header (#43668) 2020-11-27 08:55:34 +01:00
springstan 92379ad8d2
Use list literal without using dict.keys() (#42573) 2020-10-30 09:19:13 -05:00
J. Nick Koston 94219c2266
Ensure the oauth2 token is refreshed before it is expired (#42487)
The current implementation assumed clocks were in sync and did
not account for the time it took to refresh the token.  A 20
second buffer has been added to ensure that the token is refreshed
before it expires as OAuth2Session.valid_token would assume the
token was still good even though the remote would reject it
and would not refresh because it was not time yet.
2020-10-28 07:47:54 -05:00
Erik Montnemery 343e5d64b8
Add MQTT integration discovery (#41332)
* Add MQTT integration discovery

* Add script/hassfest/mqtt.py

* Unsubscribe if config entry exists

* Add homeassistant/generated/mqtt.py

* Fix bad loop

* Improve tests

* Improve tests

* Apply suggestions from code review

Co-authored-by: Fabian Affolter <mail@fabian-affolter.ch>

* Prevent initiating multiple config flows

Co-authored-by: Fabian Affolter <mail@fabian-affolter.ch>
2020-10-07 18:30:51 +02:00
Joakim Sørensen 0cce35b23e
Add exception for NoURLAvailableError in OAuth2FlowHandler (#39845)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2020-09-10 14:52:49 +02:00
Aidan Timson 6f43285a28
Force token expires_in to float (#39489) 2020-09-07 21:26:58 +02:00
Franck Nijhof 755761867d
Use current request context in OAuth redirect (#38692) 2020-08-15 15:26:54 +02:00
Franck Nijhof 8b21b415c4
Fix/Rewrite of Toon integration (#36952)
Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2020-06-22 18:22:41 -07:00
Franck Nijhof 3cc94f7d6a
ConfigFlow default discovery without unique ID (#36754) 2020-06-15 13:38:38 +02:00
Franck Nijhof e3e3a113e9
async_get_url -> get_url (#35382) 2020-05-08 21:53:28 +02:00
Franck Nijhof 2223592486
Add get_url helper, deprecate base_url (#35224) 2020-05-08 02:29:47 +02:00
Ville Skyttä 9b7e31eca3
Make f-strings without placeholder normal strings (#33938) 2020-04-10 09:59:06 +02:00
Fabian Affolter 2647296475
Refactor API documentation (#33217)
* Upgrade Sphinx to 2.4.4

* Refactor API documentation

* Remove left-over

* Remove Markdown from docstring

* Update titels
2020-03-25 13:21:04 -07:00
Ville Skyttä 221d5205e4
Upgrade mypy to 0.770, tighten config a bit (#32715)
* Upgrade mypy to 0.770, related cleanups

https://mypy-lang.blogspot.com/2020/03/mypy-0770-released.html

* Clean up config and make it a notch stricter, address findings
2020-03-12 11:52:20 +01:00
Franck Nijhof 1b739f9555 Removes unneeded abort if unique id in Oauth2 discovery flow (#30733) 2020-01-13 05:29:19 -08:00
Franck Nijhof 6729902010 Fix discovery for oauth2 flow implementations (#30700)
* Fix discovery for oauth2 flow implementations

* Fix user step

* Add tests
2020-01-12 07:37:34 -08:00