authorization: add additional CORS logging
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
5081810a96
commit
7ca910ec46
|
@ -58,11 +58,13 @@ class Authorization:
|
||||||
t_clients = "\n".join(
|
t_clients = "\n".join(
|
||||||
[str(ip) for ip in self.trusted_ips] +
|
[str(ip) for ip in self.trusted_ips] +
|
||||||
[str(rng) for rng in self.trusted_ranges])
|
[str(rng) for rng in self.trusted_ranges])
|
||||||
|
c_domains = "\n".join(self.cors_domains)
|
||||||
|
|
||||||
logging.info(
|
logging.info(
|
||||||
f"Authorization Configuration Loaded\n"
|
f"Authorization Configuration Loaded\n"
|
||||||
f"Auth Enabled: {self.auth_enabled}\n"
|
f"Auth Enabled: {self.auth_enabled}\n"
|
||||||
f"Trusted Clients:\n{t_clients}")
|
f"Trusted Clients:\n{t_clients}\n"
|
||||||
|
f"CORS Domains:\n{c_domains}")
|
||||||
|
|
||||||
self.prune_handler = PeriodicCallback(
|
self.prune_handler = PeriodicCallback(
|
||||||
self._prune_conn_handler, PRUNE_CHECK_TIME)
|
self._prune_conn_handler, PRUNE_CHECK_TIME)
|
||||||
|
@ -187,13 +189,17 @@ class Authorization:
|
||||||
return False
|
return False
|
||||||
for regex in self.cors_domains:
|
for regex in self.cors_domains:
|
||||||
match = re.match(regex, origin)
|
match = re.match(regex, origin)
|
||||||
if match is not None and match.group() == origin:
|
if match is not None:
|
||||||
logging.debug(f"CORS Pattern Matched, origin: {origin} "
|
if match.group() == origin:
|
||||||
f" | pattern: {regex}")
|
logging.debug(f"CORS Pattern Matched, origin: {origin} "
|
||||||
self._set_cors_headers(origin, request)
|
f" | pattern: {regex}")
|
||||||
return True
|
self._set_cors_headers(origin, request)
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
logging.debug(f"Partial Cors Match: {match.group()}")
|
||||||
else:
|
else:
|
||||||
logging.debug(f"No CORS match for origin: {origin}")
|
logging.debug(f"No CORS match for origin: {origin}\n"
|
||||||
|
f"Patterns: {self.cors_domains}")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def _set_cors_headers(self, origin, request):
|
def _set_cors_headers(self, origin, request):
|
||||||
|
|
Loading…
Reference in New Issue