Use JWT for access tokens (#15972)

* Use JWT for access tokens

* Update requirements

* Improvements
This commit is contained in:
Paulus Schoutsen 2018-08-14 21:14:12 +02:00 committed by GitHub
parent ee5d49a033
commit e776f88eec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 203 additions and 155 deletions

View file

@ -355,11 +355,12 @@ class ActiveConnection:
if self.hass.auth.active and 'access_token' in msg:
self.debug("Received access_token")
token = self.hass.auth.async_get_access_token(
msg['access_token'])
authenticated = token is not None
refresh_token = \
await self.hass.auth.async_validate_access_token(
msg['access_token'])
authenticated = refresh_token is not None
if authenticated:
request['hass_user'] = token.refresh_token.user
request['hass_user'] = refresh_token.user
elif ((not self.hass.auth.active or
self.hass.auth.support_legacy) and