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

authentik source.oauth config

label = 'authentik_sources_oauth'
verbose_name = 'authentik Sources.OAuth'
mountpoint = 'source/oauth/'
default = True
schedule_specs: list[authentik.tasks.schedules.common.ScheduleSpec]
49    @property
50    def 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        ]

Get a list of schedule specs that must exist