Commit Graph

45 Commits (6d9f1b3fd3ab964ef6815117b1a23237290ead6c)

Author SHA1 Message Date
Paulus Schoutsen 6f903db8c4
Fix cors on the index view (#24283) 2019-06-03 11:43:13 -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
Paul Bottein 4d9cf15c45 Fix authorization header in cors (#21662)
* Fix authorization headers in cors

* Use aiohttp authorization header instead of custom const
2019-03-09 10:00:10 -08:00
Louis Matthijssen d39784906b Fix HTTP login attempts check triggering too late (#20431) 2019-01-26 03:13:44 +01:00
Andrew Sayre bb21cb6c89 Remove trailing slash from base_url and added ability to generate webhook path. (#20295) 2019-01-21 20:50:41 +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 d014517ce2
Always set hass_user (#18844) 2018-11-30 17:32:47 +01:00
Paulus Schoutsen a2386f871d Forbid float NaN in JSON (#18757) 2018-11-28 13:25:23 +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
Paulus Schoutsen 1341ecd2eb
Use proper signals (#18613)
* Emulated Hue not use deprecated handler

* Remove no longer needed workaround

* Add middleware directly

* Dont always load the ban config file

* Update homeassistant/components/http/ban.py

Co-Authored-By: balloob <paulus@home-assistant.io>

* Update __init__.py
2018-11-21 20:55:21 +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
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
Ville Skyttä dbd0763f83 Grammar and spelling fixes (#16065) 2018-08-19 22:29:08 +02:00
Paulus Schoutsen e776f88eec
Use JWT for access tokens (#15972)
* Use JWT for access tokens

* Update requirements

* Improvements
2018-08-14 21:14:12 +02:00
Paulus Schoutsen 6540d2e073
Switch to intermediate Mozilla cert profile (#15957)
* Allow choosing intermediate SSL profile

* Fix tests
2018-08-14 08:20:17 +02:00
Jason Hu 272be7cdae Remove remote.API from core.Config (#15951)
* Use core.ApiConfig replace remote.API in core.Config

* Move ApiConfig to http
2018-08-13 09:26:20 +02:00
Jason Hu 6f2000f5e2 Make sure use_x_forward_for and trusted_proxies must config together (#15804)
* Make sure use_x_forward_for and trusted_proxies must config together

* Fix unit test
2018-08-03 13:52:34 +02:00
Paulus Schoutsen 169c8d793a
Fix CORS duplicate registration (#15670) 2018-07-25 11:36:44 +02:00
Jason Hu f1286f8e6b Reset failed login attempts counter when login success (#15564) 2018-07-20 12:09:48 +02:00
Paulus Schoutsen 2a76a0852f
Allow CORS requests to token endpoint (#15519)
* Allow CORS requests to token endpoint

* Tests

* Fuck emulated hue

* Clean up

* Only cors existing methods
2018-07-19 08:37:00 +02:00
Paulus Schoutsen 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 Schoutsen b6ca03ce47
Reorg auth (#15443) 2018-07-13 11:43:08 +02:00
Jason Hu f874efb224 By default to use access_token if hass.auth.active (#15212)
* Force to use access_token if hass.auth.active

* Not allow Basic auth with api_password if hass.auth.active

* Block websocket api_password auth when hass.auth.active

* Add legacy_api_password auth provider

* lint

* lint
2018-06-30 22:31:36 -04:00
Colin O'Dell fd38caa287 X-Forwarded-For improvements and bug fixes (#15204)
* Use new trusted_proxies setting for X-Forwarded-For whitelist

* Only use the last IP in the header

Per Wikipedia (https://en.wikipedia.org/wiki/X-Forwarded-For#Format):

 > The last IP address is always the IP address that connects to the last proxy,
 > which means it is the most reliable source of information.

* Add two additional tests

* Ignore nonsense header values instead of failing
2018-06-29 16:27:06 -04:00
Colin O'Dell 19f2bbf52f Only use the X-Forwarded-For header if connection is from a trusted network (#15182)
See https://github.com/home-assistant/home-assistant/issues/14345#issuecomment-400854569
2018-06-28 09:16:11 -04:00
Paulus Schoutsen cdd45e7878 Foundation for users (#13968)
* Add initial user foundation to Home Assistant

* Address comments

* Address comments

* Allow non-ascii passwords

* One more utf-8 hmac compare digest

* Add new line
2018-05-01 18:20:41 +02:00
Paulus Schoutsen 89a19c89a7 Fix aiohttp deprecation warnings (#13240)
* Fix aiohttp deprecation warnings

* Fix Ring deprecation warning

* Lint
2018-03-15 21:49:49 +01:00
Paulus Schoutsen 0a2e949e0a Remove crazy JSON encoding things that are no longer used (#13029)
Catch JSON encoding errors in HTTP view
2018-03-12 23:22:08 +01:00
Boyi C 321eb2ec6f Move HomeAssistantView to separate file. Convert http to async syntax. [skip ci] (#12982)
* Move HomeAssistantView to separate file. Convert http to async syntax.

* pylint

* websocket api

* update emulated_hue for async/await

* Lint
2018-03-08 17:51:49 -08:00
Paulus Schoutsen f32911d036 Cleanup http (#12424)
* Clean up HTTP component

* Clean up HTTP mock

* Remove unused import

* Fix test

* Lint
2018-02-15 22:06:14 +01:00
Paulus Schoutsen 78c44180f4 Extract data validator to own file and add tests (#12401) 2018-02-14 21:06:03 +01:00
Pascal Vizeli a9a3e24bde Update aiohttp to 2.3.1 (#10139)
* Update aiohttp to 2.3.1

* set timeout 10sec

* fix freeze with new middleware handling

* Convert middleware auth

* Convert mittleware ipban

* convert middleware static

* fix lint

* Update ban.py

* Update auth.py

* fix lint

* Fix tests
2017-11-05 18:42:31 -08:00
Fabian Affolter de9d19d6f4 Use constants for HTTP headers (#10313)
* Use constants for HTTP headers

* Fix ordering

* Move 'no-cache' to platform
2017-11-04 12:04:05 -07:00
Paulus Schoutsen 6fb55b363a Add OwnTracks over HTTP (#9582)
* Add OwnTracks over HTTP

* Fix tests
2017-09-28 09:49:35 +02:00
Paulus Schoutsen d369d70ca5 Fix tests (#7659)
* Remove global hass

* Http.auth test no longer spin up server

* Remove server usage from http.ban test

* Remove setupModule from test device_sun_light_trigger

* Update common.py
2017-05-19 07:37:39 -07:00
Paulus Schoutsen 2650c73a89 Split bootstrap into bs + setup (#6416)
* Split bootstrap into bs + setup

* Lint
2017-03-05 10:41:54 +01:00
Pascal Vizeli 41f558b181 Bootstrap / Component setup async (#6264)
* Bootstrap / Entiy setup async

* Cleanup add_job stuff / return task/future object

* Address paulus comments / part 1

* fix install pip

* Cleanup bootstrap / move config stuff to config.py

* Make demo async

* Further bootstrap improvement

* Address Martin's comments

* Fix initial tests

* Fix final tests

* Fix bug with prepare loader

* Remove no longer needed things

* Log error when invalid config

* More cleanup

* Cleanups platform events & fix lint

* Use a non blocking add_entities callback for platform

* Fix Autoamtion is setup befor entity is ready

* Better automation fix

* Address paulus comments

* Typo

* fix lint

* rename functions

* fix tests

* fix test

* change exceptions

* fix spell
2017-02-28 20:33:19 -08:00
Paulus Schoutsen d6818c7015 Fix reporting on bad login (#6201) 2017-02-24 16:33:58 -08:00
Johann Kellerman f0b1874d2d Fix up docstring for tests (#5090) 2016-12-28 20:04:59 +02:00
Paulus Schoutsen ed0d14c902 Base url: Fix external port different from internal port (#4990)
* Base url: Fix external port different from internal port

* Add base_url example to new config
2016-12-18 14:59:45 -08:00
Paulus Schoutsen f8af6e7863 Allow setting base url (#4985) 2016-12-18 12:56:07 -08:00
Paulus Schoutsen 1b35f0878e Fix CORS when static resources registered (#4727) 2016-12-04 10:57:24 -08:00
Paulus Schoutsen 0d734303a4 HTTP: Fix registering views after start (#4604) 2016-11-27 14:01:12 -08:00
Paulus Schoutsen 32ffd006fa Reorganize HTTP component (#4575)
* Move HTTP to own folder

* Break HTTP into middlewares

* Lint

* Split tests per middleware

* Clean up HTTP tests

* Make HomeAssistantViews more stateless

* Lint

* Make HTTP setup async
2016-11-25 13:04:06 -08:00