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
|
||||
await async_validate_trusted_networks(request)):
|
||||
_LOGGER.warning(
|
||||
'Access from trusted networks without auth token is going to '
|
||||
'be removed in Home Assistant 0.96. Configure the trusted '
|
||||
'networks auth provider or use long-lived access tokens to '
|
||||
'access %s from %s',
|
||||
request.path, request[KEY_REAL_IP])
|
||||
if request.path not in old_auth_warning:
|
||||
# When removing this, don't forget to remove the print logic
|
||||
# in http/view.py
|
||||
request['deprecate_warning_message'] = \
|
||||
'Access from trusted networks without auth token is ' \
|
||||
'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
|
||||
|
||||
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 authenticated:
|
||||
if 'deprecate_warning_message' in request:
|
||||
_LOGGER.warning(request['deprecate_warning_message'])
|
||||
await process_success_login(request)
|
||||
else:
|
||||
raise HTTPUnauthorized()
|
||||
|
|
Loading…
Add table
Reference in a new issue