Philip Allgaier
bf4e6a289a
Add option to deactivate a user ( #43463 )
2020-11-27 09:13:16 +01:00
springstan
92379ad8d2
Use list literal without using dict.keys() ( #42573 )
2020-10-30 09:19:13 -05:00
Philip Allgaier
625bbe6238
Cleanup unused loggers (components A-M) ( #41600 )
2020-10-12 16:59:05 +02:00
Ville Skyttä
6ae9399237
Upgrade isort to 5.4.2 ( #37939 )
2020-08-29 08:23:55 +02:00
Ville Skyttä
1bf2c4d976
Upgrade pylint to 2.6.0 ( #39363 )
2020-08-29 07:59:24 +02:00
Ville Skyttä
b4bac0f7a0
Exception chaining and wrapping improvements ( #39320 )
...
* Remove unnecessary exception re-wraps
* Preserve exception chains on re-raise
We slap "from cause" to almost all possible cases here. In some cases it
could conceivably be better to do "from None" if we really want to hide
the cause. However those should be in the minority, and "from cause"
should be an improvement over the corresponding raise without a "from"
in all cases anyway.
The only case where we raise from None here is in plex, where the
exception for an original invalid SSL cert is not the root cause for
failure to validate a newly fetched one.
Follow local convention on exception variable names if there is a
consistent one, otherwise `err` to match with majority of codebase.
* Fix mistaken re-wrap in homematicip_cloud/hap.py
Missed the difference between HmipConnectionError and
HmipcConnectionError.
* Do not hide original error on plex new cert validation error
Original is not the cause for the new one, but showing old in the
traceback is useful nevertheless.
2020-08-28 13:50:32 +02:00
Franck Nijhof
1c2ebdf307
Upgrade black to 20.8b1 ( #39287 )
2020-08-27 13:56:20 +02:00
Paulus Schoutsen
9979e465aa
Fix hassio auth data ( #39244 )
...
Co-authored-by: Pascal Vizeli <pvizeli@syshack.ch>
2020-08-25 14:22:50 +02:00
Paulus Schoutsen
13df3bce1b
Allow owner users to change password of any user ( #39242 )
2020-08-25 13:49:32 +02:00
Ville Skyttä
ac0dbb17af
Attrs cleanups ( #37849 )
2020-07-14 10:30:30 -07:00
Paulus Schoutsen
8ed1a29c82
Drop white blacklist pt1 ( #37816 )
2020-07-13 17:43:11 +02:00
Franck Nijhof
53545c984b
Log lines do not end with a full stop ( #37527 )
2020-07-05 23:04:19 +02:00
Ville Skyttä
0c5ca3084e
Add and fix type hints ( #36501 )
...
* Fix exceptions.Unauthorized.permission type
* Use auth.permission consts more
* Auth typing improvements
* Helpers typing improvements
* Calculate self.state only once
2020-06-06 20:34:56 +02:00
Ville Skyttä
b4404b071f
Pylint cleanups ( #35409 )
...
* Avoid some outer name redefinitions
* Remove unneeded directives
* Narrow directive scope
* Don't disable redefined-variable-type
2020-05-09 14:08:40 +03:00
springstan
b2af1de273
Improve string formatting v9 ( #34050 )
...
* Improve string formatting v9
* Address review comments
2020-04-12 17:18:09 +02:00
springstan
46bbe816f6
Remove None from dict.get(key, None) ( #33794 )
2020-04-07 21:06:05 +02:00
Franck Nijhof
7653dc947a
Enable pylint unnecessary-pass ( #33650 )
...
* Enable pylint unnecessary-pass
* Process review suggestions
* Fix smhi tests
2020-04-05 10:33:07 +02:00
Franck Nijhof
b9b1cee403
Enable pylint import-outside-toplevel ( #33631 )
2020-04-04 17:07:36 +02:00
Bram Kragten
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
Ville Skyttä
ffc9bcb4d7
Use PEP 526 syntax with NamedTuples ( #33081 )
2020-03-21 11:18:32 +02:00
springstan
744ae82933
Replace cmp option with eq and order ( #31423 )
2020-02-02 20:28:52 -08:00
Christian Clauss
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ä
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
Jc2k
fdfedd086b
Rework FlowManager to use inheritance ( #30133 )
...
* Pull async_finish_flow/async_create_flow out of ConfigEntries
* Towards refactoring
* mypy fixes
* Mark Flow manager with abc.* annotations
* Flake8 fixes
* Mypy fixes
* Blacken data_entry_flow
* Blacken longer signatures caused by mypy changes
* test fixes
* Test fixes
* Fix typo
* Avoid protected member lint (W0212) in config_entries
* More protected member fixes
* Missing await
2020-01-03 11:52:01 +01:00
Ville Skyttä
e6388e186c
Remove unnecessary string literal concatenations ( #30360 )
2020-01-02 21:17:10 +02:00
Ville Skyttä
130571c478
Remove no longer needed auth.util, use secrets instead ( #29861 )
2019-12-12 16:46:33 +01:00
Bas Nijholt
67c56c860d
Sort imports according to PEP8 for 'homeassistant' folder ( #29789 )
...
Components are already done
2019-12-09 16:42:10 +01:00
Ville Skyttä
99c7608fb4
Lint config cleanups ( #28864 )
...
* Remove bunch of unneeded lint exclusions
* Use symbolic names instead of identifiers in pylint disables
* Tighten scope of some pylint disables
2019-11-25 22:40:08 -08:00
Ville Skyttä
d88ca0f5cb
Lint exclusions ( #28655 )
...
* Remove malformed pylint disable markers
* Remove some unused imports
* Remove some unneeded lint exclusions
* Remove more unneeded lint exclusions
* Add specific codes to all noqa's
2019-11-16 10:22:07 +01:00
Paulus Schoutsen
79ac77a93d
Almond integration ( #28282 )
...
* Initial Almond integration
* Hassfest
* Update library
* Address comments
* Fix inheritance issue py36
* Remove no longer needed check
* Fix time
2019-10-28 23:47:31 -07:00
Franck Nijhof
04ab20846a
Bump black to 19.10b0 ( #28310 )
2019-10-28 23:32:34 -07:00
Ville Skyttä
381d423fec
Upgrade mypy to 0.740 ( #27913 )
...
* Upgrade mypy to 0.740
http://mypy-lang.blogspot.com/2019/10/mypy-0740-released.html
* Type hint additions
* Type fixes
* Remove no longer needed type ignores and casts
* Disable untyped definition checks in bunch of files
2019-10-19 11:35:57 -07:00
Paulus Schoutsen
3231e22ddf
Remove direct authentication via trusted networks or API password ( #27656 )
...
* Remove direct authentication via trusted networks and API password
* Fix tests
2019-10-14 14:56:45 -07:00
Ville Skyttä
fde128d66c
Upgrade mypy to 0.730, address raised issues ( #26959 )
...
https://mypy-lang.blogspot.com/2019/09/mypy-730-released.html
2019-09-27 22:57:59 +03:00
Franck Nijhof
8a9e47d3c7
Bump pyotp to 2.3.0 ( #26849 )
2019-09-23 15:43:48 +02:00
Ville Skyttä
33e1b44b3a
Use PEP 526 type annotations, add some type hints ( #26464 )
...
* Add some more type hints to helpers.event
* Change most type comments to variable types
* Remove some superfluous type hints
2019-09-07 09:48:58 +03:00
Franck Nijhof
2f0eb07624
Migrate legacy typehints in core to PEP-526 ( #26403 )
...
* Migrate legacy typehints in core to PEP-526
* Fix one type
2019-09-03 20:36:04 -07:00
Franck Nijhof
decf13b948
Use literal string interpolation in core (f-strings) ( #26166 )
2019-08-23 09:53:33 -07:00
Paulus Schoutsen
57ef721d5d
Hue tweak registered device type + discovery exception ( #25977 )
...
* Include location name in create user
* Guard against no host in context
* Fix tests and typing
2019-08-16 16:19:00 -07:00
Ville Skyttä
b738082dad
Type check various base components ( #25878 )
...
* Type check various component base classes, disabling bunch of checks for now
* Type hint fixes
* Help mypy out some
* Add more type hints
2019-08-11 20:38:18 -07:00
Joakim Plate
d1b9ebc7b2
Integration requirement check refactor ( #25626 )
...
* Factor out code getting requirements for integration
* Have process requirements raise an exception
* One more lint fix
* Blackify
* Catch new exception
* Let RequirementsNotFound be a HomeAssistantError
* Correct another test
* Split catching of exceptions and avoid complete log
2019-08-07 15:35:50 -07:00
Paulus Schoutsen
620cb74050
Type
2019-07-31 13:08:31 -07:00
Paulus Schoutsen
0ccffc3e55
Lint
2019-07-31 12:46:17 -07:00
Paulus Schoutsen
4de97abc3a
Black
2019-07-31 12:25:30 -07:00
Ville Skyttä
e8e84fb764
Type check homeassistant.scripts ( #25464 )
...
* Run mypy on homeassistant.scripts, disabling bunch of checks for now
* Declare async_initialize in AuthProvider
* Add some type hints
* Remove unreachable code
* Help mypy out
* Script docstring fixes
2019-07-24 13:18:40 -07:00
Ville Skyttä
17d754dbbf
Optional and Union simplifications ( #25365 )
2019-07-21 10:59:51 -07:00
nierob
979f801488
Avoid creating temporary lists ( #25317 )
...
That gives nano performance improvements as *() is slightly faster
then *[].
2019-07-19 13:36:18 -07:00
Ville Skyttä
a6eef22fbc
Upgrade mypy to 0.710 ( #24666 )
...
* Upgrade mypy to 0.710
* Address mypy 0.710 errors
2019-06-22 10:19:36 +03:00
Paulus Schoutsen
5b0ee473b6
Add get_states faster ( #23315 )
2019-04-23 12:46:22 +02:00
Josef Schlehofer
3b0660ae89
Upgrade pyotp to 2.2.7 ( #23274 )
2019-04-21 09:03:17 +02:00
Jason Hu
6ba2891604
Add trusted_users in trusted networks auth provider ( #22478 )
2019-03-27 21:53:11 -07:00
Paulus Schoutsen
4f5446ff02
Add area permission check ( #21835 )
2019-03-11 11:02:37 -07:00
Jason Hu
fe1840f901
Deprecate http.api_password ( #21884 )
...
* Deprecated http.api_password
* Deprecated ApiConfig.api_password
GitHub Drafted PR would trigger CI after changed it to normal PR.
I have to commit a comment change to trigger it
* Trigger CI
* Adjust if- elif chain in auth middleware
2019-03-10 19:55:36 -07:00
Paulus Schoutsen
5b2c6648fb
Add user group ( #21832 )
...
* Add user group
* Rename system group to plural
2019-03-09 20:07:29 -08:00
Jason Hu
3d8673dbf8
Resolve auth_store loading race condition ( #21794 )
...
* Add lock in auth_store._async_load()
* Python 3.5 does not like assert_called_once()
2019-03-08 14:50:24 -08:00
Jason Hu
4a3b4cf346
Resolve race condition when HA auth provider is loading ( #21619 )
...
* Resolve race condition when HA auth provider is loading
* Fix
* Add more tests
* Lint
2019-03-04 15:55:26 -08:00
Daniel Høyer Iversen
519315f9c8
pylint 2.3.0 ( #21485 )
...
* pylint 2.3.0
* remove const
* disable=syntax-error
2019-02-27 16:10:40 -05:00
Jason Hu
7bae76843c
Add config for trusted networks auth provider ( #21111 )
...
* Add config for trusted networks auth provider
* Lint
* Fix typing
* Fix pylint
* Fix lint
* Add some log information
* Add http.trusted_networks deprecated warning
* Remove log info
* Lint
2019-02-26 14:42:48 -08:00
Robert Schindler
06f3e8137a
Added command_line auth provider that validates credentials by calling a command ( #19985 )
...
* Added external auth provider that calls a configurable program
Closes #19975
* Raise proper InvalidAuth exception on OSError during program execution
* Changed name of external auth provider to command_line
* Renamed program config option to command in command_line auth provider
* Made meta variable parsing in command_line auth provider optional
* Added tests for command_line auth provider
* Fixed indentation
* Suppressed wrong pylint warning
* Fixed linting
* Added test for command line auth provider login flow
* Log error when user fails authentication
* Use %r formatter instead of explicit repr()
* Mix all used names of typing module into module namespace
I consider this nasty and bad coding style, but was requested by
@awarecan for consistency with the remaining codebase.
* Small code style change
* Strip usernames with command_line auth provider
2019-02-06 16:36:41 -08:00
Paulus Schoutsen
73a0c664b8
Allow usernames to be case-insensitive ( #20558 )
...
* Allow usernames to be case-insensitive
* Fix typing
* FLAKE*
2019-01-29 08:28:52 +01:00
Paulus Schoutsen
84a2e5d8fb
Strip login username in backend ( #20150 )
...
* Add modern mode to HA auth provider that strips usernames
* Add tests for async_get_or_create_credentials
* Fix test
2019-01-16 15:03:05 -08:00
Paulus Schoutsen
90df932fe1
Check admin permission before able to manage config entries
2018-12-13 16:13:43 +01:00
Paulus Schoutsen
3928d034a3
Allow checking entity permissions based on devices ( #19007 )
...
* Allow checking entity permissions based on devices
* Fix tests
2018-12-05 11:41:00 +01:00
Matt Hamilton
38b09b1613
Remove stale user salts code ( #19004 )
...
user['salt'] was originally used as a part of the pbkdf2 implementation.
I failed to remove this as a part of the cleanup in #18736 .
2018-12-04 14:39:43 +01:00
Paulus Schoutsen
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 Schoutsen
d1a621601d
No more opt-out auth ( #18854 )
...
* No more opt-out auth
* Fix var
2018-12-02 16:32:53 +01:00
Paulus Schoutsen
df21dd21f2
RFC: Call services directly ( #18720 )
...
* Call services directly
* Simplify
* Type
* Lint
* Update name
* Fix tests
* Catch exceptions in HTTP view
* Lint
* Handle ServiceNotFound in API endpoints that call services
* Type
* Don't crash recorder on non-JSON serializable objects
2018-11-30 21:28:35 +01:00
Paulus Schoutsen
28215d7edd
Make auth backwards compat again ( #18792 )
...
* Made auth not backwards compat
* Fix tests
2018-11-29 22:26:19 +01:00
Matt Hamilton
4f2e7fc912
remove pbkdf2 upgrade path ( #18736 )
2018-11-27 10:42:56 +01:00
Paulus Schoutsen
c2f8dfcb9f
Legacy api fix ( #18733 )
...
* Set user for API password requests
* Fix tests
* Fix typing
2018-11-27 10:41:44 +01:00
Ville Skyttä
7248c9cb0e
Remove some unused imports ( #18732 )
2018-11-27 09:35:35 +01:00
Paulus Schoutsen
8b8629a5f4
Add permission checks to Rest API ( #18639 )
...
* Add permission checks to Rest API
* Clean up unnecessary method
* Remove all the tuple stuff from entity check
* Simplify perms
* Correct param name for owner permission
* Hass.io make/update user to be admin
* Types
2018-11-25 18:04:48 +01:00
Paulus Schoutsen
36c31a6293
Add permissions check in service helper ( #18596 )
...
* Add permissions check in service helper
* Lint
* Fix tests
* Lint
* Typing
* Fix unused impoert
2018-11-21 12:26:08 +01:00
Paulus Schoutsen
f7f0a4e811
System groups ( #18303 )
...
* Add read only and admin policies
* Migrate to 2 system groups
* Add system groups
* Add system groups admin & read only
* Dont' mutate parameters
* Fix types
2018-11-08 12:57:00 +01:00
Paulus Schoutsen
f4ac317d64
Permissions improv ( #17811 )
...
* Break up permissions file.
* Granular entity permissions
* Add "all" entity permission
* Lint
* Fix types
2018-10-29 11:28:04 +01:00
Paulus Schoutsen
312d49caec
Allow creating signed urls ( #17759 )
...
* Allow creating signed urls
* Fix parameter
* Lint
2018-10-25 16:44:57 +02:00
Paulus Schoutsen
08fe7c3ece
Pytest tests ( #17750 )
...
* Convert core tests
* Convert component tests to use pytest assert
* Lint 🤷♂️
* Fix test
* Fix 3 typos in docs
2018-10-24 12:10:05 +02:00
Paulus Schoutsen
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 Schoutsen
61bf4d8a29
Add user events ( #17328 )
2018-10-11 17:06:51 +02:00
Paulus Schoutsen
c3b1121d77
Add group foundation ( #16935 )
...
Add group foundation
2018-10-08 16:35:38 +02:00
Paulus Schoutsen
a559c06d6b
Make it easier for auth to consume newer formats ( #17127 )
2018-10-04 10:41:13 +02:00
Nicko van Someren
e5861241c7
Added support for private storage. ( #16878 )
...
* Addded support for private storage.
Include 'private' flag parameters to the Store class and save_json function.
Updated various authentication and onboarding classes to use private stores.
Fixed unit test for emulated_hue which used a mock patch on save_json().
* Fixed Hound formatting issues not detected by local linting.
2018-09-26 10:24:32 +02:00
Jason Hu
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 Hu
34deaf8849
Add valid_window=1 to TOTP verify ( #16625 )
2018-09-15 13:28:25 +02:00
Jason Hu
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
Paulus Schoutsen
4e3faf6108
Fix typo ( #16556 )
2018-09-11 12:55:05 +02:00
Jason Hu
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
Paulus Schoutsen
e7b8d2e6df
Update name legacy api password ( #16455 )
2018-09-08 22:10:42 +02:00
Jason Hu
563588651c
Tweak MFA login flow ( #16254 )
...
* Tweak MFA login flow
* Fix typo
2018-08-29 10:16:54 +02:00
Jason Hu
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 Hu
67df162bcc
Change log level to error when auth provider failed loading ( #16235 )
2018-08-28 11:23:58 +02:00
Paulus Schoutsen
5397c0d73a
Update trusted networks flow ( #16227 )
...
* Update the trusted networks flow
* Fix tests
* Remove errors
2018-08-28 00:37:15 +02:00
Matt Hamilton
bacecb4249
Replace pbkdf2 with bcrypt ( #16071 )
...
* Replace pbkdf2 with bcrypt
bcrypt isn't inherently better than pbkdf2, but everything "just works"
out of the box.
* the hash verification routine now only computes one hash per call
* a per-user salt is built into the hash as opposed to the current
global salt
* bcrypt.checkpw() is immune to timing attacks regardless of input
* hash strength is a function of real time benchmarks and a
"difficulty" level, meaning we won't have to ever update the iteration
count
* WIP: add hash upgrade mechanism
* WIP: clarify decode issue
* remove stale testing code
* Fix test
* Ensure incorrect legacy passwords fail
* Add better invalid legacy password test
* Lint
* Run tests in async scope
2018-08-26 22:50:31 +02:00
Jason Hu
47755fb1e9
Add Time-based Onetime Password Multi-factor Authentication Module ( #16129 )
...
* Add Time-based Onetime Password Multi-factor Auth
Add TOTP setup flow, generate QR code
* Resolve rebase issue
* Use svg instead png for QR code
* Lint and typing
* Fix translation
* Load totp auth module by default
* use <svg> tag instead markdown image
* Update strings
* Cleanup
2018-08-26 22:38:52 +02:00
Jason Hu
e8775ba2b4
Add multi-factor auth module setup flow ( #16141 )
...
* Add mfa setup flow
* Lint
* Address code review comment
* Fix unit test
* Add assertion for WS response ordering
* Missed a return
* Remove setup_schema from MFA base class
* Move auth.util.validate_current_user -> webscoket_api.ws_require_user
2018-08-24 10:17:43 -07:00
Ville Skyttä
dd9d53c83e
Update pydocstyle to 2.1.1 and flake8-docstrings to 1.3.0 ( #14557 )
...
* Update pydocstyle to 2.1.1 and flake8-docstrings to 1.3.0
* Pydocstyle D401 fixes
2018-08-24 10:28:43 +02:00
Paulus Schoutsen
249981de96
Prevent legacy api password with empty password ( #16127 )
...
* Prevent legacy api password with empty password
* Typing
2018-08-23 12:56:01 +02:00
Jason Hu
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
Jason Hu
1ce51bfbd6
Refactoring login flow ( #16104 )
...
* Abstract LoginFlow
* Lint and typings
2018-08-21 11:03:38 -07:00
Paulus Schoutsen
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