Fix trusted networks auth provider warning message (#22671)
* Fix trusted networks auth provider warning message * Update auth.py
This commit is contained in:
parent
f2941522ca
commit
6a411710df
2 changed files with 12 additions and 6 deletions
|
@ -190,12 +190,16 @@ def setup_auth(hass, app):
|
||||||
|
|
||||||
elif (trusted_networks and
|
elif (trusted_networks and
|
||||||
await async_validate_trusted_networks(request)):
|
await async_validate_trusted_networks(request)):
|
||||||
_LOGGER.warning(
|
if request.path not in old_auth_warning:
|
||||||
'Access from trusted networks without auth token is going to '
|
# When removing this, don't forget to remove the print logic
|
||||||
'be removed in Home Assistant 0.96. Configure the trusted '
|
# in http/view.py
|
||||||
'networks auth provider or use long-lived access tokens to '
|
request['deprecate_warning_message'] = \
|
||||||
'access %s from %s',
|
'Access from trusted networks without auth token is ' \
|
||||||
request.path, request[KEY_REAL_IP])
|
'going to be removed in Home Assistant 0.96. Configure ' \
|
||||||
|
'the trusted networks auth provider or use long-lived ' \
|
||||||
|
'access tokens to access {} from {}'.format(
|
||||||
|
request.path, request[KEY_REAL_IP])
|
||||||
|
old_auth_warning.add(request.path)
|
||||||
authenticated = True
|
authenticated = True
|
||||||
|
|
||||||
elif (support_legacy and HTTP_HEADER_HA_AUTH in request.headers and
|
elif (support_legacy and HTTP_HEADER_HA_AUTH in request.headers and
|
||||||
|
|
|
@ -98,6 +98,8 @@ def request_handler_factory(view, handler):
|
||||||
|
|
||||||
if view.requires_auth:
|
if view.requires_auth:
|
||||||
if authenticated:
|
if authenticated:
|
||||||
|
if 'deprecate_warning_message' in request:
|
||||||
|
_LOGGER.warning(request['deprecate_warning_message'])
|
||||||
await process_success_login(request)
|
await process_success_login(request)
|
||||||
else:
|
else:
|
||||||
raise HTTPUnauthorized()
|
raise HTTPUnauthorized()
|
||||||
|
|
Loading…
Add table
Reference in a new issue