Skip to content
Snippets Groups Projects
Commit e90baf34 authored by Jan Hartig's avatar Jan Hartig
Browse files

Fix errors for IPv6 addresses

parent 2c5adf30
No related branches found
No related tags found
1 merge request!27Implement ip based access
Pipeline #48932 passed
...@@ -103,7 +103,11 @@ def check_auth(request: Request) -> dict | None: ...@@ -103,7 +103,11 @@ def check_auth(request: Request) -> dict | None:
s_dn = request.headers.get("SSL-Client-S-DN") s_dn = request.headers.get("SSL-Client-S-DN")
if not s_dn: if not s_dn:
client_ip = ipaddress.IPv4Address(request.headers.get("CLient-IP")) try:
client_ip = ipaddress.IPv4Address(request.headers.get("CLient-IP"))
except ipaddress.AddressValueError:
# client_ip = ipaddress.IPv6Address(request.headers.get("CLient-IP"))
raise Unauthorized("Unauthorized")
allowed = False allowed = False
for network in ALLOWED_IPS: for network in ALLOWED_IPS:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment