Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.76.0 #16027

Merged
merged 119 commits into from
Aug 17, 2018
Merged

0.76.0 #16027

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
cf87b76
Upgrade Adafruit-DHT to 1.3.3 (#15706)
superpuffin Jul 30, 2018
3208ad2
Add kodi unique id based on discovery (#15093)
rytilahti Jul 30, 2018
1b2d0e7
Better handling of Yi camera being disconnected (#15754)
bachya Jul 31, 2018
eeb7947
Decouple login flow view and data entry flow view (#15715)
awarecan Jul 31, 2018
9513724
Fixed NDMS for latest firmware (#15511)
foxel Jul 31, 2018
8ee3b53
Add disallow_untyped_calls to mypy check. (#15661)
andrey-git Jul 31, 2018
5f214ff
Update pyozw to 0.4.9 (#15758)
turbokongen Jul 31, 2018
a4f9602
Convert wind speed to km/h (fixes #15710) (#15740)
fabaff Jul 31, 2018
03847e6
Round precipitation forecast to 1 decimal place (#15759)
priiduonu Jul 31, 2018
d902a9f
Add a "Reviewed by Hound" badge (#15767)
salbertson Jul 31, 2018
27401f4
Upgrade Mastodon.py to 1.3.1 (#15766)
fabaff Jul 31, 2018
95da41a
This component API has been decomissioned on the 31st of May 2018 by …
dgomes Jul 31, 2018
a11c2a0
Fix docstrings (#15770)
fabaff Jul 31, 2018
3445dc1
Update pynetgear to 0.4.1 (bugfixes) (#15768)
MatMaul Jul 31, 2018
0b6f2f5
Opensky altitude (#15273)
miawgogo Jul 31, 2018
623f6c8
Expose internal states and fixed on/off state of Dyson Fans (#15716)
soraxas Aug 1, 2018
f8a4789
deCONZ - support for power plugs (#15752)
Kane610 Aug 1, 2018
2ff5b4c
Add support for STATES of vacuums (#15573)
cnrd Aug 1, 2018
2e5131b
Add support for STATE_AUTO of generic_thermostat (#15678)
niklaswa Aug 1, 2018
589b23b
Revert "Add support for STATE_AUTO of generic_thermostat (#15678)" (#…
awarecan Aug 1, 2018
2f8d66e
RitAssist / FleetGO support (#15780)
Aug 2, 2018
bdea9e1
Add support for OpenUV binary sensors and sensors (#15769)
bachya Aug 2, 2018
7972d6a
Update translations
balloob Aug 2, 2018
eb5f6ef
Update frontend to 20180802.0
balloob Aug 2, 2018
48af511
Update pymediaroom to 0.6.4 (#15786)
dgomes Aug 2, 2018
38928c4
Fix Min/Max Kelvin color temp attribute for Google (#15697)
bryanyork Aug 2, 2018
affd4e7
Add Enphase Envoy component (#15081)
jesserizzo Aug 2, 2018
59f8a73
Return True from Nest setup (#15797)
balloob Aug 2, 2018
b63312f
Vacuum component: start_pause to individual start and pause commands.…
cnrd Aug 3, 2018
ee180c5
Bump frontend to 20180803.0
balloob Aug 3, 2018
6f2000f
Make sure use_x_forward_for and trusted_proxies must config together …
awarecan Aug 3, 2018
91e8680
Only report color temp when in the correct color mode (#15791)
Kane610 Aug 3, 2018
f6935b5
Upgrade voluptuous-serialize to 2.0.0 (#15763)
awarecan Aug 3, 2018
0c7d469
Bump frontend to 20180804.0
balloob Aug 4, 2018
3246b49
Upgrade pylint to 2.1.0 (#15811)
scop Aug 4, 2018
dbe44c0
Upgrade pytest to 3.7.1 and pytest-timeout to 1.3.1 (#15809)
scop Aug 4, 2018
c7a8f11
Fix rfxtrx device id matching (#15819)
Danielhiversen Aug 4, 2018
bfb9f2a
Fix lint with wrong frontend version inside requirements_all
pvizeli Aug 4, 2018
018bd85
Fix lint with wrong frontend version inside requirements_test_all
pvizeli Aug 4, 2018
bce47eb
Fix frontend requirements after bump (#15829)
MartinHjelmare Aug 4, 2018
9ea3be4
Upgrade voluptuous to 0.11.5 (#15830)
fabaff Aug 5, 2018
5e1836f
Add support for 2 Tahoma IO awning covers (#15660)
fucm Aug 5, 2018
8a81ee3
Velbus auto-discovery (#13742)
thomasdelaet Aug 5, 2018
c41aa12
Upgrade youtube_dl to 2018.08.04 (#15837)
fabaff Aug 5, 2018
b152bec
Add media_player.dlna_dmr component (#14749)
StevenLooman Aug 5, 2018
6a32b9b
Fix envisalink reconnect (#15832)
Cinntax Aug 5, 2018
9a84f8b
Remove 'volume' from return dict (#15842)
mattwing Aug 5, 2018
f86702e
Upgrade shodan to 1.9.0 (#15839)
fabaff Aug 5, 2018
ac4674f
Add max_gps_accuracy option to Google Maps (#15833)
PrimusNZ Aug 6, 2018
e4b2ae2
Fix bt_home_hub_5 device tracker (#15096)
ahobsonsayers Aug 6, 2018
12e6920
Change to call_service async_stop non-blocking to allow service call …
awarecan Aug 6, 2018
8ef2cfa
Try to fix coveralls unstable result (#15800)
awarecan Aug 6, 2018
9cfe0db
Add different pop 012501 ID (#15838)
turbokongen Aug 6, 2018
6031801
Fix error when Series missing 'episodeFileCount' or 'episodeCount' (#…
psike Aug 6, 2018
10a7acc
Merge branch 'master' into dev
balloob Aug 6, 2018
47fa928
Bumped version to 0.76.0.dev0
balloob Aug 6, 2018
6172147
Add facebox auth (#15439)
robmarkcole Aug 7, 2018
a7db2eb
Upgrade requests_mock to 1.5.2
fabaff Aug 7, 2018
cb20c9b
Revert "Upgrade requests_mock to 1.5.2"
fabaff Aug 7, 2018
51c3098
Upgrade holidays to 0.9.6 (#15831)
fabaff Aug 7, 2018
1d8678c
Upgrade pysnmp to 4.4.5 (#15854)
fabaff Aug 7, 2018
f09f153
Fix HomeKit test (#15860)
cdce8p Aug 7, 2018
d071df0
Do not make internet connection during tests (#15858)
balloob Aug 7, 2018
4cbcb4c
Upgrade pylint to 2.1.1 (#15872)
scop Aug 7, 2018
1fb2ea7
Upgrade asynctest to 0.12.2 (#15869)
fabaff Aug 7, 2018
d556eda
Upgrade Sphinx to 1.7.6 (#15868)
fabaff Aug 7, 2018
b6bc009
Upgrade requests_mock to 1.5.2 (#15867)
fabaff Aug 7, 2018
fcc918a
Update based upon forum post (#15876)
DubhAd Aug 7, 2018
debdc70
Upgrade netdisco to 2.0.0 (#15885)
fabaff Aug 8, 2018
0ab65f1
Follow changes to netdisco, separating DLNA into DLNA_DMS and DLNA_DM…
StevenLooman Aug 8, 2018
6190149
Upgrade pylast to 2.4.0 (#15886)
fabaff Aug 8, 2018
99c4c65
Add auth/authorize endpoint (#15887)
balloob Aug 9, 2018
39d19f2
Upgrade locationsharinglib to 2.0.11 (#15902)
fabaff Aug 9, 2018
f58425d
Refactor data entry flow (#15883)
awarecan Aug 9, 2018
2233d7c
Fix downgrade hassio cannot get refresh_token issue (#15874)
awarecan Aug 9, 2018
a29f867
Add HomematicIP Cloud smoke detector device (#15621)
worm-ee Aug 9, 2018
86658f3
Fix for multiple camera switches naming of entity (#14028)
rafale77 Aug 9, 2018
664eae7
Add realtime true/false switch for Waze (#15228)
mountainsandcode Aug 9, 2018
ef61c0c
Add PJLink media player platform (#15083)
benoitlouy Aug 9, 2018
dc01b17
Some typing related fixes (#15899)
scop Aug 9, 2018
f98629b
Update August component to use py-august:0.6.0 (#15916)
snjoetw Aug 10, 2018
1911168
Misc cleanups (#15907)
scop Aug 10, 2018
b370b6a
Update radiotherm to 1.4.1 (#15910)
craftyguy Aug 10, 2018
da916d7
Fix bug in translations upload script (#15922)
emlove Aug 10, 2018
9512bb9
Add and restore context in recorder (#15859)
balloob Aug 10, 2018
0ab3e7a
Add IndieAuth 4.2.2 redirect uri at client id (#15911)
balloob Aug 10, 2018
a0e9f9f
Merge remote-tracking branch 'origin/master' into dev
balloob Aug 10, 2018
81604a9
deCONZ - Add support for sirens (#15896)
Kane610 Aug 10, 2018
055e35b
Add RMV public transport sensor (#15814)
cgtobi Aug 10, 2018
e17e080
:pencil2: Corrects typo in code comments (#15923)
frenck Aug 11, 2018
f247739
Update frontend to 20180811.0
balloob Aug 11, 2018
69934a9
Bumped version to 0.76.0b0
balloob Aug 11, 2018
e0229b7
Update frontend to 20180813.0
balloob Aug 13, 2018
985f966
Upgrade pymysensors to 0.17.0 (#15942)
MartinHjelmare Aug 12, 2018
c0830f1
Deprecate remote.api (#15955)
balloob Aug 13, 2018
9e21765
Bumped version to 0.76.0b1
balloob Aug 13, 2018
6d432d1
Added error handling for sense API timeouts (#15789)
kbickar Aug 14, 2018
34e1f1b
Add context to login flow (#15914)
awarecan Aug 13, 2018
d0e4c95
MQTT embedded broker has to set its own password. (#15929)
awarecan Aug 13, 2018
d393380
Fix issue when reading worxlandroid pin code (#15930)
GotoCode Aug 14, 2018
f4e84fb
remove-phantomjs-from-docker (#15936)
vrih Aug 14, 2018
1b384c3
Remove remote.API from core.Config (#15951)
awarecan Aug 13, 2018
899c205
Switch to intermediate Mozilla cert profile (#15957)
balloob Aug 14, 2018
f5df567
Use JWT for access tokens (#15972)
balloob Aug 14, 2018
1777270
Pin crypto (#15978)
balloob Aug 14, 2018
e64e84a
Bumped version to 0.76.0b2
balloob Aug 14, 2018
4035880
Update translations
balloob Aug 15, 2018
2306d14
Teak mqtt error message for 0.76 release (#15983)
awarecan Aug 15, 2018
f8051a5
Fix 0.76 beta2 hassio token issue (#15987)
awarecan Aug 15, 2018
6da0ae4
Bumped version to 0.76.0b3
balloob Aug 15, 2018
11eb29f
Bump frontend to 20180816.0
balloob Aug 16, 2018
d540a08
Fix mysensors connection task blocking setup (#15938)
MartinHjelmare Aug 16, 2018
2469bc7
Fix Nest async from sync (#15997)
balloob Aug 16, 2018
5eccfc2
Bumped version to 0.76.0b4
balloob Aug 16, 2018
e41ce1d
Bump frontend to 20180816.1
balloob Aug 16, 2018
061859c
Fix message "Updating dlna_dmr media_player took longer than ..." (#1…
StevenLooman Aug 16, 2018
92e2649
Disable the DLNA component discovery (#16006)
balloob Aug 16, 2018
c09e7e6
Bumped version to 0.76.0b5
balloob Aug 16, 2018
e4425e6
Version 0.76.0
balloob Aug 17, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@ omit =
homeassistant/components/opencv.py
homeassistant/components/*/opencv.py

homeassistant/components/openuv.py
homeassistant/components/*/openuv.py

homeassistant/components/pilight.py
homeassistant/components/*/pilight.py

Expand Down Expand Up @@ -440,6 +443,7 @@ omit =
homeassistant/components/device_tracker/netgear.py
homeassistant/components/device_tracker/nmap_tracker.py
homeassistant/components/device_tracker/ping.py
homeassistant/components/device_tracker/ritassist.py
homeassistant/components/device_tracker/sky_hub.py
homeassistant/components/device_tracker/snmp.py
homeassistant/components/device_tracker/swisscom.py
Expand Down Expand Up @@ -509,6 +513,7 @@ omit =
homeassistant/components/media_player/denon.py
homeassistant/components/media_player/denonavr.py
homeassistant/components/media_player/directv.py
homeassistant/components/media_player/dlna_dmr.py
homeassistant/components/media_player/dunehd.py
homeassistant/components/media_player/emby.py
homeassistant/components/media_player/epson.py
Expand All @@ -532,6 +537,7 @@ omit =
homeassistant/components/media_player/pandora.py
homeassistant/components/media_player/philips_js.py
homeassistant/components/media_player/pioneer.py
homeassistant/components/media_player/pjlink.py
homeassistant/components/media_player/plex.py
homeassistant/components/media_player/roku.py
homeassistant/components/media_player/russound_rio.py
Expand Down Expand Up @@ -632,6 +638,7 @@ omit =
homeassistant/components/sensor/eddystone_temperature.py
homeassistant/components/sensor/eliqonline.py
homeassistant/components/sensor/emoncms.py
homeassistant/components/sensor/enphase_envoy.py
homeassistant/components/sensor/envirophat.py
homeassistant/components/sensor/etherscan.py
homeassistant/components/sensor/fastdotcom.py
Expand Down
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ matrix:
- python: "3.5.3"
env: TOXENV=typing
- python: "3.5.3"
env: TOXENV=py35
env: TOXENV=cov
after_success: coveralls
- python: "3.6"
env: TOXENV=py36
- python: "3.7"
Expand Down Expand Up @@ -45,4 +46,3 @@ deploy:
on:
branch: dev
condition: $TOXENV = lint
after_success: coveralls
2 changes: 2 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ homeassistant/components/konnected.py @heythisisnate
homeassistant/components/*/konnected.py @heythisisnate
homeassistant/components/matrix.py @tinloaf
homeassistant/components/*/matrix.py @tinloaf
homeassistant/components/openuv.py @bachya
homeassistant/components/*/openuv.py @bachya
homeassistant/components/qwikswitch.py @kellerza
homeassistant/components/*/qwikswitch.py @kellerza
homeassistant/components/rainmachine/* @bachya
Expand Down
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ LABEL maintainer="Paulus Schoutsen <[email protected]>"
#ENV INSTALL_OPENALPR no
#ENV INSTALL_FFMPEG no
#ENV INSTALL_LIBCEC no
#ENV INSTALL_PHANTOMJS no
#ENV INSTALL_SSOCR no
#ENV INSTALL_IPERF3 no

Expand Down
6 changes: 4 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Home Assistant |Build Status| |Coverage Status| |Chat Status|
=============================================================
Home Assistant |Build Status| |Coverage Status| |Chat Status| |Reviewed by Hound|
=================================================================================

Home Assistant is a home automation platform running on Python 3. It is able to track and control all devices at home and offer a platform for automating control.

Expand Down Expand Up @@ -33,6 +33,8 @@ of a component, check the `Home Assistant help section <https://home-assistant.i
:target: https://coveralls.io/r/home-assistant/home-assistant?branch=master
.. |Chat Status| image:: https://img.shields.io/discord/330944238910963714.svg
:target: https://discord.gg/c5DvZ4e
.. |Reviewed by Hound| image:: https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg
:target: https://houndci.com
.. |screenshot-states| image:: https://raw.github.com/home-assistant/home-assistant/master/docs/screenshots.png
:target: https://home-assistant.io/demo/
.. |screenshot-components| image:: https://raw.github.com/home-assistant/home-assistant/dev/docs/screenshot-components.png
Expand Down
77 changes: 51 additions & 26 deletions homeassistant/auth/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,23 @@
import asyncio
import logging
from collections import OrderedDict
from typing import List, Awaitable

import jwt

from homeassistant import data_entry_flow
from homeassistant.core import callback
from homeassistant.core import callback, HomeAssistant
from homeassistant.util import dt as dt_util

from . import models
from . import auth_store
from .providers import auth_provider_from_config

_LOGGER = logging.getLogger(__name__)


async def auth_manager_from_config(hass, provider_configs):
async def auth_manager_from_config(
hass: HomeAssistant,
provider_configs: List[dict]) -> Awaitable['AuthManager']:
"""Initialize an auth manager from config."""
store = auth_store.AuthStore(hass)
if provider_configs:
Expand Down Expand Up @@ -51,7 +56,6 @@ def __init__(self, hass, store, providers):
self.login_flow = data_entry_flow.FlowManager(
hass, self._async_create_login_flow,
self._async_finish_login_flow)
self._access_tokens = OrderedDict()

@property
def active(self):
Expand Down Expand Up @@ -178,43 +182,64 @@ async def async_create_refresh_token(self, user, client_id=None):

return await self._store.async_create_refresh_token(user, client_id)

async def async_get_refresh_token(self, token):
async def async_get_refresh_token(self, token_id):
"""Get refresh token by id."""
return await self._store.async_get_refresh_token(token_id)

async def async_get_refresh_token_by_token(self, token):
"""Get refresh token by token."""
return await self._store.async_get_refresh_token(token)
return await self._store.async_get_refresh_token_by_token(token)

@callback
def async_create_access_token(self, refresh_token):
"""Create a new access token."""
access_token = models.AccessToken(refresh_token=refresh_token)
self._access_tokens[access_token.token] = access_token
return access_token

@callback
def async_get_access_token(self, token):
"""Get an access token."""
tkn = self._access_tokens.get(token)
# pylint: disable=no-self-use
return jwt.encode({
'iss': refresh_token.id,
'iat': dt_util.utcnow(),
'exp': dt_util.utcnow() + refresh_token.access_token_expiration,
}, refresh_token.jwt_key, algorithm='HS256').decode()

async def async_validate_access_token(self, token):
"""Return if an access token is valid."""
try:
unverif_claims = jwt.decode(token, verify=False)
except jwt.InvalidTokenError:
return None

if tkn is None:
_LOGGER.debug('Attempt to get non-existing access token')
refresh_token = await self.async_get_refresh_token(
unverif_claims.get('iss'))

if refresh_token is None:
jwt_key = ''
issuer = ''
else:
jwt_key = refresh_token.jwt_key
issuer = refresh_token.id

try:
jwt.decode(
token,
jwt_key,
leeway=10,
issuer=issuer,
algorithms=['HS256']
)
except jwt.InvalidTokenError:
return None

if tkn.expired or not tkn.refresh_token.user.is_active:
if tkn.expired:
_LOGGER.debug('Attempt to get expired access token')
else:
_LOGGER.debug('Attempt to get access token for inactive user')
self._access_tokens.pop(token)
if not refresh_token.user.is_active:
return None

return tkn
return refresh_token

async def _async_create_login_flow(self, handler, *, source, data):
async def _async_create_login_flow(self, handler, *, context, data):
"""Create a login flow."""
auth_provider = self._providers[handler]

return await auth_provider.async_credential_flow()
return await auth_provider.async_credential_flow(context)

async def _async_finish_login_flow(self, result):
async def _async_finish_login_flow(self, context, result):
"""Result of a credential login flow."""
if result['type'] != data_entry_flow.RESULT_TYPE_CREATE_ENTRY:
return None
Expand Down
56 changes: 26 additions & 30 deletions homeassistant/auth/auth_store.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Storage for auth models."""
from collections import OrderedDict
from datetime import timedelta
import hmac

from homeassistant.util import dt as dt_util

Expand Down Expand Up @@ -110,22 +111,36 @@ async def async_remove_credentials(self, credentials):
async def async_create_refresh_token(self, user, client_id=None):
"""Create a new token for a user."""
refresh_token = models.RefreshToken(user=user, client_id=client_id)
user.refresh_tokens[refresh_token.token] = refresh_token
user.refresh_tokens[refresh_token.id] = refresh_token
await self.async_save()
return refresh_token

async def async_get_refresh_token(self, token):
"""Get refresh token by token."""
async def async_get_refresh_token(self, token_id):
"""Get refresh token by id."""
if self._users is None:
await self.async_load()

for user in self._users.values():
refresh_token = user.refresh_tokens.get(token)
refresh_token = user.refresh_tokens.get(token_id)
if refresh_token is not None:
return refresh_token

return None

async def async_get_refresh_token_by_token(self, token):
"""Get refresh token by token."""
if self._users is None:
await self.async_load()

found = None

for user in self._users.values():
for refresh_token in user.refresh_tokens.values():
if hmac.compare_digest(refresh_token.token, token):
found = refresh_token

return found

async def async_load(self):
"""Load the users."""
data = await self._store.async_load()
Expand Down Expand Up @@ -153,9 +168,11 @@ async def async_load(self):
data=cred_dict['data'],
))

refresh_tokens = OrderedDict()

for rt_dict in data['refresh_tokens']:
# Filter out the old keys that don't have jwt_key (pre-0.76)
if 'jwt_key' not in rt_dict:
continue

token = models.RefreshToken(
id=rt_dict['id'],
user=users[rt_dict['user_id']],
Expand All @@ -164,18 +181,9 @@ async def async_load(self):
access_token_expiration=timedelta(
seconds=rt_dict['access_token_expiration']),
token=rt_dict['token'],
jwt_key=rt_dict['jwt_key']
)
refresh_tokens[token.id] = token
users[rt_dict['user_id']].refresh_tokens[token.token] = token

for ac_dict in data['access_tokens']:
refresh_token = refresh_tokens[ac_dict['refresh_token_id']]
token = models.AccessToken(
refresh_token=refresh_token,
created_at=dt_util.parse_datetime(ac_dict['created_at']),
token=ac_dict['token'],
)
refresh_token.access_tokens.append(token)
users[rt_dict['user_id']].refresh_tokens[token.id] = token

self._users = users

Expand Down Expand Up @@ -213,27 +221,15 @@ async def async_save(self):
'access_token_expiration':
refresh_token.access_token_expiration.total_seconds(),
'token': refresh_token.token,
'jwt_key': refresh_token.jwt_key,
}
for user in self._users.values()
for refresh_token in user.refresh_tokens.values()
]

access_tokens = [
{
'id': user.id,
'refresh_token_id': refresh_token.id,
'created_at': access_token.created_at.isoformat(),
'token': access_token.token,
}
for user in self._users.values()
for refresh_token in user.refresh_tokens.values()
for access_token in refresh_token.access_tokens
]

data = {
'users': users,
'credentials': credentials,
'access_tokens': access_tokens,
'refresh_tokens': refresh_tokens,
}

Expand Down
22 changes: 2 additions & 20 deletions homeassistant/auth/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,8 @@ class RefreshToken:
default=ACCESS_TOKEN_EXPIRATION)
token = attr.ib(type=str,
default=attr.Factory(lambda: generate_secret(64)))
access_tokens = attr.ib(type=list, default=attr.Factory(list), cmp=False)


@attr.s(slots=True)
class AccessToken:
"""Access token to access the API.

These will only ever be stored in memory and not be persisted.
"""

refresh_token = attr.ib(type=RefreshToken)
created_at = attr.ib(type=datetime, default=attr.Factory(dt_util.utcnow))
token = attr.ib(type=str,
default=attr.Factory(generate_secret))

@property
def expired(self):
"""Return if this token has expired."""
expires = self.created_at + self.refresh_token.access_token_expiration
return dt_util.utcnow() > expires
jwt_key = attr.ib(type=str,
default=attr.Factory(lambda: generate_secret(64)))


@attr.s(slots=True)
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/auth/providers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def async_create_credentials(self, data):

# Implement by extending class

async def async_credential_flow(self):
async def async_credential_flow(self, context):
"""Return the data flow for logging in with auth provider."""
raise NotImplementedError

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/auth/providers/homeassistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ async def async_initialize(self):
self.data = Data(self.hass)
await self.data.async_load()

async def async_credential_flow(self):
async def async_credential_flow(self, context):
"""Return a flow to login."""
return LoginFlow(self)

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/auth/providers/insecure_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class InvalidAuthError(HomeAssistantError):
class ExampleAuthProvider(AuthProvider):
"""Example auth provider based on hardcoded usernames and passwords."""

async def async_credential_flow(self):
async def async_credential_flow(self, context):
"""Return a flow to login."""
return LoginFlow(self)

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/auth/providers/legacy_api_password.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class LegacyApiPasswordAuthProvider(AuthProvider):

DEFAULT_TITLE = 'Legacy API Password'

async def async_credential_flow(self):
async def async_credential_flow(self, context):
"""Return a flow to login."""
return LoginFlow(self)

Expand Down
Loading