Skip to content

Commit

Permalink
improve logging
Browse files Browse the repository at this point in the history
  • Loading branch information
BeryJu committed Oct 29, 2020
1 parent 32c4821 commit 483bc7b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions custom_components/auth_header/headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ def async_validate_access(self, ip_addr: IPAddress) -> None:
ip_addr in trusted_network
for trusted_network in self.hass.http.trusted_proxies
):
_LOGGER.warning("Remote IP not in trusted proxies: %s", ip_addr)
raise InvalidAuthError("Not in trusted_proxies")


Expand Down Expand Up @@ -140,13 +141,13 @@ async def async_step_init(
self._ip_address
)

except InvalidAuthError:
_LOGGER.debug("invalid auth")
except InvalidAuthError as exc:
_LOGGER.debug("invalid auth", exc_info=exc)
return self.async_abort(reason="not_allowed")

for user in self._available_users:
if user.name == self._remote_user:
return await self.async_finish({"user": user.id})

_LOGGER.debug("no user")
_LOGGER.debug("no user found")
return self.async_abort(reason="not_allowed")

0 comments on commit 483bc7b

Please sign in to comment.