From 296031c5dfc6867f75791902cd55f42b92b0fee4 Mon Sep 17 00:00:00 2001 From: Marc 'risson' Schmitt Date: Thu, 5 Jun 2025 14:28:11 +0200 Subject: [PATCH] *: use ManagedAppConfig everywhere (#14839) --- authentik/api/apps.py | 5 +++-- .../blueprints/tests/test_managed_app_config.py | 14 ++++++++++++++ authentik/brands/apps.py | 5 +++-- authentik/policies/dummy/apps.py | 5 +++-- authentik/policies/event_matcher/apps.py | 5 +++-- authentik/policies/expiry/apps.py | 5 +++-- authentik/policies/expression/apps.py | 5 +++-- authentik/policies/geoip/apps.py | 5 +++-- authentik/policies/password/apps.py | 5 +++-- authentik/providers/ldap/apps.py | 5 +++-- authentik/providers/radius/apps.py | 5 +++-- authentik/providers/saml/apps.py | 5 +++-- authentik/recovery/apps.py | 5 +++-- authentik/sources/plex/apps.py | 5 +++-- authentik/stages/authenticator/apps.py | 5 +++-- authentik/stages/authenticator_sms/apps.py | 5 +++-- authentik/stages/authenticator_totp/apps.py | 5 +++-- authentik/stages/authenticator_validate/apps.py | 5 +++-- authentik/stages/captcha/apps.py | 5 +++-- authentik/stages/consent/apps.py | 5 +++-- authentik/stages/deny/apps.py | 5 +++-- authentik/stages/dummy/apps.py | 5 +++-- authentik/stages/identification/apps.py | 5 +++-- authentik/stages/invitation/apps.py | 5 +++-- authentik/stages/password/apps.py | 5 +++-- authentik/stages/prompt/apps.py | 5 +++-- authentik/stages/redirect/apps.py | 5 +++-- authentik/stages/user_delete/apps.py | 5 +++-- authentik/stages/user_login/apps.py | 5 +++-- authentik/stages/user_logout/apps.py | 5 +++-- authentik/stages/user_write/apps.py | 5 +++-- 31 files changed, 104 insertions(+), 60 deletions(-) create mode 100644 authentik/blueprints/tests/test_managed_app_config.py diff --git a/authentik/api/apps.py b/authentik/api/apps.py index 8ae859a54d..1480ce9ecb 100644 --- a/authentik/api/apps.py +++ b/authentik/api/apps.py @@ -1,12 +1,13 @@ """authentik API AppConfig""" -from django.apps import AppConfig +from authentik.blueprints.apps import ManagedAppConfig -class AuthentikAPIConfig(AppConfig): +class AuthentikAPIConfig(ManagedAppConfig): """authentik API Config""" name = "authentik.api" label = "authentik_api" mountpoint = "api/" verbose_name = "authentik API" + default = True diff --git a/authentik/blueprints/tests/test_managed_app_config.py b/authentik/blueprints/tests/test_managed_app_config.py new file mode 100644 index 0000000000..7848110356 --- /dev/null +++ b/authentik/blueprints/tests/test_managed_app_config.py @@ -0,0 +1,14 @@ +from django.test import TestCase + +from authentik.blueprints.apps import ManagedAppConfig +from authentik.enterprise.apps import EnterpriseConfig +from authentik.lib.utils.reflection import get_apps + + +class TestManagedAppConfig(TestCase): + def test_apps_use_managed_app_config(self): + for app in get_apps(): + if app.name.startswith("authentik.enterprise"): + self.assertIn(EnterpriseConfig, app.__class__.__bases__) + else: + self.assertIn(ManagedAppConfig, app.__class__.__bases__) diff --git a/authentik/brands/apps.py b/authentik/brands/apps.py index ce9681396a..8daa0525a9 100644 --- a/authentik/brands/apps.py +++ b/authentik/brands/apps.py @@ -1,9 +1,9 @@ """authentik brands app""" -from django.apps import AppConfig +from authentik.blueprints.apps import ManagedAppConfig -class AuthentikBrandsConfig(AppConfig): +class AuthentikBrandsConfig(ManagedAppConfig): """authentik Brand app""" name = "authentik.brands" @@ -12,3 +12,4 @@ class AuthentikBrandsConfig(AppConfig): mountpoints = { "authentik.brands.urls_root": "", } + default = True diff --git a/authentik/policies/dummy/apps.py b/authentik/policies/dummy/apps.py index 32792df9a4..c136de0a44 100644 --- a/authentik/policies/dummy/apps.py +++ b/authentik/policies/dummy/apps.py @@ -1,11 +1,12 @@ """Authentik policy dummy app config""" -from django.apps import AppConfig +from authentik.blueprints.apps import ManagedAppConfig -class AuthentikPolicyDummyConfig(AppConfig): +class AuthentikPolicyDummyConfig(ManagedAppConfig): """Authentik policy_dummy app config""" name = "authentik.policies.dummy" label = "authentik_policies_dummy" verbose_name = "authentik Policies.Dummy" + default = True diff --git a/authentik/policies/event_matcher/apps.py b/authentik/policies/event_matcher/apps.py index 00a94c3a35..57ae14cbff 100644 --- a/authentik/policies/event_matcher/apps.py +++ b/authentik/policies/event_matcher/apps.py @@ -1,11 +1,12 @@ """authentik Event Matcher policy app config""" -from django.apps import AppConfig +from authentik.blueprints.apps import ManagedAppConfig -class AuthentikPoliciesEventMatcherConfig(AppConfig): +class AuthentikPoliciesEventMatcherConfig(ManagedAppConfig): """authentik Event Matcher policy app config""" name = "authentik.policies.event_matcher" label = "authentik_policies_event_matcher" verbose_name = "authentik Policies.Event Matcher" + default = True diff --git a/authentik/policies/expiry/apps.py b/authentik/policies/expiry/apps.py index db29f9fcee..9c7ff3aad3 100644 --- a/authentik/policies/expiry/apps.py +++ b/authentik/policies/expiry/apps.py @@ -1,11 +1,12 @@ """Authentik policy_expiry app config""" -from django.apps import AppConfig +from authentik.blueprints.apps import ManagedAppConfig -class AuthentikPolicyExpiryConfig(AppConfig): +class AuthentikPolicyExpiryConfig(ManagedAppConfig): """Authentik policy_expiry app config""" name = "authentik.policies.expiry" label = "authentik_policies_expiry" verbose_name = "authentik Policies.Expiry" + default = True diff --git a/authentik/policies/expression/apps.py b/authentik/policies/expression/apps.py index de7df61f90..44a614841a 100644 --- a/authentik/policies/expression/apps.py +++ b/authentik/policies/expression/apps.py @@ -1,11 +1,12 @@ """Authentik policy_expression app config""" -from django.apps import AppConfig +from authentik.blueprints.apps import ManagedAppConfig -class AuthentikPolicyExpressionConfig(AppConfig): +class AuthentikPolicyExpressionConfig(ManagedAppConfig): """Authentik policy_expression app config""" name = "authentik.policies.expression" label = "authentik_policies_expression" verbose_name = "authentik Policies.Expression" + default = True diff --git a/authentik/policies/geoip/apps.py b/authentik/policies/geoip/apps.py index ae64d29d4e..c6d62a5e90 100644 --- a/authentik/policies/geoip/apps.py +++ b/authentik/policies/geoip/apps.py @@ -1,11 +1,12 @@ """Authentik policy geoip app config""" -from django.apps import AppConfig +from authentik.blueprints.apps import ManagedAppConfig -class AuthentikPolicyGeoIPConfig(AppConfig): +class AuthentikPolicyGeoIPConfig(ManagedAppConfig): """Authentik policy_geoip app config""" name = "authentik.policies.geoip" label = "authentik_policies_geoip" verbose_name = "authentik Policies.GeoIP" + default = True diff --git a/authentik/policies/password/apps.py b/authentik/policies/password/apps.py index 7125647d79..bad9df2589 100644 --- a/authentik/policies/password/apps.py +++ b/authentik/policies/password/apps.py @@ -1,11 +1,12 @@ """authentik Password policy app config""" -from django.apps import AppConfig +from authentik.blueprints.apps import ManagedAppConfig -class AuthentikPoliciesPasswordConfig(AppConfig): +class AuthentikPoliciesPasswordConfig(ManagedAppConfig): """authentik Password policy app config""" name = "authentik.policies.password" label = "authentik_policies_password" verbose_name = "authentik Policies.Password" + default = True diff --git a/authentik/providers/ldap/apps.py b/authentik/providers/ldap/apps.py index ffd5d75310..69887fb2ed 100644 --- a/authentik/providers/ldap/apps.py +++ b/authentik/providers/ldap/apps.py @@ -1,11 +1,12 @@ """authentik ldap provider app config""" -from django.apps import AppConfig +from authentik.blueprints.apps import ManagedAppConfig -class AuthentikProviderLDAPConfig(AppConfig): +class AuthentikProviderLDAPConfig(ManagedAppConfig): """authentik ldap provider app config""" name = "authentik.providers.ldap" label = "authentik_providers_ldap" verbose_name = "authentik Providers.LDAP" + default = True diff --git a/authentik/providers/radius/apps.py b/authentik/providers/radius/apps.py index ac84219117..df5681c665 100644 --- a/authentik/providers/radius/apps.py +++ b/authentik/providers/radius/apps.py @@ -1,11 +1,12 @@ """authentik radius provider app config""" -from django.apps import AppConfig +from authentik.blueprints.apps import ManagedAppConfig -class AuthentikProviderRadiusConfig(AppConfig): +class AuthentikProviderRadiusConfig(ManagedAppConfig): """authentik radius provider app config""" name = "authentik.providers.radius" label = "authentik_providers_radius" verbose_name = "authentik Providers.Radius" + default = True diff --git a/authentik/providers/saml/apps.py b/authentik/providers/saml/apps.py index 1d6d9c5ed6..147f770864 100644 --- a/authentik/providers/saml/apps.py +++ b/authentik/providers/saml/apps.py @@ -1,12 +1,13 @@ """authentik SAML IdP app config""" -from django.apps import AppConfig +from authentik.blueprints.apps import ManagedAppConfig -class AuthentikProviderSAMLConfig(AppConfig): +class AuthentikProviderSAMLConfig(ManagedAppConfig): """authentik SAML IdP app config""" name = "authentik.providers.saml" label = "authentik_providers_saml" verbose_name = "authentik Providers.SAML" mountpoint = "application/saml/" + default = True diff --git a/authentik/recovery/apps.py b/authentik/recovery/apps.py index 85bbfa7b71..077706e165 100644 --- a/authentik/recovery/apps.py +++ b/authentik/recovery/apps.py @@ -1,12 +1,13 @@ """authentik Recovery app config""" -from django.apps import AppConfig +from authentik.blueprints.apps import ManagedAppConfig -class AuthentikRecoveryConfig(AppConfig): +class AuthentikRecoveryConfig(ManagedAppConfig): """authentik Recovery app config""" name = "authentik.recovery" label = "authentik_recovery" verbose_name = "authentik Recovery" mountpoint = "recovery/" + default = True diff --git a/authentik/sources/plex/apps.py b/authentik/sources/plex/apps.py index 2170a61dc8..47e59ab8b0 100644 --- a/authentik/sources/plex/apps.py +++ b/authentik/sources/plex/apps.py @@ -1,11 +1,12 @@ """authentik plex config""" -from django.apps import AppConfig +from authentik.blueprints.apps import ManagedAppConfig -class AuthentikSourcePlexConfig(AppConfig): +class AuthentikSourcePlexConfig(ManagedAppConfig): """authentik source plex config""" name = "authentik.sources.plex" label = "authentik_sources_plex" verbose_name = "authentik Sources.Plex" + default = True diff --git a/authentik/stages/authenticator/apps.py b/authentik/stages/authenticator/apps.py index dd33812bbf..58c67e9409 100644 --- a/authentik/stages/authenticator/apps.py +++ b/authentik/stages/authenticator/apps.py @@ -1,11 +1,12 @@ """Authenticator""" -from django.apps import AppConfig +from authentik.blueprints.apps import ManagedAppConfig -class AuthentikStageAuthenticatorConfig(AppConfig): +class AuthentikStageAuthenticatorConfig(ManagedAppConfig): """Authenticator App config""" name = "authentik.stages.authenticator" label = "authentik_stages_authenticator" verbose_name = "authentik Stages.Authenticator" + default = True diff --git a/authentik/stages/authenticator_sms/apps.py b/authentik/stages/authenticator_sms/apps.py index d5d6f749ee..4a14249dfe 100644 --- a/authentik/stages/authenticator_sms/apps.py +++ b/authentik/stages/authenticator_sms/apps.py @@ -1,11 +1,12 @@ """SMS""" -from django.apps import AppConfig +from authentik.blueprints.apps import ManagedAppConfig -class AuthentikStageAuthenticatorSMSConfig(AppConfig): +class AuthentikStageAuthenticatorSMSConfig(ManagedAppConfig): """SMS App config""" name = "authentik.stages.authenticator_sms" label = "authentik_stages_authenticator_sms" verbose_name = "authentik Stages.Authenticator.SMS" + default = True diff --git a/authentik/stages/authenticator_totp/apps.py b/authentik/stages/authenticator_totp/apps.py index 7e624a95dd..9818b87215 100644 --- a/authentik/stages/authenticator_totp/apps.py +++ b/authentik/stages/authenticator_totp/apps.py @@ -1,11 +1,12 @@ """TOTP""" -from django.apps import AppConfig +from authentik.blueprints.apps import ManagedAppConfig -class AuthentikStageAuthenticatorTOTPConfig(AppConfig): +class AuthentikStageAuthenticatorTOTPConfig(ManagedAppConfig): """TOTP App config""" name = "authentik.stages.authenticator_totp" label = "authentik_stages_authenticator_totp" verbose_name = "authentik Stages.Authenticator.TOTP" + default = True diff --git a/authentik/stages/authenticator_validate/apps.py b/authentik/stages/authenticator_validate/apps.py index 922440f955..143c8bc0dc 100644 --- a/authentik/stages/authenticator_validate/apps.py +++ b/authentik/stages/authenticator_validate/apps.py @@ -1,11 +1,12 @@ """Authenticator Validation Stage""" -from django.apps import AppConfig +from authentik.blueprints.apps import ManagedAppConfig -class AuthentikStageAuthenticatorValidateConfig(AppConfig): +class AuthentikStageAuthenticatorValidateConfig(ManagedAppConfig): """Authenticator Validation Stage""" name = "authentik.stages.authenticator_validate" label = "authentik_stages_authenticator_validate" verbose_name = "authentik Stages.Authenticator.Validate" + default = True diff --git a/authentik/stages/captcha/apps.py b/authentik/stages/captcha/apps.py index 26c454ec3f..8383e78ac1 100644 --- a/authentik/stages/captcha/apps.py +++ b/authentik/stages/captcha/apps.py @@ -1,11 +1,12 @@ """authentik captcha app""" -from django.apps import AppConfig +from authentik.blueprints.apps import ManagedAppConfig -class AuthentikStageCaptchaConfig(AppConfig): +class AuthentikStageCaptchaConfig(ManagedAppConfig): """authentik captcha app""" name = "authentik.stages.captcha" label = "authentik_stages_captcha" verbose_name = "authentik Stages.Captcha" + default = True diff --git a/authentik/stages/consent/apps.py b/authentik/stages/consent/apps.py index 0c0e664fb7..549ad6b322 100644 --- a/authentik/stages/consent/apps.py +++ b/authentik/stages/consent/apps.py @@ -1,11 +1,12 @@ """authentik consent app""" -from django.apps import AppConfig +from authentik.blueprints.apps import ManagedAppConfig -class AuthentikStageConsentConfig(AppConfig): +class AuthentikStageConsentConfig(ManagedAppConfig): """authentik consent app""" name = "authentik.stages.consent" label = "authentik_stages_consent" verbose_name = "authentik Stages.Consent" + default = True diff --git a/authentik/stages/deny/apps.py b/authentik/stages/deny/apps.py index 4b1e4a1709..bd03f5fccc 100644 --- a/authentik/stages/deny/apps.py +++ b/authentik/stages/deny/apps.py @@ -1,11 +1,12 @@ """authentik deny stage app config""" -from django.apps import AppConfig +from authentik.blueprints.apps import ManagedAppConfig -class AuthentikStageDenyConfig(AppConfig): +class AuthentikStageDenyConfig(ManagedAppConfig): """authentik deny stage config""" name = "authentik.stages.deny" label = "authentik_stages_deny" verbose_name = "authentik Stages.Deny" + default = True diff --git a/authentik/stages/dummy/apps.py b/authentik/stages/dummy/apps.py index 35f93e88c7..8ad8a6783a 100644 --- a/authentik/stages/dummy/apps.py +++ b/authentik/stages/dummy/apps.py @@ -1,11 +1,12 @@ """authentik dummy stage config""" -from django.apps import AppConfig +from authentik.blueprints.apps import ManagedAppConfig -class AuthentikStageDummyConfig(AppConfig): +class AuthentikStageDummyConfig(ManagedAppConfig): """authentik dummy stage config""" name = "authentik.stages.dummy" label = "authentik_stages_dummy" verbose_name = "authentik Stages.Dummy" + default = True diff --git a/authentik/stages/identification/apps.py b/authentik/stages/identification/apps.py index 184a52af77..d52c9c6310 100644 --- a/authentik/stages/identification/apps.py +++ b/authentik/stages/identification/apps.py @@ -1,11 +1,12 @@ """authentik identification stage app config""" -from django.apps import AppConfig +from authentik.blueprints.apps import ManagedAppConfig -class AuthentikStageIdentificationConfig(AppConfig): +class AuthentikStageIdentificationConfig(ManagedAppConfig): """authentik identification stage config""" name = "authentik.stages.identification" label = "authentik_stages_identification" verbose_name = "authentik Stages.Identification" + default = True diff --git a/authentik/stages/invitation/apps.py b/authentik/stages/invitation/apps.py index db3b53d787..389cb3d45b 100644 --- a/authentik/stages/invitation/apps.py +++ b/authentik/stages/invitation/apps.py @@ -1,11 +1,12 @@ """authentik invitation stage app config""" -from django.apps import AppConfig +from authentik.blueprints.apps import ManagedAppConfig -class AuthentikStageInvitationConfig(AppConfig): +class AuthentikStageInvitationConfig(ManagedAppConfig): """authentik invitation stage config""" name = "authentik.stages.invitation" label = "authentik_stages_invitation" verbose_name = "authentik Stages.Invitation" + default = True diff --git a/authentik/stages/password/apps.py b/authentik/stages/password/apps.py index d8231d7b72..674c66030c 100644 --- a/authentik/stages/password/apps.py +++ b/authentik/stages/password/apps.py @@ -1,11 +1,12 @@ """authentik core app config""" -from django.apps import AppConfig +from authentik.blueprints.apps import ManagedAppConfig -class AuthentikStagePasswordConfig(AppConfig): +class AuthentikStagePasswordConfig(ManagedAppConfig): """authentik password stage config""" name = "authentik.stages.password" label = "authentik_stages_password" verbose_name = "authentik Stages.Password" + default = True diff --git a/authentik/stages/prompt/apps.py b/authentik/stages/prompt/apps.py index d2f794ef76..5645f9e586 100644 --- a/authentik/stages/prompt/apps.py +++ b/authentik/stages/prompt/apps.py @@ -1,11 +1,12 @@ """authentik prompt stage app config""" -from django.apps import AppConfig +from authentik.blueprints.apps import ManagedAppConfig -class AuthentikStagePromptConfig(AppConfig): +class AuthentikStagePromptConfig(ManagedAppConfig): """authentik prompt stage config""" name = "authentik.stages.prompt" label = "authentik_stages_prompt" verbose_name = "authentik Stages.Prompt" + default = True diff --git a/authentik/stages/redirect/apps.py b/authentik/stages/redirect/apps.py index 782aab69b3..2b45267d14 100644 --- a/authentik/stages/redirect/apps.py +++ b/authentik/stages/redirect/apps.py @@ -1,11 +1,12 @@ """authentik redirect app""" -from django.apps import AppConfig +from authentik.blueprints.apps import ManagedAppConfig -class AuthentikStageRedirectConfig(AppConfig): +class AuthentikStageRedirectConfig(ManagedAppConfig): """authentik redirect app""" name = "authentik.stages.redirect" label = "authentik_stages_redirect" verbose_name = "authentik Stages.Redirect" + default = True diff --git a/authentik/stages/user_delete/apps.py b/authentik/stages/user_delete/apps.py index e73dbfaab9..b6342c6aad 100644 --- a/authentik/stages/user_delete/apps.py +++ b/authentik/stages/user_delete/apps.py @@ -1,11 +1,12 @@ """authentik delete stage app config""" -from django.apps import AppConfig +from authentik.blueprints.apps import ManagedAppConfig -class AuthentikStageUserDeleteConfig(AppConfig): +class AuthentikStageUserDeleteConfig(ManagedAppConfig): """authentik delete stage config""" name = "authentik.stages.user_delete" label = "authentik_stages_user_delete" verbose_name = "authentik Stages.User Delete" + default = True diff --git a/authentik/stages/user_login/apps.py b/authentik/stages/user_login/apps.py index a8a65ef4fe..2f8f3fad13 100644 --- a/authentik/stages/user_login/apps.py +++ b/authentik/stages/user_login/apps.py @@ -1,11 +1,12 @@ """authentik login stage app config""" -from django.apps import AppConfig +from authentik.blueprints.apps import ManagedAppConfig -class AuthentikStageUserLoginConfig(AppConfig): +class AuthentikStageUserLoginConfig(ManagedAppConfig): """authentik login stage config""" name = "authentik.stages.user_login" label = "authentik_stages_user_login" verbose_name = "authentik Stages.User Login" + default = True diff --git a/authentik/stages/user_logout/apps.py b/authentik/stages/user_logout/apps.py index 1388728a58..cea866fc5c 100644 --- a/authentik/stages/user_logout/apps.py +++ b/authentik/stages/user_logout/apps.py @@ -1,11 +1,12 @@ """authentik logout stage app config""" -from django.apps import AppConfig +from authentik.blueprints.apps import ManagedAppConfig -class AuthentikStageUserLogoutConfig(AppConfig): +class AuthentikStageUserLogoutConfig(ManagedAppConfig): """authentik logout stage config""" name = "authentik.stages.user_logout" label = "authentik_stages_user_logout" verbose_name = "authentik Stages.User Logout" + default = True diff --git a/authentik/stages/user_write/apps.py b/authentik/stages/user_write/apps.py index c5cbb244c5..6122c23b19 100644 --- a/authentik/stages/user_write/apps.py +++ b/authentik/stages/user_write/apps.py @@ -1,11 +1,12 @@ """authentik write stage app config""" -from django.apps import AppConfig +from authentik.blueprints.apps import ManagedAppConfig -class AuthentikStageUserWriteConfig(AppConfig): +class AuthentikStageUserWriteConfig(ManagedAppConfig): """authentik write stage config""" name = "authentik.stages.user_write" label = "authentik_stages_user_write" verbose_name = "authentik Stages.User Write" + default = True