
* initial sfe Signed-off-by: Jens Langhammer <jens@goauthentik.io> * build sfe Signed-off-by: Jens Langhammer <jens@goauthentik.io> * downgrade bootstrap Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix path Signed-off-by: Jens Langhammer <jens@goauthentik.io> * make IE compatible Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix query string missing Signed-off-by: Jens Langhammer <jens@goauthentik.io> * add autosubmit stage Signed-off-by: Jens Langhammer <jens@goauthentik.io> * add background image Signed-off-by: Jens Langhammer <jens@goauthentik.io> * add code support Signed-off-by: Jens Langhammer <jens@goauthentik.io> * add support for combo ident/password Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix logo rendering Signed-off-by: Jens Langhammer <jens@goauthentik.io> * only use for edge 18 and before Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix lint Signed-off-by: Jens Langhammer <jens@goauthentik.io> * add docs Signed-off-by: Jens Langhammer <jens@goauthentik.io> * add webauthn support Signed-off-by: Jens Langhammer <jens@goauthentik.io> * migrate to TS for some creature comforts Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix ci Signed-off-by: Jens Langhammer <jens@goauthentik.io> * dedupe dependabot Signed-off-by: Jens Langhammer <jens@goauthentik.io> * use API client...kinda Signed-off-by: Jens Langhammer <jens@goauthentik.io> * add more docs Signed-off-by: Jens Langhammer <jens@goauthentik.io> * add more polyfills yay Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix Signed-off-by: Jens Langhammer <jens@goauthentik.io> * turn powered by into span prevent issues in restricted browsers where users might not be able to return Signed-off-by: Jens Langhammer <jens@goauthentik.io> * allow non-link footer entries Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix tsc errors Signed-off-by: Jens Langhammer <jens@goauthentik.io> * Apply suggestions from code review Co-authored-by: Tana M Berry <tanamarieberry@yahoo.com> Signed-off-by: Jens L. <jens@beryju.org> * auto switch for macos Signed-off-by: Jens Langhammer <jens@goauthentik.io> * reword Signed-off-by: Jens Langhammer <jens@goauthentik.io> * Update website/docs/flow/executors/if-flow.md Signed-off-by: Jens L. <jens@beryju.org> * format Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: Jens Langhammer <jens@goauthentik.io> Signed-off-by: Jens L. <jens@beryju.org> Co-authored-by: Tana M Berry <tanamarieberry@yahoo.com>
42 lines
1.6 KiB
Python
42 lines
1.6 KiB
Python
"""Interface views"""
|
|
|
|
from typing import Any
|
|
|
|
from django.shortcuts import get_object_or_404
|
|
from ua_parser.user_agent_parser import Parse
|
|
|
|
from authentik.core.views.interface import InterfaceView
|
|
from authentik.flows.models import Flow
|
|
|
|
|
|
class FlowInterfaceView(InterfaceView):
|
|
"""Flow interface"""
|
|
|
|
def get_context_data(self, **kwargs: Any) -> dict[str, Any]:
|
|
kwargs["flow"] = get_object_or_404(Flow, slug=self.kwargs.get("flow_slug"))
|
|
kwargs["inspector"] = "inspector" in self.request.GET
|
|
return super().get_context_data(**kwargs)
|
|
|
|
def compat_needs_sfe(self) -> bool:
|
|
"""Check if we need to use the simplified flow executor for compatibility"""
|
|
ua = Parse(self.request.META.get("HTTP_USER_AGENT", ""))
|
|
if ua["user_agent"]["family"] == "IE":
|
|
return True
|
|
# Only use SFE for Edge 18 and older, after Edge 18 MS switched to chromium which supports
|
|
# the default flow executor
|
|
if (
|
|
ua["user_agent"]["family"] == "Edge"
|
|
and int(ua["user_agent"]["major"]) <= 18 # noqa: PLR2004
|
|
): # noqa: PLR2004
|
|
return True
|
|
# https://github.com/AzureAD/microsoft-authentication-library-for-objc
|
|
# Used by Microsoft Teams/Office on macOS, and also uses a very outdated browser engine
|
|
if "PKeyAuth" in ua["string"]:
|
|
return True
|
|
return False
|
|
|
|
def get_template_names(self) -> list[str]:
|
|
if self.compat_needs_sfe() or "sfe" in self.request.GET:
|
|
return ["if/flow-sfe.html"]
|
|
return ["if/flow.html"]
|