authentik.core.apps
authentik core app config
1"""authentik core app config""" 2 3from django.utils.translation import gettext_lazy as _ 4 5from authentik.blueprints.apps import ManagedAppConfig 6from authentik.tasks.schedules.common import ScheduleSpec 7from authentik.tenants.flags import Flag 8 9 10class AppAccessWithoutBindings(Flag[bool], key="core_default_app_access"): 11 12 default = True 13 visibility = "none" 14 description = _( 15 "Configure if applications without any policy/group/user bindings " 16 "should be accessible to any user." 17 ) 18 19 20class AuthentikCoreConfig(ManagedAppConfig): 21 """authentik core app config""" 22 23 name = "authentik.core" 24 label = "authentik_core" 25 verbose_name = "authentik Core" 26 mountpoint = "" 27 default = True 28 29 @ManagedAppConfig.reconcile_tenant 30 def source_inbuilt(self): 31 """Reconcile inbuilt source""" 32 from authentik.core.models import Source 33 34 Source.objects.update_or_create( 35 defaults={ 36 "name": "authentik Built-in", 37 "slug": "authentik-built-in", 38 }, 39 managed=Source.MANAGED_INBUILT, 40 ) 41 42 @property 43 def tenant_schedule_specs(self) -> list[ScheduleSpec]: 44 from authentik.core.tasks import clean_expired_models, clean_temporary_users 45 46 return [ 47 ScheduleSpec( 48 actor=clean_expired_models, 49 crontab="2-59/5 * * * *", 50 ), 51 ScheduleSpec( 52 actor=clean_temporary_users, 53 crontab="9-59/5 * * * *", 54 ), 55 ]
11class AppAccessWithoutBindings(Flag[bool], key="core_default_app_access"): 12 13 default = True 14 visibility = "none" 15 description = _( 16 "Configure if applications without any policy/group/user bindings " 17 "should be accessible to any user." 18 )
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
description =
'Configure if applications without any policy/group/user bindings should be accessible to any user.'
Inherited Members
21class AuthentikCoreConfig(ManagedAppConfig): 22 """authentik core app config""" 23 24 name = "authentik.core" 25 label = "authentik_core" 26 verbose_name = "authentik Core" 27 mountpoint = "" 28 default = True 29 30 @ManagedAppConfig.reconcile_tenant 31 def source_inbuilt(self): 32 """Reconcile inbuilt source""" 33 from authentik.core.models import Source 34 35 Source.objects.update_or_create( 36 defaults={ 37 "name": "authentik Built-in", 38 "slug": "authentik-built-in", 39 }, 40 managed=Source.MANAGED_INBUILT, 41 ) 42 43 @property 44 def tenant_schedule_specs(self) -> list[ScheduleSpec]: 45 from authentik.core.tasks import clean_expired_models, clean_temporary_users 46 47 return [ 48 ScheduleSpec( 49 actor=clean_expired_models, 50 crontab="2-59/5 * * * *", 51 ), 52 ScheduleSpec( 53 actor=clean_temporary_users, 54 crontab="9-59/5 * * * *", 55 ), 56 ]
authentik core app config
name =
'authentik.core'
@ManagedAppConfig.reconcile_tenant
def
source_inbuilt(self):
30 @ManagedAppConfig.reconcile_tenant 31 def source_inbuilt(self): 32 """Reconcile inbuilt source""" 33 from authentik.core.models import Source 34 35 Source.objects.update_or_create( 36 defaults={ 37 "name": "authentik Built-in", 38 "slug": "authentik-built-in", 39 }, 40 managed=Source.MANAGED_INBUILT, 41 )
Reconcile inbuilt source
tenant_schedule_specs: list[authentik.tasks.schedules.common.ScheduleSpec]
43 @property 44 def tenant_schedule_specs(self) -> list[ScheduleSpec]: 45 from authentik.core.tasks import clean_expired_models, clean_temporary_users 46 47 return [ 48 ScheduleSpec( 49 actor=clean_expired_models, 50 crontab="2-59/5 * * * *", 51 ), 52 ScheduleSpec( 53 actor=clean_temporary_users, 54 crontab="9-59/5 * * * *", 55 ), 56 ]
Get a list of schedule specs that must exist in each tenant