Commit Graph
49 Commits
Author SHA1 Message Date
Robert ReschandGitHub 4a464f601c Remove users refresh tokens when the user get's deactivated (#159443) 2025-12-19 15:50:47 +01:00
6bb4e7d62c Bump ruff to 0.3.4 (#112690)
Co-authored-by: Sid <[email protected]>
Co-authored-by: Marc Mueller <[email protected]>
Co-authored-by: J. Nick Koston <[email protected]>
2024-03-26 00:02:16 +01:00
Marc MuellerandGitHub 19ab3d6daf Add empty line after module docstring [helpers + other] (#112707) 2024-03-08 10:36:11 -05:00
f5d439799b Add expiration of unused refresh tokens (#108428)
Co-authored-by: J. Nick Koston <[email protected]>
2024-01-24 13:24:22 -10:00
J. Nick KostonandGitHub 2eea658fd8 Convert getting and removing access tokens to normal functions (#108670) 2024-01-22 20:51:33 -10:00
J. Nick KostonandGitHub ec15b0def2 Always load auth storage at startup (#108543) 2024-01-20 16:16:43 -10:00
Jan-Philipp BeneckeandGitHub 6666b796f2 Migrate auth tests to use freezegun (#105243) 2023-12-07 21:18:10 +01:00
J. Nick KostonandGitHub 2dfc8b9d7f Avoid conversion of timestamps in jwt auth (#101856) 2023-10-13 14:11:17 +02:00
5c6ed8f6d5 Use call_at for events instead call_later (#93431)
Co-authored-by: Jan Bouwhuis <[email protected]>
2023-05-24 21:04:07 +02:00
J. Nick KostonandGitHub ca576d45ac Cache decode of JWT tokens (#90013) 2023-03-22 16:03:41 -10:00
epenetandGitHub 5f25b71df7 Add type hints to core tests (#88478) 2023-02-20 11:42:56 +01:00
epenetandGitHub c98b4e3204 Add typing to tests with single hass argument (2) (#87675)
* Add typing to tests with single hass argument (2)

* a few more
2023-02-08 08:51:43 +01:00
Franck NijhofandGitHub 57cf11f067 Enable Ruff PT015 (#86775) 2023-01-27 11:10:29 +01:00
Joakim PlateandGitHub c576a68d33 Upgrade pytest-aiohttp (#82475)
* Upgrade pytest-aiohttp

* Make sure executors, tasks and timers are closed

Some test will trigger warnings on garbage collect, these warnings
spills over into next test.

Some test trigger tasks that raise errors on shutdown, these spill
over into next test.

This is to mimic older pytest-aiohttp and it's behaviour on test
cleanup.

Discussions on similar changes for pytest-aiohttp are here:
https://github.com/pytest-dev/pytest-asyncio/pull/309

* Replace loop with event_loop

* Make sure time is frozen for tests

* Make sure the ConditionType is not async

  /home-assistant/homeassistant/helpers/template.py:2082: RuntimeWarning: coroutine 'AsyncMockMixin._execute_mock_call' was never awaited
    def wrapper(*args, **kwargs):
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

* Increase litejet press tests with a factor 10

The times are simulated anyway, and we can't stop the normal
event from occuring.

* Use async handlers for aiohttp

tests/components/motioneye/test_camera.py::test_get_still_image_from_camera
tests/components/motioneye/test_camera.py::test_get_still_image_from_camera
tests/components/motioneye/test_camera.py::test_get_stream_from_camera
tests/components/motioneye/test_camera.py::test_get_stream_from_camera
tests/components/motioneye/test_camera.py::test_camera_option_stream_url_template
tests/components/motioneye/test_camera.py::test_camera_option_stream_url_template
  /Users/joakim/src/hass/home-assistant/venv/lib/python3.9/site-packages/aiohttp/web_urldispatcher.py:189: DeprecationWarning: Bare functions are deprecated, use async ones
    warnings.warn(

* Switch to freezegun in modbus tests

The tests allowed clock to tick in between steps

* Make sure skybell object are fully mocked

Old tests would trigger attempts to post to could services:

```
DEBUG:aioskybell:HTTP post https://cloud.myskybell.com/api/v3/login/ Request with headers: {'content-type': 'application/json', 'accept': '*/*', 'x-skybell-app-id': 'd2b542c7-a7e4-4e1e-b77d-2b76911c7c46', 'x-skybell-client-id': '1f36a3c0-6dee-4997-a6db-4e1c67338e57'}
```

* Fix sorting that broke after rebase
2022-11-29 22:36:36 +01:00
Franck NijhofandGitHub 7cd68381f1 Search/replace RESULT_TYPE_* by FlowResultType enum (#74642) 2022-07-07 19:57:36 +03:00
J. Nick KostonandGitHub 211e5432ac Add EVENT_USER_UPDATED (#71965) 2022-06-09 20:49:02 -07:00
Paulus SchoutsenandGitHub 914f7f85ec Add local only users (#57598) 2021-11-29 14:01:03 -08:00
Paulus SchoutsenandGitHub ffbe4cffae Guard linking credential that is already linked (#57595)
* Guard linking credential that is already linked

* Update test descriptions
2021-10-13 17:36:31 +02:00
Paulus SchoutsenandGitHub 0ae1186554 Use gather ipv wait to remove credentials to catch exceptions (#57596) 2021-10-13 17:34:57 +02:00
7f966613bd Disconnect websockets after token is revoked (#57091)
Co-authored-by: Paulus Schoutsen <[email protected]>
2021-10-08 09:38:22 -07:00
Ruslan SayfutdinovandGitHub 7195b8222b Bump PyJWT to 2.1.0 (#55911) 2021-09-07 20:59:02 -07:00
Ville SkyttäandGitHub 9864f2ef8b String formatting cleanups (#52937) 2021-07-13 00:12:55 +02:00
Joakim SørensenandGitHub c8755cd896 Migrate the name for the hassio user (#51771) 2021-06-14 09:01:18 -07:00
Franck NijhofandGitHub ad13a9295e Merge multiple context managers in tests (#48146) 2021-03-27 09:17:15 +01:00
38d2cacf7a Support blocking trusted network from new ip (#44630)
Co-authored-by: Paulus Schoutsen <[email protected]>
2021-01-28 12:06:20 +01:00
Franck NijhofandGitHub 65cf2fcb6f Drop asynctest (#44746) 2021-01-01 22:31:56 +01:00
Paulus SchoutsenandGitHub 2af984917e Use asynctest-mock in most places (#35109)
* Use asynctest-mock in most places

* Fix broken patch in pilight
2020-05-03 11:27:19 -07:00
Bram KragtenandGitHub 952aa02e37 Add ability to specify group when creating user (#33373)
* Add abbility to specify group when creating user

* Fix tests

* Not default admin and tests
2020-03-30 20:33:43 +02:00
Franck NijhofandGitHub 0173c61fee Spelling: Config(uration) (#31782) 2020-02-13 08:27:00 -08:00
Christian ClaussandGitHub df7d2b3aeb Fix typos found by codespell (#31243)
* Fix typos found by codespell

* Fix typos found by codespell

* codespell: Furture  ==> Future

* Update test_config_flow.py

* Update __init__.py

* Spellcheck: successfull  ==> successful

* Codespell: unsuccesful  ==> unsuccessful

* Codespell: cant  ==> can't

* Codespell: firware ==> firmware

* Codespell: mimick  ==> mimic
2020-01-31 08:33:00 -08:00
Ville SkyttäandGitHub 5216477353 Be consistent with Home Assistant and Hass.io spelling (#30500)
* Be consistent with Home Assistant spelling

* Be consistent with Hass.io spelling
2020-01-05 14:09:17 +02:00
Bas NijholtandFranck Nijhof f60125b5c9 Sort imports according to PEP8 for 'tests' (#29791) 2019-12-09 16:52:24 +01:00
Paulus Schoutsen 4de97abc3a Black 2019-07-31 12:25:30 -07:00
Paulus SchoutsenandGitHub d2b62840f2 Add users added via credentials to admin group too (#18922)
* Add users added via credentials to admin group too

* Update test_init.py
2018-12-03 11:34:01 +01:00
Paulus SchoutsenandGitHub 61f7a39748 Add permissions foundation (#16890)
* Add permission foundation

* Address comments

* typing

* False > True

* Convert more lambdas

* Use constants

* Remove support for False

* Fix only allow True
2018-10-11 19:24:25 +02:00
Paulus SchoutsenandPascal Vizeli 61bf4d8a29 Add user events (#17328) 2018-10-11 17:06:51 +02:00
Jason HuandPaulus Schoutsen 7a77951bb4 Add Notify MFA module (#16314)
* Add Notify MFA

* Fix unit test

* Address review comment, change storage implementation

* Add retry limit to mfa module

* Fix loading

* Fix invalaid login log processing

* Typing

* Change default message template

* Change one-time password to 8 digit

* Refactoring to not save secret

* Bug fixing

* Change async_initialize method name to aysnc_initialize_login_mfa_step

* Address some simple fix code review comment
2018-09-24 11:06:50 +02:00
Jason HuandPaulus Schoutsen ff78a5b04b Track refresh token last usage information (#16408)
* Extend refresh_token to support last_used_at and last_used_by

* Address code review comment

* Remove unused code

* Add it to websocket response

* Fix typing
2018-09-12 13:24:16 +02:00
Jason HuandPaulus Schoutsen 9583947012 Long-lived access token (#16453)
* Allow create refresh_token with specific access_token_expiration

* Add token_type, client_name and client_icon

* Add unit test

* Add websocket API to create long-lived access token

* Allow URL use as client_id for long-lived access token

* Remove mutate_refresh_token method

* Use client name as id for long_lived_access_token type refresh token

* Minor change

* Do not allow duplicate client name

* Update docstring

* Remove unnecessary `list`
2018-09-11 12:05:15 +02:00
Jason HuandPaulus Schoutsen 563588651c Tweak MFA login flow (#16254)
* Tweak MFA login flow

* Fix typo
2018-08-29 10:16:54 +02:00
Jason HuandPaulus Schoutsen 257b8b9b80 Blow up startup if init auth providers or modules failed (#16240)
* Blow up startup if init auth providers or modules failed

* Delete core.entity_registry
2018-08-28 20:54:01 +02:00
Jason HuandPaulus Schoutsen 7e7f9bc6ac Add multi-factor authentication modules (#15489)
* Get user after login flow finished

* Add multi factor authentication support

* Typings
2018-08-22 09:52:34 +02:00
Paulus SchoutsenandJason Hu cdb8361050 Add support for revoking refresh tokens (#16095)
* Add support for revoking refresh tokens

* Lint

* Split revoke logic in own method

* Simplify

* Update docs
2018-08-21 11:02:55 -07:00
Jason HuandPaulus Schoutsen f84a31871e Get user after login flow finished (#16047)
* Get user after login flow finished

* Add optional parameter 'type' to /auth/login_flow

* Update __init__.py
2018-08-21 10:18:04 +02:00
Paulus SchoutsenandGitHub e776f88eec Use JWT for access tokens (#15972)
* Use JWT for access tokens

* Update requirements

* Improvements
2018-08-14 21:14:12 +02:00
Paulus SchoutsenandGitHub 864a254071 Aware comments (#15480)
* Make sure we cannot deactivate the owner

* Use different error code when trying to fetch token for inactive user
2018-07-15 23:09:05 +02:00
Paulus SchoutsenandGitHub ed0cfc4f31 Add user via cmd line creates owner (#15470)
* Add user via cmd line creates owner

* Ensure access tokens are not verified for inactive users

* Stale print

* Lint
2018-07-15 20:46:15 +02:00
Paulus SchoutsenandGitHub 70fe463ef0 User management (#15420)
* User management

* Lint

* Fix dict

* Reuse data instance

* OrderedDict all the way
2018-07-13 15:31:20 +02:00
Paulus SchoutsenandGitHub b6ca03ce47 Reorg auth (#15443) 2018-07-13 11:43:08 +02:00