From 226c69d213cd373e7f609d26806faccba98ee250 Mon Sep 17 00:00:00 2001 From: Dominic R Date: Wed, 10 Jun 2026 12:31:48 -0400 Subject: [PATCH] core, web: Remove stale compatibility paths (#22192) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Remove stale compatibility paths * fix schema * should have vibecoded this --------- Co-authored-by: Simonyi Gergő <28359278+gergosimonyi@users.noreply.github.com> --- .../tests/fixtures/conditional_fields.yaml | 2 +- authentik/events/apps.py | 7 ------ authentik/events/logs.py | 9 -------- authentik/sources/oauth/apps.py | 1 - .../0014_migrate_azuread_to_entraid.py | 23 +++++++++++++++++++ authentik/sources/oauth/models.py | 11 --------- authentik/sources/oauth/types/azure_ad.py | 17 -------------- blueprints/schema.json | 3 +-- .../client-ts/src/models/ProviderTypeEnum.ts | 3 +-- schema.yml | 3 +-- .../sources/oauth/OAuthSourceViewPage.ts | 2 -- .../AuthenticatorValidateStageForm.ts | 9 -------- 12 files changed, 27 insertions(+), 63 deletions(-) create mode 100644 authentik/sources/oauth/migrations/0014_migrate_azuread_to_entraid.py delete mode 100644 authentik/sources/oauth/types/azure_ad.py diff --git a/authentik/blueprints/tests/fixtures/conditional_fields.yaml b/authentik/blueprints/tests/fixtures/conditional_fields.yaml index 4e87f5f155..481454f4b4 100644 --- a/authentik/blueprints/tests/fixtures/conditional_fields.yaml +++ b/authentik/blueprints/tests/fixtures/conditional_fields.yaml @@ -31,7 +31,7 @@ entries: slug: "%(uid)s-source" attrs: name: "%(uid)s-source" - provider_type: azuread + provider_type: entraid consumer_key: "%(uid)s" consumer_secret: "%(uid)s" icon: https://goauthentik.io/img/icon.png diff --git a/authentik/events/apps.py b/authentik/events/apps.py index ccca6df76b..df77288763 100644 --- a/authentik/events/apps.py +++ b/authentik/events/apps.py @@ -7,13 +7,6 @@ from authentik.lib.config import CONFIG, ENV_PREFIX from authentik.lib.utils.time import fqdn_rand from authentik.tasks.schedules.common import ScheduleSpec -# TODO: Deprecated metric - remove in 2024.2 or later -GAUGE_TASKS = Gauge( - "authentik_system_tasks", - "System tasks and their status", - ["tenant", "task_name", "task_uid", "status"], -) - SYSTEM_TASK_TIME = Histogram( "authentik_system_tasks_time_seconds", "Runtime of system tasks", diff --git a/authentik/events/logs.py b/authentik/events/logs.py index 09b8148283..bcf665fc44 100644 --- a/authentik/events/logs.py +++ b/authentik/events/logs.py @@ -49,15 +49,6 @@ class LogEventSerializer(PassiveSerializer): event = CharField() attributes = DictField() - # TODO(2024.6?): This is a migration helper to return a correct API response for logs that - # have been saved in an older format (mostly just list[str] with just the messages) - def to_representation(self, instance): - if isinstance(instance, str): - instance = LogEvent(instance, "", "") - elif isinstance(instance, list): - instance = [LogEvent(x, "", "") for x in instance] - return super().to_representation(instance) - @contextmanager def capture_logs(log_default_output=True) -> Generator[list[LogEvent]]: diff --git a/authentik/sources/oauth/apps.py b/authentik/sources/oauth/apps.py index 032154c48f..dedd69246a 100644 --- a/authentik/sources/oauth/apps.py +++ b/authentik/sources/oauth/apps.py @@ -10,7 +10,6 @@ LOGGER = get_logger() AUTHENTIK_SOURCES_OAUTH_TYPES = [ "authentik.sources.oauth.types.apple", - "authentik.sources.oauth.types.azure_ad", "authentik.sources.oauth.types.discord", "authentik.sources.oauth.types.entra_id", "authentik.sources.oauth.types.facebook", diff --git a/authentik/sources/oauth/migrations/0014_migrate_azuread_to_entraid.py b/authentik/sources/oauth/migrations/0014_migrate_azuread_to_entraid.py new file mode 100644 index 0000000000..944d1c6bf2 --- /dev/null +++ b/authentik/sources/oauth/migrations/0014_migrate_azuread_to_entraid.py @@ -0,0 +1,23 @@ +# Generated by Django 5.2.14 on 2026-05-09 19:01 + +from django.db import migrations + + +def migrate_azuread_to_entraid(apps, schema_editor): + OAuthSource = apps.get_model("authentik_sources_oauth", "OAuthSource") + + db_alias = schema_editor.connection.alias + OAuthSource.objects.using(db_alias).filter(provider_type="azuread").update( + provider_type="entraid" + ) + + +class Migration(migrations.Migration): + + dependencies = [ + ("authentik_sources_oauth", "0013_useroauthsourceconnection_refresh_token"), + ] + + operations = [ + migrations.RunPython(migrate_azuread_to_entraid, migrations.RunPython.noop), + ] diff --git a/authentik/sources/oauth/models.py b/authentik/sources/oauth/models.py index 3e57e0e4d8..ec35e96f6a 100644 --- a/authentik/sources/oauth/models.py +++ b/authentik/sources/oauth/models.py @@ -251,17 +251,6 @@ class GoogleOAuthSource(CreatableType, OAuthSource): verbose_name_plural = _("Google OAuth Sources") -class AzureADOAuthSource(CreatableType, OAuthSource): - """(Deprecated) Social Login using Azure AD.""" - - class Meta: - abstract = True - verbose_name = _("Azure AD OAuth Source") - verbose_name_plural = _("Azure AD OAuth Sources") - - -# TODO: When removing this, add a migration for OAuthSource that sets -# provider_type to `entraid` if it is currently `azuread` class EntraIDOAuthSource(CreatableType, OAuthSource): """Social Login using Entra ID.""" diff --git a/authentik/sources/oauth/types/azure_ad.py b/authentik/sources/oauth/types/azure_ad.py deleted file mode 100644 index 34680b3569..0000000000 --- a/authentik/sources/oauth/types/azure_ad.py +++ /dev/null @@ -1,17 +0,0 @@ -"""AzureAD OAuth2 Views""" - -from authentik.sources.oauth.types.entra_id import EntraIDType -from authentik.sources.oauth.types.registry import registry - -# TODO: When removing this, add a migration for OAuthSource that sets -# provider_type to `entraid` if it is currently `azuread` - - -@registry.register() -class AzureADType(EntraIDType): - """Azure AD Type definition""" - - verbose_name = "Azure AD" - name = "azuread" - - urls_customizable = True diff --git a/blueprints/schema.json b/blueprints/schema.json index 418f243020..03bd2a617c 100644 --- a/blueprints/schema.json +++ b/blueprints/schema.json @@ -12945,10 +12945,9 @@ "type": "string", "enum": [ "apple", + "discord", "openidconnect", "entraid", - "azuread", - "discord", "facebook", "github", "gitlab", diff --git a/packages/client-ts/src/models/ProviderTypeEnum.ts b/packages/client-ts/src/models/ProviderTypeEnum.ts index 8332d3668c..d5c0c5f8b4 100644 --- a/packages/client-ts/src/models/ProviderTypeEnum.ts +++ b/packages/client-ts/src/models/ProviderTypeEnum.ts @@ -18,10 +18,9 @@ */ export const ProviderTypeEnum = { Apple: "apple", + Discord: "discord", Openidconnect: "openidconnect", Entraid: "entraid", - Azuread: "azuread", - Discord: "discord", Facebook: "facebook", Github: "github", Gitlab: "gitlab", diff --git a/schema.yml b/schema.yml index 80ccf73303..6a3f2c51c1 100644 --- a/schema.yml +++ b/schema.yml @@ -52664,10 +52664,9 @@ components: ProviderTypeEnum: enum: - apple + - discord - openidconnect - entraid - - azuread - - discord - facebook - github - gitlab diff --git a/web/src/admin/sources/oauth/OAuthSourceViewPage.ts b/web/src/admin/sources/oauth/OAuthSourceViewPage.ts index a3d130a41e..317d50bea6 100644 --- a/web/src/admin/sources/oauth/OAuthSourceViewPage.ts +++ b/web/src/admin/sources/oauth/OAuthSourceViewPage.ts @@ -37,8 +37,6 @@ export function ProviderToLabel(provider?: ProviderTypeEnum): string { return ""; case ProviderTypeEnum.Apple: return "Apple"; - case ProviderTypeEnum.Azuread: - return "Azure Active Directory (Deprecated)"; case ProviderTypeEnum.Discord: return "Discord"; case ProviderTypeEnum.Facebook: diff --git a/web/src/admin/stages/authenticator_validate/AuthenticatorValidateStageForm.ts b/web/src/admin/stages/authenticator_validate/AuthenticatorValidateStageForm.ts index 1989210307..bf1cb5db7d 100644 --- a/web/src/admin/stages/authenticator_validate/AuthenticatorValidateStageForm.ts +++ b/web/src/admin/stages/authenticator_validate/AuthenticatorValidateStageForm.ts @@ -1,5 +1,4 @@ import "#elements/ak-checkbox-group/ak-checkbox-group"; -import "#elements/Alert"; import "#elements/ak-dual-select/ak-dual-select-dynamic-selected-provider"; import "#elements/ak-dual-select/ak-dual-select-provider"; import "#elements/forms/FormGroup"; @@ -362,14 +361,6 @@ export class AuthenticatorValidateStageForm extends BaseStageForm - - ${ - /* TODO: Remove this after 2024.6..or maybe later? */ - msg( - "This restriction only applies to devices created in authentik 2024.4 or later.", - ) - } -