authentik.enterprise.policies.unique_password.apps

authentik Unique Password policy app config

 1"""authentik Unique Password policy app config"""
 2
 3from authentik.enterprise.apps import EnterpriseConfig
 4from authentik.lib.utils.time import fqdn_rand
 5from authentik.tasks.schedules.common import ScheduleSpec
 6
 7
 8class AuthentikEnterprisePoliciesUniquePasswordConfig(EnterpriseConfig):
 9    name = "authentik.enterprise.policies.unique_password"
10    label = "authentik_policies_unique_password"
11    verbose_name = "authentik Enterprise.Policies.Unique Password"
12    default = True
13
14    @property
15    def tenant_schedule_specs(self) -> list[ScheduleSpec]:
16        from authentik.enterprise.policies.unique_password.tasks import (
17            check_and_purge_password_history,
18            trim_password_histories,
19        )
20
21        return [
22            ScheduleSpec(
23                actor=trim_password_histories,
24                crontab=f"{fqdn_rand('policies_unique_password_trim')} */12 * * *",
25            ),
26            ScheduleSpec(
27                actor=check_and_purge_password_history,
28                crontab=f"{fqdn_rand('policies_unique_password_purge')} */24 * * *",
29            ),
30        ]
class AuthentikEnterprisePoliciesUniquePasswordConfig(authentik.enterprise.apps.EnterpriseConfig):
 9class AuthentikEnterprisePoliciesUniquePasswordConfig(EnterpriseConfig):
10    name = "authentik.enterprise.policies.unique_password"
11    label = "authentik_policies_unique_password"
12    verbose_name = "authentik Enterprise.Policies.Unique Password"
13    default = True
14
15    @property
16    def tenant_schedule_specs(self) -> list[ScheduleSpec]:
17        from authentik.enterprise.policies.unique_password.tasks import (
18            check_and_purge_password_history,
19            trim_password_histories,
20        )
21
22        return [
23            ScheduleSpec(
24                actor=trim_password_histories,
25                crontab=f"{fqdn_rand('policies_unique_password_trim')} */12 * * *",
26            ),
27            ScheduleSpec(
28                actor=check_and_purge_password_history,
29                crontab=f"{fqdn_rand('policies_unique_password_purge')} */24 * * *",
30            ),
31        ]

Base app config for all enterprise apps

label = 'authentik_policies_unique_password'
verbose_name = 'authentik Enterprise.Policies.Unique Password'
default = True
tenant_schedule_specs: list[authentik.tasks.schedules.common.ScheduleSpec]
15    @property
16    def tenant_schedule_specs(self) -> list[ScheduleSpec]:
17        from authentik.enterprise.policies.unique_password.tasks import (
18            check_and_purge_password_history,
19            trim_password_histories,
20        )
21
22        return [
23            ScheduleSpec(
24                actor=trim_password_histories,
25                crontab=f"{fqdn_rand('policies_unique_password_trim')} */12 * * *",
26            ),
27            ScheduleSpec(
28                actor=check_and_purge_password_history,
29                crontab=f"{fqdn_rand('policies_unique_password_purge')} */24 * * *",
30            ),
31        ]

Get a list of schedule specs that must exist in each tenant