authentik.sources.oauth.apps

authentik oauth_client config

 1"""authentik oauth_client config"""
 2
 3from structlog.stdlib import get_logger
 4
 5from authentik.blueprints.apps import ManagedAppConfig
 6from authentik.lib.utils.time import fqdn_rand
 7from authentik.tasks.schedules.common import ScheduleSpec
 8
 9LOGGER = get_logger()
10
11AUTHENTIK_SOURCES_OAUTH_TYPES = [
12    "authentik.sources.oauth.types.apple",
13    "authentik.sources.oauth.types.azure_ad",
14    "authentik.sources.oauth.types.discord",
15    "authentik.sources.oauth.types.entra_id",
16    "authentik.sources.oauth.types.facebook",
17    "authentik.sources.oauth.types.github",
18    "authentik.sources.oauth.types.gitlab",
19    "authentik.sources.oauth.types.google",
20    "authentik.sources.oauth.types.mailcow",
21    "authentik.sources.oauth.types.oidc",
22    "authentik.sources.oauth.types.okta",
23    "authentik.sources.oauth.types.patreon",
24    "authentik.sources.oauth.types.reddit",
25    "authentik.sources.oauth.types.slack",
26    "authentik.sources.oauth.types.twitch",
27    "authentik.sources.oauth.types.twitter",
28    "authentik.sources.oauth.types.wechat",
29]
30
31
32class AuthentikSourceOAuthConfig(ManagedAppConfig):
33    """authentik source.oauth config"""
34
35    name = "authentik.sources.oauth"
36    label = "authentik_sources_oauth"
37    verbose_name = "authentik Sources.OAuth"
38    mountpoint = "source/oauth/"
39    default = True
40
41    def import_related(self):
42        for source_type in AUTHENTIK_SOURCES_OAUTH_TYPES:
43            try:
44                self.import_module(source_type)
45            except ImportError as exc:
46                LOGGER.warning("Failed to load OAuth Source", exc=exc)
47        return super().import_related()
48
49    @property
50    def tenant_schedule_specs(self) -> list[ScheduleSpec]:
51        from authentik.sources.oauth.tasks import update_well_known_jwks
52
53        return [
54            ScheduleSpec(
55                actor=update_well_known_jwks,
56                crontab=f"{fqdn_rand('update_well_known_jwks')} */3 * * *",
57            ),
58        ]
LOGGER = <BoundLoggerLazyProxy(logger=None, wrapper_class=None, processors=None, context_class=None, initial_values={}, logger_factory_args=())>
class AuthentikSourceOAuthConfig(authentik.blueprints.apps.ManagedAppConfig):
33class AuthentikSourceOAuthConfig(ManagedAppConfig):
34    """authentik source.oauth config"""
35
36    name = "authentik.sources.oauth"
37    label = "authentik_sources_oauth"
38    verbose_name = "authentik Sources.OAuth"
39    mountpoint = "source/oauth/"
40    default = True
41
42    def import_related(self):
43        for source_type in AUTHENTIK_SOURCES_OAUTH_TYPES:
44            try:
45                self.import_module(source_type)
46            except ImportError as exc:
47                LOGGER.warning("Failed to load OAuth Source", exc=exc)
48        return super().import_related()
49
50    @property
51    def tenant_schedule_specs(self) -> list[ScheduleSpec]:
52        from authentik.sources.oauth.tasks import update_well_known_jwks
53
54        return [
55            ScheduleSpec(
56                actor=update_well_known_jwks,
57                crontab=f"{fqdn_rand('update_well_known_jwks')} */3 * * *",
58            ),
59        ]

authentik source.oauth config

label = 'authentik_sources_oauth'
verbose_name = 'authentik Sources.OAuth'
mountpoint = 'source/oauth/'
default = True
tenant_schedule_specs: list[authentik.tasks.schedules.common.ScheduleSpec]
50    @property
51    def tenant_schedule_specs(self) -> list[ScheduleSpec]:
52        from authentik.sources.oauth.tasks import update_well_known_jwks
53
54        return [
55            ScheduleSpec(
56                actor=update_well_known_jwks,
57                crontab=f"{fqdn_rand('update_well_known_jwks')} */3 * * *",
58            ),
59        ]

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