authentik.flows.apps
authentik flows app config
1"""authentik flows app config""" 2 3from django.utils.translation import gettext_lazy as _ 4from prometheus_client import Gauge, Histogram 5 6from authentik.blueprints.apps import ManagedAppConfig 7from authentik.lib.utils.reflection import all_subclasses 8from authentik.tenants.flags import Flag 9 10GAUGE_FLOWS_CACHED = Gauge( 11 "authentik_flows_cached", 12 "Cached flows", 13 ["tenant"], 14) 15HIST_FLOW_EXECUTION_STAGE_TIME = Histogram( 16 "authentik_flows_execution_stage_time", 17 "Duration each stage took to execute.", 18 ["stage_type", "method"], 19) 20HIST_FLOWS_PLAN_TIME = Histogram( 21 "authentik_flows_plan_time", 22 "Duration to build a plan for a flow", 23 ["flow_slug"], 24) 25 26 27class RefreshOtherFlowsAfterAuthentication(Flag[bool], key="flows_refresh_others"): 28 29 default = False 30 visibility = "public" 31 description = _("Refresh other tabs after successful authentication.") 32 33 34class ContinuousLogin(Flag[bool], key="flows_continuous_login"): 35 36 default = False 37 visibility = "public" 38 description = _("Upon successful authentication, re-start authentication in other open tabs.") 39 40 41class AuthentikFlowsConfig(ManagedAppConfig): 42 """authentik flows app config""" 43 44 name = "authentik.flows" 45 label = "authentik_flows" 46 mountpoint = "flows/" 47 verbose_name = "authentik Flows" 48 default = True 49 50 def import_related(self): 51 from authentik.flows.models import Stage 52 53 for stage in all_subclasses(Stage): 54 _ = stage().view 55 return super().import_related()
GAUGE_FLOWS_CACHED =
prometheus_client.metrics.Gauge(authentik_flows_cached)
HIST_FLOW_EXECUTION_STAGE_TIME =
prometheus_client.metrics.Histogram(authentik_flows_execution_stage_time)
HIST_FLOWS_PLAN_TIME =
prometheus_client.metrics.Histogram(authentik_flows_plan_time)
28class RefreshOtherFlowsAfterAuthentication(Flag[bool], key="flows_refresh_others"): 29 30 default = False 31 visibility = "public" 32 description = _("Refresh other tabs after successful authentication.")
Abstract base class for generic types.
On Python 3.12 and newer, generic classes implicitly inherit from Generic when they declare a parameter list after the class's name::
class Mapping[KT, VT]:
def __getitem__(self, key: KT) -> VT:
...
# Etc.
On older versions of Python, however, generic classes have to explicitly inherit from Generic.
After a class has been declared to be generic, it can then be used as follows::
def lookup_name[KT, VT](mapping: Mapping[KT, VT], key: KT, default: VT) -> VT:
try:
return mapping[key]
except KeyError:
return default
Inherited Members
35class ContinuousLogin(Flag[bool], key="flows_continuous_login"): 36 37 default = False 38 visibility = "public" 39 description = _("Upon successful authentication, re-start authentication in other open tabs.")
Abstract base class for generic types.
On Python 3.12 and newer, generic classes implicitly inherit from Generic when they declare a parameter list after the class's name::
class Mapping[KT, VT]:
def __getitem__(self, key: KT) -> VT:
...
# Etc.
On older versions of Python, however, generic classes have to explicitly inherit from Generic.
After a class has been declared to be generic, it can then be used as follows::
def lookup_name[KT, VT](mapping: Mapping[KT, VT], key: KT, default: VT) -> VT:
try:
return mapping[key]
except KeyError:
return default
Inherited Members
42class AuthentikFlowsConfig(ManagedAppConfig): 43 """authentik flows app config""" 44 45 name = "authentik.flows" 46 label = "authentik_flows" 47 mountpoint = "flows/" 48 verbose_name = "authentik Flows" 49 default = True 50 51 def import_related(self): 52 from authentik.flows.models import Stage 53 54 for stage in all_subclasses(Stage): 55 _ = stage().view 56 return super().import_related()
authentik flows app config
name =
'authentik.flows'