authentik.stages.authenticator_webauthn.utils

webauthn utils

 1"""webauthn utils"""
 2
 3from django.http import HttpRequest
 4
 5
 6def get_rp_id(request: HttpRequest) -> str:
 7    """Get hostname from http request, without port"""
 8    host = request.get_host()
 9    if ":" in host:
10        return host.split(":")[0]
11    return host
12
13
14def get_origin(request: HttpRequest) -> str:
15    """Return Origin by building an absolute URL and removing the
16    trailing slash"""
17    full_url = request.build_absolute_uri("/")
18    return full_url[:-1]
def get_rp_id(request: django.http.request.HttpRequest) -> str:
 7def get_rp_id(request: HttpRequest) -> str:
 8    """Get hostname from http request, without port"""
 9    host = request.get_host()
10    if ":" in host:
11        return host.split(":")[0]
12    return host

Get hostname from http request, without port

def get_origin(request: django.http.request.HttpRequest) -> str:
15def get_origin(request: HttpRequest) -> str:
16    """Return Origin by building an absolute URL and removing the
17    trailing slash"""
18    full_url = request.build_absolute_uri("/")
19    return full_url[:-1]

Return Origin by building an absolute URL and removing the trailing slash