diff --git a/authentik/blueprints/api.py b/authentik/blueprints/api.py index c805990e1..2e2f02663 100644 --- a/authentik/blueprints/api.py +++ b/authentik/blueprints/api.py @@ -58,7 +58,6 @@ class BlueprintInstanceSerializer(ModelSerializer): return super().validate(attrs) class Meta: - model = BlueprintInstance fields = [ "pk", diff --git a/authentik/blueprints/migrations/0001_initial.py b/authentik/blueprints/migrations/0001_initial.py index 583ea9123..7b246b0cd 100644 --- a/authentik/blueprints/migrations/0001_initial.py +++ b/authentik/blueprints/migrations/0001_initial.py @@ -71,7 +71,6 @@ def migration_blueprint_import(apps: Apps, schema_editor: BaseDatabaseSchemaEdit class Migration(migrations.Migration): - initial = True dependencies = [("authentik_flows", "0001_initial")] @@ -86,7 +85,12 @@ class Migration(migrations.Migration): "managed", models.TextField( default=None, - help_text="Objects which are managed by authentik. These objects are created and updated automatically. This is flag only indicates that an object can be overwritten by migrations. You can still modify the objects via the API, but expect changes to be overwritten in a later update.", + help_text=( + "Objects which are managed by authentik. These objects are created and" + " updated automatically. This is flag only indicates that an object can" + " be overwritten by migrations. You can still modify the objects via" + " the API, but expect changes to be overwritten in a later update." + ), null=True, unique=True, verbose_name="Managed by authentik", diff --git a/authentik/blueprints/migrations/0002_blueprintinstance_content.py b/authentik/blueprints/migrations/0002_blueprintinstance_content.py index ba11effc0..f842e2cb1 100644 --- a/authentik/blueprints/migrations/0002_blueprintinstance_content.py +++ b/authentik/blueprints/migrations/0002_blueprintinstance_content.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_blueprints", "0001_initial"), ] diff --git a/authentik/blueprints/models.py b/authentik/blueprints/models.py index a8a7a2e93..1a2171f75 100644 --- a/authentik/blueprints/models.py +++ b/authentik/blueprints/models.py @@ -29,18 +29,15 @@ class ManagedModel(models.Model): null=True, verbose_name=_("Managed by authentik"), help_text=_( - ( - "Objects which are managed by authentik. These objects are created and updated " - "automatically. This is flag only indicates that an object can be overwritten by " - "migrations. You can still modify the objects via the API, but expect changes " - "to be overwritten in a later update." - ) + "Objects which are managed by authentik. These objects are created and updated " + "automatically. This is flag only indicates that an object can be overwritten by " + "migrations. You can still modify the objects via the API, but expect changes " + "to be overwritten in a later update." ), unique=True, ) class Meta: - abstract = True @@ -109,7 +106,6 @@ class BlueprintInstance(SerializerModel, ManagedModel, CreatedUpdatedModel): return f"Blueprint Instance {self.name}" class Meta: - verbose_name = _("Blueprint Instance") verbose_name_plural = _("Blueprint Instances") unique_together = ( diff --git a/authentik/blueprints/tests/test_v1.py b/authentik/blueprints/tests/test_v1.py index a3d06dbc1..b5f6a252a 100644 --- a/authentik/blueprints/tests/test_v1.py +++ b/authentik/blueprints/tests/test_v1.py @@ -24,18 +24,14 @@ class TestBlueprintsV1(TransactionTestCase): importer = Importer('{"version": 3}') self.assertFalse(importer.validate()[0]) importer = Importer( - ( - '{"version": 1,"entries":[{"identifiers":{},"attrs":{},' - '"model": "authentik_core.User"}]}' - ) + '{"version": 1,"entries":[{"identifiers":{},"attrs":{},' + '"model": "authentik_core.User"}]}' ) self.assertFalse(importer.validate()[0]) importer = Importer( - ( - '{"version": 1, "entries": [{"attrs": {"name": "test"}, ' - '"identifiers": {}, ' - '"model": "authentik_core.Group"}]}' - ) + '{"version": 1, "entries": [{"attrs": {"name": "test"}, ' + '"identifiers": {}, ' + '"model": "authentik_core.Group"}]}' ) self.assertFalse(importer.validate()[0]) @@ -59,11 +55,9 @@ class TestBlueprintsV1(TransactionTestCase): ) importer = Importer( - ( - '{"version": 1, "entries": [{"attrs": {"name": "test999", "attributes": ' - '{"key": ["updated_value"]}}, "identifiers": {"attributes": {"other_key": ' - '["other_value"]}}, "model": "authentik_core.Group"}]}' - ) + '{"version": 1, "entries": [{"attrs": {"name": "test999", "attributes": ' + '{"key": ["updated_value"]}}, "identifiers": {"attributes": {"other_key": ' + '["other_value"]}}, "model": "authentik_core.Group"}]}' ) self.assertTrue(importer.validate()[0]) self.assertTrue(importer.apply()) diff --git a/authentik/blueprints/v1/meta/apply_blueprint.py b/authentik/blueprints/v1/meta/apply_blueprint.py index 770882d77..a825cb53f 100644 --- a/authentik/blueprints/v1/meta/apply_blueprint.py +++ b/authentik/blueprints/v1/meta/apply_blueprint.py @@ -56,5 +56,4 @@ class MetaApplyBlueprint(BaseMetaModel): return ApplyBlueprintMetaSerializer class Meta: - abstract = True diff --git a/authentik/blueprints/v1/meta/registry.py b/authentik/blueprints/v1/meta/registry.py index 4ef0706fc..70e409f9c 100644 --- a/authentik/blueprints/v1/meta/registry.py +++ b/authentik/blueprints/v1/meta/registry.py @@ -14,7 +14,6 @@ class BaseMetaModel(Model): raise NotImplementedError class Meta: - abstract = True diff --git a/authentik/core/api/applications.py b/authentik/core/api/applications.py index 7955fa035..728f11ed9 100644 --- a/authentik/core/api/applications.py +++ b/authentik/core/api/applications.py @@ -63,7 +63,6 @@ class ApplicationSerializer(ModelSerializer): return app.get_launch_url(user) class Meta: - model = Application fields = [ "pk", diff --git a/authentik/core/api/authenticated_sessions.py b/authentik/core/api/authenticated_sessions.py index ba4546e7e..03c1aeaf3 100644 --- a/authentik/core/api/authenticated_sessions.py +++ b/authentik/core/api/authenticated_sessions.py @@ -74,7 +74,6 @@ class AuthenticatedSessionSerializer(ModelSerializer): return GEOIP_READER.city_dict(instance.last_ip) class Meta: - model = AuthenticatedSession fields = [ "uuid", diff --git a/authentik/core/api/groups.py b/authentik/core/api/groups.py index 71759a2f2..8f3819761 100644 --- a/authentik/core/api/groups.py +++ b/authentik/core/api/groups.py @@ -29,7 +29,6 @@ class GroupMemberSerializer(ModelSerializer): uid = CharField(read_only=True) class Meta: - model = User fields = [ "pk", @@ -56,7 +55,6 @@ class GroupSerializer(ModelSerializer): num_pk = IntegerField(read_only=True) class Meta: - model = Group fields = [ "pk", @@ -114,7 +112,6 @@ class GroupFilter(FilterSet): return queryset class Meta: - model = Group fields = ["name", "is_superuser", "members_by_pk", "attributes", "members_by_username"] diff --git a/authentik/core/api/propertymappings.py b/authentik/core/api/propertymappings.py index b98d61eea..2fab3a233 100644 --- a/authentik/core/api/propertymappings.py +++ b/authentik/core/api/propertymappings.py @@ -49,7 +49,6 @@ class PropertyMappingSerializer(ManagedSerializer, ModelSerializer, MetaNameSeri return expression class Meta: - model = PropertyMapping fields = [ "pk", diff --git a/authentik/core/api/providers.py b/authentik/core/api/providers.py index 4381837d0..88e12a698 100644 --- a/authentik/core/api/providers.py +++ b/authentik/core/api/providers.py @@ -31,7 +31,6 @@ class ProviderSerializer(ModelSerializer, MetaNameSerializer): return obj.component class Meta: - model = Provider fields = [ "pk", diff --git a/authentik/core/api/sources.py b/authentik/core/api/sources.py index 1d36d8a4e..ffbdce1d1 100644 --- a/authentik/core/api/sources.py +++ b/authentik/core/api/sources.py @@ -46,7 +46,6 @@ class SourceSerializer(ModelSerializer, MetaNameSerializer): return obj.component class Meta: - model = Source fields = [ "pk", diff --git a/authentik/core/api/tokens.py b/authentik/core/api/tokens.py index 96111e7fa..ed69cd8c9 100644 --- a/authentik/core/api/tokens.py +++ b/authentik/core/api/tokens.py @@ -39,7 +39,6 @@ class TokenSerializer(ManagedSerializer, ModelSerializer): return attrs class Meta: - model = Token fields = [ "pk", diff --git a/authentik/core/api/users.py b/authentik/core/api/users.py index d1e47f2c6..17f784304 100644 --- a/authentik/core/api/users.py +++ b/authentik/core/api/users.py @@ -84,7 +84,6 @@ class UserGroupSerializer(ModelSerializer): parent_name = CharField(source="parent.name", read_only=True) class Meta: - model = Group fields = [ "pk", @@ -120,7 +119,6 @@ class UserSerializer(ModelSerializer): return path class Meta: - model = User fields = [ "pk", @@ -172,7 +170,6 @@ class UserSelfSerializer(ModelSerializer): return user.group_attributes(self._context["request"]).get("settings", {}) class Meta: - model = User fields = [ "pk", @@ -402,7 +399,7 @@ class UserViewSet(UsedByMixin, ModelViewSet): ) response["token"] = token.key return Response(response) - except (IntegrityError) as exc: + except IntegrityError as exc: return Response(data={"non_field_errors": [str(exc)]}, status=400) @extend_schema(responses={200: SessionUserSerializer(many=False)}) diff --git a/authentik/core/migrations/0001_initial.py b/authentik/core/migrations/0001_initial.py index fb4e18297..7053d073f 100644 --- a/authentik/core/migrations/0001_initial.py +++ b/authentik/core/migrations/0001_initial.py @@ -14,7 +14,6 @@ import authentik.core.models class Migration(migrations.Migration): - initial = True dependencies = [ @@ -44,7 +43,10 @@ class Migration(migrations.Migration): "is_superuser", models.BooleanField( default=False, - help_text="Designates that this user has all permissions without explicitly assigning them.", + help_text=( + "Designates that this user has all permissions without explicitly" + " assigning them." + ), verbose_name="superuser status", ), ), @@ -52,7 +54,9 @@ class Migration(migrations.Migration): "username", models.CharField( error_messages={"unique": "A user with that username already exists."}, - help_text="Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.", + help_text=( + "Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only." + ), max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], @@ -83,7 +87,10 @@ class Migration(migrations.Migration): "is_active", models.BooleanField( default=True, - help_text="Designates whether this user should be treated as active. Unselect this instead of deleting accounts.", + help_text=( + "Designates whether this user should be treated as active. Unselect" + " this instead of deleting accounts." + ), verbose_name="active", ), ), diff --git a/authentik/core/migrations/0002_auto_20200523_1133_squashed_0011_provider_name_temp.py b/authentik/core/migrations/0002_auto_20200523_1133_squashed_0011_provider_name_temp.py index 242e0c141..103202072 100644 --- a/authentik/core/migrations/0002_auto_20200523_1133_squashed_0011_provider_name_temp.py +++ b/authentik/core/migrations/0002_auto_20200523_1133_squashed_0011_provider_name_temp.py @@ -51,7 +51,6 @@ def create_default_admin_group(apps: Apps, schema_editor: BaseDatabaseSchemaEdit class Migration(migrations.Migration): - replaces = [ ("authentik_core", "0002_auto_20200523_1133"), ("authentik_core", "0003_default_user"), @@ -172,7 +171,10 @@ class Migration(migrations.Migration): name="groups", field=models.ManyToManyField( blank=True, - help_text="The groups this user belongs to. A user will get all permissions granted to each of their groups.", + help_text=( + "The groups this user belongs to. A user will get all permissions granted to" + " each of their groups." + ), related_name="user_set", related_query_name="user", to="auth.Group", diff --git a/authentik/core/migrations/0012_auto_20201003_1737_squashed_0016_auto_20201202_2234.py b/authentik/core/migrations/0012_auto_20201003_1737_squashed_0016_auto_20201202_2234.py index 13366a547..8d1d0dd97 100644 --- a/authentik/core/migrations/0012_auto_20201003_1737_squashed_0016_auto_20201202_2234.py +++ b/authentik/core/migrations/0012_auto_20201003_1737_squashed_0016_auto_20201202_2234.py @@ -17,7 +17,6 @@ def set_default_token_key(apps: Apps, schema_editor: BaseDatabaseSchemaEditor): class Migration(migrations.Migration): - replaces = [ ("authentik_core", "0012_auto_20201003_1737"), ("authentik_core", "0013_auto_20201003_2132"), diff --git a/authentik/core/migrations/0017_managed.py b/authentik/core/migrations/0017_managed.py index e5aa723fe..5ae6ad05f 100644 --- a/authentik/core/migrations/0017_managed.py +++ b/authentik/core/migrations/0017_managed.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_core", "0016_auto_20201202_2234"), ] @@ -15,7 +14,12 @@ class Migration(migrations.Migration): name="managed", field=models.TextField( default=None, - help_text="Objects which are managed by authentik. These objects are created and updated automatically. This is flag only indicates that an object can be overwritten by migrations. You can still modify the objects via the API, but expect changes to be overwritten in a later update.", + help_text=( + "Objects which are managed by authentik. These objects are created and updated" + " automatically. This is flag only indicates that an object can be overwritten" + " by migrations. You can still modify the objects via the API, but expect" + " changes to be overwritten in a later update." + ), null=True, verbose_name="Managed by authentik", unique=True, @@ -26,7 +30,12 @@ class Migration(migrations.Migration): name="managed", field=models.TextField( default=None, - help_text="Objects which are managed by authentik. These objects are created and updated automatically. This is flag only indicates that an object can be overwritten by migrations. You can still modify the objects via the API, but expect changes to be overwritten in a later update.", + help_text=( + "Objects which are managed by authentik. These objects are created and updated" + " automatically. This is flag only indicates that an object can be overwritten" + " by migrations. You can still modify the objects via the API, but expect" + " changes to be overwritten in a later update." + ), null=True, verbose_name="Managed by authentik", unique=True, diff --git a/authentik/core/migrations/0018_auto_20210330_1345_squashed_0028_alter_token_intent.py b/authentik/core/migrations/0018_auto_20210330_1345_squashed_0028_alter_token_intent.py index c24c37858..dac724a80 100644 --- a/authentik/core/migrations/0018_auto_20210330_1345_squashed_0028_alter_token_intent.py +++ b/authentik/core/migrations/0018_auto_20210330_1345_squashed_0028_alter_token_intent.py @@ -63,7 +63,6 @@ def create_default_user_token(apps: Apps, schema_editor: BaseDatabaseSchemaEdito class Migration(migrations.Migration): - replaces = [ ("authentik_core", "0018_auto_20210330_1345"), ("authentik_core", "0019_source_managed"), @@ -96,7 +95,12 @@ class Migration(migrations.Migration): name="managed", field=models.TextField( default=None, - help_text="Objects which are managed by authentik. These objects are created and updated automatically. This is flag only indicates that an object can be overwritten by migrations. You can still modify the objects via the API, but expect changes to be overwritten in a later update.", + help_text=( + "Objects which are managed by authentik. These objects are created and updated" + " automatically. This is flag only indicates that an object can be overwritten" + " by migrations. You can still modify the objects via the API, but expect" + " changes to be overwritten in a later update." + ), null=True, unique=True, verbose_name="Managed by authentik", @@ -110,23 +114,38 @@ class Migration(migrations.Migration): ("identifier", "Use the source-specific identifier"), ( "email_link", - "Link to a user with identical email address. Can have security implications when a source doesn't validate email addresses.", + ( + "Link to a user with identical email address. Can have security" + " implications when a source doesn't validate email addresses." + ), ), ( "email_deny", - "Use the user's email address, but deny enrollment when the email address already exists.", + ( + "Use the user's email address, but deny enrollment when the email" + " address already exists." + ), ), ( "username_link", - "Link to a user with identical username. Can have security implications when a username is used with another source.", + ( + "Link to a user with identical username. Can have security implications" + " when a username is used with another source." + ), ), ( "username_deny", - "Use the user's username, but deny enrollment when the username already exists.", + ( + "Use the user's username, but deny enrollment when the username already" + " exists." + ), ), ], default="identifier", - help_text="How the source determines if an existing user should be authenticated or a new user enrolled.", + help_text=( + "How the source determines if an existing user should be authenticated or a new" + " user enrolled." + ), ), ), migrations.AlterField( diff --git a/authentik/core/migrations/0019_application_group.py b/authentik/core/migrations/0019_application_group.py index 552d0358a..747f2c54c 100644 --- a/authentik/core/migrations/0019_application_group.py +++ b/authentik/core/migrations/0019_application_group.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_core", "0018_auto_20210330_1345_squashed_0028_alter_token_intent"), ] diff --git a/authentik/core/migrations/0020_application_open_in_new_tab.py b/authentik/core/migrations/0020_application_open_in_new_tab.py index 411ce9103..50d581b1f 100644 --- a/authentik/core/migrations/0020_application_open_in_new_tab.py +++ b/authentik/core/migrations/0020_application_open_in_new_tab.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_core", "0019_application_group"), ] diff --git a/authentik/core/migrations/0021_source_user_path_user_path.py b/authentik/core/migrations/0021_source_user_path_user_path.py index 9409962c8..1e6e3c38a 100644 --- a/authentik/core/migrations/0021_source_user_path_user_path.py +++ b/authentik/core/migrations/0021_source_user_path_user_path.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_core", "0020_application_open_in_new_tab"), ] diff --git a/authentik/core/migrations/0022_alter_group_parent.py b/authentik/core/migrations/0022_alter_group_parent.py index 1392f3c7c..4f1de9a8d 100644 --- a/authentik/core/migrations/0022_alter_group_parent.py +++ b/authentik/core/migrations/0022_alter_group_parent.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_core", "0021_source_user_path_user_path"), ] diff --git a/authentik/core/migrations/0023_source_authentik_c_slug_ccb2e5_idx_and_more.py b/authentik/core/migrations/0023_source_authentik_c_slug_ccb2e5_idx_and_more.py index 4711a9680..f22da4691 100644 --- a/authentik/core/migrations/0023_source_authentik_c_slug_ccb2e5_idx_and_more.py +++ b/authentik/core/migrations/0023_source_authentik_c_slug_ccb2e5_idx_and_more.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_core", "0022_alter_group_parent"), ] diff --git a/authentik/core/migrations/0024_source_icon.py b/authentik/core/migrations/0024_source_icon.py index 79347b67e..f18bc7332 100644 --- a/authentik/core/migrations/0024_source_icon.py +++ b/authentik/core/migrations/0024_source_icon.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_core", "0023_source_authentik_c_slug_ccb2e5_idx_and_more"), ] diff --git a/authentik/core/models.py b/authentik/core/models.py index 687492be1..a1f41f02d 100644 --- a/authentik/core/models.py +++ b/authentik/core/models.py @@ -129,7 +129,6 @@ class Group(SerializerModel): return f"Group {self.name}" class Meta: - unique_together = ( ( "name", @@ -255,7 +254,6 @@ class User(SerializerModel, GuardianUserMixin, AbstractUser): } class Meta: - permissions = ( ("reset_user_password", "Reset Password"), ("impersonate", "Can impersonate other users"), @@ -382,7 +380,6 @@ class Application(SerializerModel, PolicyBindingModel): return str(self.name) class Meta: - verbose_name = _("Application") verbose_name_plural = _("Applications") @@ -392,19 +389,15 @@ class SourceUserMatchingModes(models.TextChoices): IDENTIFIER = "identifier", _("Use the source-specific identifier") EMAIL_LINK = "email_link", _( - ( - "Link to a user with identical email address. Can have security implications " - "when a source doesn't validate email addresses." - ) + "Link to a user with identical email address. Can have security implications " + "when a source doesn't validate email addresses." ) EMAIL_DENY = "email_deny", _( "Use the user's email address, but deny enrollment when the email address already exists." ) USERNAME_LINK = "username_link", _( - ( - "Link to a user with identical username. Can have security implications " - "when a username is used with another source." - ) + "Link to a user with identical username. Can have security implications " + "when a username is used with another source." ) USERNAME_DENY = "username_deny", _( "Use the user's username, but deny enrollment when the username already exists." @@ -451,10 +444,8 @@ class Source(ManagedModel, SerializerModel, PolicyBindingModel): choices=SourceUserMatchingModes.choices, default=SourceUserMatchingModes.IDENTIFIER, help_text=_( - ( - "How the source determines if an existing user should be authenticated or " - "a new user enrolled." - ) + "How the source determines if an existing user should be authenticated or " + "a new user enrolled." ), ) @@ -500,7 +491,6 @@ class Source(ManagedModel, SerializerModel, PolicyBindingModel): return str(self.name) class Meta: - indexes = [ models.Index( fields=[ @@ -529,7 +519,6 @@ class UserSourceConnection(SerializerModel, CreatedUpdatedModel): raise NotImplementedError class Meta: - unique_together = (("user", "source"),) @@ -562,7 +551,6 @@ class ExpiringModel(models.Model): return now() > self.expires class Meta: - abstract = True @@ -628,7 +616,6 @@ class Token(SerializerModel, ManagedModel, ExpiringModel): return description class Meta: - verbose_name = _("Token") verbose_name_plural = _("Tokens") indexes = [ @@ -671,7 +658,6 @@ class PropertyMapping(SerializerModel, ManagedModel): return f"Property Mapping {self.name}" class Meta: - verbose_name = _("Property Mapping") verbose_name_plural = _("Property Mappings") @@ -708,6 +694,5 @@ class AuthenticatedSession(ExpiringModel): ) class Meta: - verbose_name = _("Authenticated Session") verbose_name_plural = _("Authenticated Sessions") diff --git a/authentik/core/sources/flow_manager.py b/authentik/core/sources/flow_manager.py index 15ec5d790..317e3062c 100644 --- a/authentik/core/sources/flow_manager.py +++ b/authentik/core/sources/flow_manager.py @@ -190,11 +190,8 @@ class SourceFlowManager: # Default case, assume deny error = Exception( _( - ( - "Request to authenticate with %(source)s has been denied. Please authenticate " - "with the source you've previously signed up with." - ) - % {"source": self.source.name} + "Request to authenticate with %(source)s has been denied. Please authenticate " + "with the source you've previously signed up with." % {"source": self.source.name} ), ) return self.error_handler(error) diff --git a/authentik/core/tests/test_token_api.py b/authentik/core/tests/test_token_api.py index f1a718688..bb57466d4 100644 --- a/authentik/core/tests/test_token_api.py +++ b/authentik/core/tests/test_token_api.py @@ -80,7 +80,7 @@ class TestTokenAPI(APITestCase): identifier="test", expiring=False, user=self.user ) Token.objects.create(identifier="test-2", expiring=False, user=get_anonymous_user()) - response = self.client.get(reverse(("authentik_api:token-list"))) + response = self.client.get(reverse("authentik_api:token-list")) body = loads(response.content) self.assertEqual(len(body["results"]), 1) self.assertEqual(body["results"][0]["identifier"], token_should.identifier) @@ -94,7 +94,7 @@ class TestTokenAPI(APITestCase): token_should_not: Token = Token.objects.create( identifier="test-2", expiring=False, user=get_anonymous_user() ) - response = self.client.get(reverse(("authentik_api:token-list"))) + response = self.client.get(reverse("authentik_api:token-list")) body = loads(response.content) self.assertEqual(len(body["results"]), 2) self.assertEqual(body["results"][0]["identifier"], token_should.identifier) diff --git a/authentik/crypto/api.py b/authentik/crypto/api.py index ed6d05a7e..f5c20ebf3 100644 --- a/authentik/crypto/api.py +++ b/authentik/crypto/api.py @@ -143,7 +143,6 @@ class CertificateKeyPairSerializer(ModelSerializer): return value class Meta: - model = CertificateKeyPair fields = [ "pk", diff --git a/authentik/crypto/migrations/0001_initial.py b/authentik/crypto/migrations/0001_initial.py index e4fa17055..168c155fe 100644 --- a/authentik/crypto/migrations/0001_initial.py +++ b/authentik/crypto/migrations/0001_initial.py @@ -6,7 +6,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [] @@ -36,7 +35,10 @@ class Migration(migrations.Migration): models.TextField( blank=True, default="", - help_text="Optional Private Key. If this is set, you can use this keypair for encryption.", + help_text=( + "Optional Private Key. If this is set, you can use this keypair for" + " encryption." + ), ), ), ], diff --git a/authentik/crypto/migrations/0002_create_self_signed_kp.py b/authentik/crypto/migrations/0002_create_self_signed_kp.py index fa96a508b..315b67a82 100644 --- a/authentik/crypto/migrations/0002_create_self_signed_kp.py +++ b/authentik/crypto/migrations/0002_create_self_signed_kp.py @@ -6,7 +6,6 @@ from authentik.lib.generators import generate_id class Migration(migrations.Migration): - dependencies = [ ("authentik_crypto", "0001_initial"), ] diff --git a/authentik/crypto/migrations/0003_certificatekeypair_managed.py b/authentik/crypto/migrations/0003_certificatekeypair_managed.py index e0697c762..0ad68f1a1 100644 --- a/authentik/crypto/migrations/0003_certificatekeypair_managed.py +++ b/authentik/crypto/migrations/0003_certificatekeypair_managed.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_crypto", "0002_create_self_signed_kp"), ] @@ -15,7 +14,12 @@ class Migration(migrations.Migration): name="managed", field=models.TextField( default=None, - help_text="Objects which are managed by authentik. These objects are created and updated automatically. This is flag only indicates that an object can be overwritten by migrations. You can still modify the objects via the API, but expect changes to be overwritten in a later update.", + help_text=( + "Objects which are managed by authentik. These objects are created and updated" + " automatically. This is flag only indicates that an object can be overwritten" + " by migrations. You can still modify the objects via the API, but expect" + " changes to be overwritten in a later update." + ), null=True, unique=True, verbose_name="Managed by authentik", diff --git a/authentik/crypto/models.py b/authentik/crypto/models.py index 1bf62d9fe..52a640876 100644 --- a/authentik/crypto/models.py +++ b/authentik/crypto/models.py @@ -98,6 +98,5 @@ class CertificateKeyPair(SerializerModel, ManagedModel, CreatedUpdatedModel): return f"Certificate-Key Pair {self.name}" class Meta: - verbose_name = _("Certificate-Key Pair") verbose_name_plural = _("Certificate-Key Pairs") diff --git a/authentik/events/api/events.py b/authentik/events/api/events.py index e8c92758f..fda11c090 100644 --- a/authentik/events/api/events.py +++ b/authentik/events/api/events.py @@ -25,7 +25,6 @@ class EventSerializer(ModelSerializer): """Event Serializer""" class Meta: - model = Event fields = [ "pk", diff --git a/authentik/events/api/notification_mappings.py b/authentik/events/api/notification_mappings.py index 37d3b9770..6e84332ea 100644 --- a/authentik/events/api/notification_mappings.py +++ b/authentik/events/api/notification_mappings.py @@ -10,7 +10,6 @@ class NotificationWebhookMappingSerializer(ModelSerializer): """NotificationWebhookMapping Serializer""" class Meta: - model = NotificationWebhookMapping fields = [ "pk", diff --git a/authentik/events/api/notification_rules.py b/authentik/events/api/notification_rules.py index b8aa7e579..6258f57bd 100644 --- a/authentik/events/api/notification_rules.py +++ b/authentik/events/api/notification_rules.py @@ -13,7 +13,6 @@ class NotificationRuleSerializer(ModelSerializer): group_obj = GroupSerializer(read_only=True, source="group") class Meta: - model = NotificationRule fields = [ "pk", diff --git a/authentik/events/api/notification_transports.py b/authentik/events/api/notification_transports.py index fbd4ed46f..edd7111e0 100644 --- a/authentik/events/api/notification_transports.py +++ b/authentik/events/api/notification_transports.py @@ -43,7 +43,6 @@ class NotificationTransportSerializer(ModelSerializer): return attrs class Meta: - model = NotificationTransport fields = [ "pk", diff --git a/authentik/events/api/notifications.py b/authentik/events/api/notifications.py index ca5bb1486..32608ec28 100644 --- a/authentik/events/api/notifications.py +++ b/authentik/events/api/notifications.py @@ -25,7 +25,6 @@ class NotificationSerializer(ModelSerializer): event = EventSerializer(required=False) class Meta: - model = Notification fields = [ "pk", diff --git a/authentik/events/migrations/0001_squashed_0019_alter_notificationtransport_webhook_url.py b/authentik/events/migrations/0001_squashed_0019_alter_notificationtransport_webhook_url.py index e5a05aad3..e96ced11a 100644 --- a/authentik/events/migrations/0001_squashed_0019_alter_notificationtransport_webhook_url.py +++ b/authentik/events/migrations/0001_squashed_0019_alter_notificationtransport_webhook_url.py @@ -100,7 +100,6 @@ def update_expires(apps: Apps, schema_editor: BaseDatabaseSchemaEditor): class Migration(migrations.Migration): - replaces = [ ("authentik_events", "0001_initial"), ("authentik_events", "0002_auto_20200918_2116"), @@ -245,14 +244,19 @@ class Migration(migrations.Migration): models.TextField( choices=[("notice", "Notice"), ("warning", "Warning"), ("alert", "Alert")], default="notice", - help_text="Controls which severity level the created notifications will have.", + help_text=( + "Controls which severity level the created notifications will have." + ), ), ), ( "group", models.ForeignKey( blank=True, - help_text="Define which group of users this notification should be sent and shown to. If left empty, Notification won't ben sent.", + help_text=( + "Define which group of users this notification should be sent and shown" + " to. If left empty, Notification won't ben sent." + ), null=True, on_delete=django.db.models.deletion.SET_NULL, to="authentik_core.group", @@ -261,7 +265,10 @@ class Migration(migrations.Migration): ( "transports", models.ManyToManyField( - help_text="Select which transports should be used to notify the user. If none are selected, the notification will only be shown in the authentik UI.", + help_text=( + "Select which transports should be used to notify the user. If none are" + " selected, the notification will only be shown in the authentik UI." + ), to="authentik_events.NotificationTransport", blank=True, ), @@ -317,7 +324,10 @@ class Migration(migrations.Migration): name="send_once", field=models.BooleanField( default=False, - help_text="Only send notification once, for example when sending a webhook into a chat channel.", + help_text=( + "Only send notification once, for example when sending a webhook into a chat" + " channel." + ), ), ), migrations.RunPython( diff --git a/authentik/events/migrations/0002_alter_notificationtransport_mode.py b/authentik/events/migrations/0002_alter_notificationtransport_mode.py index 5faa5c457..fd1ee302b 100644 --- a/authentik/events/migrations/0002_alter_notificationtransport_mode.py +++ b/authentik/events/migrations/0002_alter_notificationtransport_mode.py @@ -3,7 +3,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_events", "0001_squashed_0019_alter_notificationtransport_webhook_url"), ] diff --git a/authentik/events/models.py b/authentik/events/models.py index 4b48da521..d84f73dc3 100644 --- a/authentik/events/models.py +++ b/authentik/events/models.py @@ -283,7 +283,6 @@ class Event(SerializerModel, ExpiringModel): return f"Event action={self.action} user={self.user} context={self.context}" class Meta: - verbose_name = _("Event") verbose_name_plural = _("Events") @@ -460,7 +459,6 @@ class NotificationTransport(SerializerModel): return f"Notification Transport {self.name}" class Meta: - verbose_name = _("Notification Transport") verbose_name_plural = _("Notification Transports") @@ -495,7 +493,6 @@ class Notification(SerializerModel): return f"Notification for user {self.user}: {body_trunc}" class Meta: - verbose_name = _("Notification") verbose_name_plural = _("Notifications") @@ -507,10 +504,8 @@ class NotificationRule(SerializerModel, PolicyBindingModel): transports = models.ManyToManyField( NotificationTransport, help_text=_( - ( - "Select which transports should be used to notify the user. If none are " - "selected, the notification will only be shown in the authentik UI." - ) + "Select which transports should be used to notify the user. If none are " + "selected, the notification will only be shown in the authentik UI." ), blank=True, ) @@ -522,10 +517,8 @@ class NotificationRule(SerializerModel, PolicyBindingModel): group = models.ForeignKey( Group, help_text=_( - ( - "Define which group of users this notification should be sent and shown to. " - "If left empty, Notification won't ben sent." - ) + "Define which group of users this notification should be sent and shown to. " + "If left empty, Notification won't ben sent." ), null=True, blank=True, @@ -542,7 +535,6 @@ class NotificationRule(SerializerModel, PolicyBindingModel): return f"Notification Rule {self.name}" class Meta: - verbose_name = _("Notification Rule") verbose_name_plural = _("Notification Rules") @@ -564,6 +556,5 @@ class NotificationWebhookMapping(PropertyMapping): return f"Webhook Mapping {self.name}" class Meta: - verbose_name = _("Webhook Mapping") verbose_name_plural = _("Webhook Mappings") diff --git a/authentik/events/monitored_tasks.py b/authentik/events/monitored_tasks.py index 35b89a843..9d9c34560 100644 --- a/authentik/events/monitored_tasks.py +++ b/authentik/events/monitored_tasks.py @@ -178,7 +178,7 @@ class MonitoredTask(Task): ).save(self.result_timeout_hours) Event.new( EventAction.SYSTEM_TASK_EXCEPTION, - message=(f"Task {self.__name__} encountered an error: {exception_to_string(exc)}"), + message=f"Task {self.__name__} encountered an error: {exception_to_string(exc)}", ).save() def run(self, *args, **kwargs): diff --git a/authentik/flows/api/bindings.py b/authentik/flows/api/bindings.py index bdcac396d..43fbee91a 100644 --- a/authentik/flows/api/bindings.py +++ b/authentik/flows/api/bindings.py @@ -13,7 +13,6 @@ class FlowStageBindingSerializer(ModelSerializer): stage_obj = StageSerializer(read_only=True, source="stage") class Meta: - model = FlowStageBinding fields = [ "pk", diff --git a/authentik/flows/api/flows.py b/authentik/flows/api/flows.py index 98317dd06..c7b17baab 100644 --- a/authentik/flows/api/flows.py +++ b/authentik/flows/api/flows.py @@ -53,7 +53,6 @@ class FlowSerializer(ModelSerializer): return reverse("authentik_api:flow-export", kwargs={"slug": flow.slug}) class Meta: - model = Flow fields = [ "pk", @@ -82,7 +81,6 @@ class FlowSetSerializer(FlowSerializer): """Stripped down flow serializer""" class Meta: - model = Flow fields = [ "pk", diff --git a/authentik/flows/api/stages.py b/authentik/flows/api/stages.py index e27d5eb28..0bac579d7 100644 --- a/authentik/flows/api/stages.py +++ b/authentik/flows/api/stages.py @@ -33,7 +33,6 @@ class StageSerializer(ModelSerializer, MetaNameSerializer): return obj.component class Meta: - model = Stage fields = [ "pk", diff --git a/authentik/flows/migrations/0001_squashed_0007_auto_20200703_2059.py b/authentik/flows/migrations/0001_squashed_0007_auto_20200703_2059.py index f88ee48b2..dcc9c9416 100644 --- a/authentik/flows/migrations/0001_squashed_0007_auto_20200703_2059.py +++ b/authentik/flows/migrations/0001_squashed_0007_auto_20200703_2059.py @@ -7,7 +7,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - replaces = [ ("authentik_flows", "0001_initial"), ("authentik_flows", "0003_auto_20200523_1133"), @@ -98,7 +97,10 @@ class Migration(migrations.Migration): "re_evaluate_policies", models.BooleanField( default=False, - help_text="When this option is enabled, the planner will re-evaluate policies bound to this.", + help_text=( + "When this option is enabled, the planner will re-evaluate policies" + " bound to this." + ), ), ), ("order", models.IntegerField()), diff --git a/authentik/flows/migrations/0008_default_flows.py b/authentik/flows/migrations/0008_default_flows.py index 9cf6afd78..8cff56071 100644 --- a/authentik/flows/migrations/0008_default_flows.py +++ b/authentik/flows/migrations/0008_default_flows.py @@ -4,7 +4,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ("authentik_flows", "0007_auto_20200703_2059"), ] diff --git a/authentik/flows/migrations/0009_source_flows.py b/authentik/flows/migrations/0009_source_flows.py index 747181e76..04375079d 100644 --- a/authentik/flows/migrations/0009_source_flows.py +++ b/authentik/flows/migrations/0009_source_flows.py @@ -4,7 +4,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ("authentik_flows", "0008_default_flows"), ] diff --git a/authentik/flows/migrations/0010_provider_flows.py b/authentik/flows/migrations/0010_provider_flows.py index 483432366..3f7133092 100644 --- a/authentik/flows/migrations/0010_provider_flows.py +++ b/authentik/flows/migrations/0010_provider_flows.py @@ -4,7 +4,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ("authentik_flows", "0009_source_flows"), ] diff --git a/authentik/flows/migrations/0011_flow_title.py b/authentik/flows/migrations/0011_flow_title.py index 994b41902..8d755f0a6 100644 --- a/authentik/flows/migrations/0011_flow_title.py +++ b/authentik/flows/migrations/0011_flow_title.py @@ -3,7 +3,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_flows", "0010_provider_flows"), ] diff --git a/authentik/flows/migrations/0012_auto_20200908_1542_squashed_0017_auto_20210329_1334.py b/authentik/flows/migrations/0012_auto_20200908_1542_squashed_0017_auto_20210329_1334.py index 2002fe9bd..0c8b1d8b6 100644 --- a/authentik/flows/migrations/0012_auto_20200908_1542_squashed_0017_auto_20210329_1334.py +++ b/authentik/flows/migrations/0012_auto_20200908_1542_squashed_0017_auto_20210329_1334.py @@ -20,7 +20,6 @@ def update_flow_designation(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) class Migration(migrations.Migration): - replaces = [ ("authentik_flows", "0012_auto_20200908_1542"), ("authentik_flows", "0013_auto_20200924_1605"), @@ -79,7 +78,10 @@ class Migration(migrations.Migration): name="re_evaluate_policies", field=models.BooleanField( default=False, - help_text="When this option is enabled, the planner will re-evaluate policies bound to this binding.", + help_text=( + "When this option is enabled, the planner will re-evaluate policies bound to" + " this binding." + ), ), ), migrations.AlterField( @@ -94,7 +96,10 @@ class Migration(migrations.Migration): name="evaluate_on_plan", field=models.BooleanField( default=True, - help_text="Evaluate policies during the Flow planning process. Disable this for input-based policies.", + help_text=( + "Evaluate policies during the Flow planning process. Disable this for" + " input-based policies." + ), ), ), migrations.AddField( @@ -120,7 +125,10 @@ class Migration(migrations.Migration): ("recovery", "Recovery"), ("stage_configuration", "Stage Configuration"), ], - help_text="Decides what this Flow is used for. For example, the Authentication flow is redirect to when an un-authenticated user visits authentik.", + help_text=( + "Decides what this Flow is used for. For example, the Authentication flow is" + " redirect to when an un-authenticated user visits authentik." + ), max_length=100, ), ), diff --git a/authentik/flows/migrations/0018_oob_flows.py b/authentik/flows/migrations/0018_oob_flows.py index 8f2e021a5..2b3c74fe0 100644 --- a/authentik/flows/migrations/0018_oob_flows.py +++ b/authentik/flows/migrations/0018_oob_flows.py @@ -4,7 +4,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ("authentik_flows", "0017_auto_20210329_1334"), ] diff --git a/authentik/flows/migrations/0019_alter_flow_background_squashed_0024_alter_flow_compatibility_mode.py b/authentik/flows/migrations/0019_alter_flow_background_squashed_0024_alter_flow_compatibility_mode.py index be13617bc..e04f10789 100644 --- a/authentik/flows/migrations/0019_alter_flow_background_squashed_0024_alter_flow_compatibility_mode.py +++ b/authentik/flows/migrations/0019_alter_flow_background_squashed_0024_alter_flow_compatibility_mode.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - replaces = [ ("authentik_flows", "0019_alter_flow_background"), ("authentik_flows", "0020_flow_compatibility_mode"), @@ -39,7 +38,12 @@ class Migration(migrations.Migration): ("restart_with_context", "Restart With Context"), ], default="retry", - help_text="Configure how the flow executor should handle an invalid response to a challenge. RETRY returns the error message and a similar challenge to the executor. RESTART restarts the flow from the beginning, and RESTART_WITH_CONTEXT restarts the flow while keeping the current context.", + help_text=( + "Configure how the flow executor should handle an invalid response to a" + " challenge. RETRY returns the error message and a similar challenge to the" + " executor. RESTART restarts the flow from the beginning, and" + " RESTART_WITH_CONTEXT restarts the flow while keeping the current context." + ), ), ), migrations.AlterField( @@ -58,7 +62,10 @@ class Migration(migrations.Migration): name="compatibility_mode", field=models.BooleanField( default=False, - help_text="Enable compatibility mode, increases compatibility with password managers on mobile devices.", + help_text=( + "Enable compatibility mode, increases compatibility with password managers on" + " mobile devices." + ), ), ), ] diff --git a/authentik/flows/migrations/0020_flowtoken.py b/authentik/flows/migrations/0020_flowtoken.py index 2de781ca0..99fffdd2a 100644 --- a/authentik/flows/migrations/0020_flowtoken.py +++ b/authentik/flows/migrations/0020_flowtoken.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_core", "0018_auto_20210330_1345_squashed_0028_alter_token_intent"), ( diff --git a/authentik/flows/migrations/0021_auto_20211227_2103.py b/authentik/flows/migrations/0021_auto_20211227_2103.py index 4d300fc4b..68c53f8ec 100644 --- a/authentik/flows/migrations/0021_auto_20211227_2103.py +++ b/authentik/flows/migrations/0021_auto_20211227_2103.py @@ -3,7 +3,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ("authentik_flows", "0020_flowtoken"), ] diff --git a/authentik/flows/migrations/0022_flow_layout.py b/authentik/flows/migrations/0022_flow_layout.py index 580b38f36..70e33215c 100644 --- a/authentik/flows/migrations/0022_flow_layout.py +++ b/authentik/flows/migrations/0022_flow_layout.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_flows", "0021_auto_20211227_2103"), ] diff --git a/authentik/flows/migrations/0023_flow_denied_action.py b/authentik/flows/migrations/0023_flow_denied_action.py index 580d2f00e..a10107a3e 100644 --- a/authentik/flows/migrations/0023_flow_denied_action.py +++ b/authentik/flows/migrations/0023_flow_denied_action.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_flows", "0022_flow_layout"), ] diff --git a/authentik/flows/migrations/0024_flow_authentication.py b/authentik/flows/migrations/0024_flow_authentication.py index cbfc01971..1cdb4ad10 100644 --- a/authentik/flows/migrations/0024_flow_authentication.py +++ b/authentik/flows/migrations/0024_flow_authentication.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_flows", "0023_flow_denied_action"), ] diff --git a/authentik/flows/models.py b/authentik/flows/models.py index fd81fa745..598839519 100644 --- a/authentik/flows/models.py +++ b/authentik/flows/models.py @@ -135,10 +135,8 @@ class Flow(SerializerModel, PolicyBindingModel): max_length=100, choices=FlowDesignation.choices, help_text=_( - ( - "Decides what this Flow is used for. For example, the Authentication flow " - "is redirect to when an un-authenticated user visits authentik." - ) + "Decides what this Flow is used for. For example, the Authentication flow " + "is redirect to when an un-authenticated user visits authentik." ), ) @@ -192,7 +190,6 @@ class Flow(SerializerModel, PolicyBindingModel): return f"Flow {self.name} ({self.slug})" class Meta: - verbose_name = _("Flow") verbose_name_plural = _("Flows") @@ -216,10 +213,8 @@ class FlowStageBinding(SerializerModel, PolicyBindingModel): evaluate_on_plan = models.BooleanField( default=True, help_text=_( - ( - "Evaluate policies during the Flow planning process. " - "Disable this for input-based policies." - ) + "Evaluate policies during the Flow planning process. " + "Disable this for input-based policies." ), ) re_evaluate_policies = models.BooleanField( @@ -252,7 +247,6 @@ class FlowStageBinding(SerializerModel, PolicyBindingModel): return f"Flow-stage binding #{self.order} to {self.target_id}" class Meta: - ordering = ["target", "order"] verbose_name = _("Flow Stage Binding") @@ -271,15 +265,12 @@ class ConfigurableStage(models.Model): null=True, blank=True, help_text=_( - ( - "Flow used by an authenticated user to configure this Stage. " - "If empty, user will not be able to configure this stage." - ) + "Flow used by an authenticated user to configure this Stage. " + "If empty, user will not be able to configure this stage." ), ) class Meta: - abstract = True @@ -305,6 +296,5 @@ class FlowToken(Token): return f"Flow Token {super().__str__()}" class Meta: - verbose_name = _("Flow Token") verbose_name_plural = _("Flow Tokens") diff --git a/authentik/flows/planner.py b/authentik/flows/planner.py index 367d7574b..8d07e5bf9 100644 --- a/authentik/flows/planner.py +++ b/authentik/flows/planner.py @@ -207,10 +207,13 @@ class FlowPlanner: ) -> FlowPlan: """Build flow plan by checking each stage in their respective order and checking the applied policies""" - with Hub.current.start_span( - op="authentik.flow.planner.build_plan", - description=self.flow.slug, - ) as span, HIST_FLOWS_PLAN_TIME.labels(flow_slug=self.flow.slug).time(): + with ( + Hub.current.start_span( + op="authentik.flow.planner.build_plan", + description=self.flow.slug, + ) as span, + HIST_FLOWS_PLAN_TIME.labels(flow_slug=self.flow.slug).time(), + ): span: Span span.set_data("flow", self.flow) span.set_data("user", user) diff --git a/authentik/flows/tests/test_executor.py b/authentik/flows/tests/test_executor.py index 5ac07cd75..a5c9a0444 100644 --- a/authentik/flows/tests/test_executor.py +++ b/authentik/flows/tests/test_executor.py @@ -209,7 +209,6 @@ class TestFlowExecutor(FlowTestCase): # Here we patch the dummy policy to evaluate to true so the stage is included with patch("authentik.policies.dummy.models.DummyPolicy.passes", POLICY_RETURN_TRUE): - exec_url = reverse("authentik_api:flow-executor", kwargs={"flow_slug": flow.slug}) # First request, run the planner response = self.client.get(exec_url) @@ -259,7 +258,6 @@ class TestFlowExecutor(FlowTestCase): # Here we patch the dummy policy to evaluate to true so the stage is included with patch("authentik.policies.dummy.models.DummyPolicy.passes", POLICY_RETURN_TRUE): - exec_url = reverse("authentik_api:flow-executor", kwargs={"flow_slug": flow.slug}) # First request, run the planner response = self.client.get(exec_url) @@ -319,7 +317,6 @@ class TestFlowExecutor(FlowTestCase): # Here we patch the dummy policy to evaluate to true so the stage is included with patch("authentik.policies.dummy.models.DummyPolicy.passes", POLICY_RETURN_TRUE): - exec_url = reverse("authentik_api:flow-executor", kwargs={"flow_slug": flow.slug}) # First request, run the planner response = self.client.get(exec_url) @@ -396,7 +393,6 @@ class TestFlowExecutor(FlowTestCase): # Here we patch the dummy policy to evaluate to true so the stage is included with patch("authentik.policies.dummy.models.DummyPolicy.passes", POLICY_RETURN_TRUE): - exec_url = reverse("authentik_api:flow-executor", kwargs={"flow_slug": flow.slug}) # First request, run the planner response = self.client.get(exec_url) diff --git a/authentik/outposts/api/outposts.py b/authentik/outposts/api/outposts.py index b59b2ac4b..5acad9925 100644 --- a/authentik/outposts/api/outposts.py +++ b/authentik/outposts/api/outposts.py @@ -56,10 +56,8 @@ class OutpostSerializer(ModelSerializer): for provider in providers: if not isinstance(provider, type_map[self.initial_data.get("type")]): raise ValidationError( - ( - f"Outpost type {self.initial_data['type']} can't be used with " - f"{provider.__class__.__name__} providers." - ) + f"Outpost type {self.initial_data['type']} can't be used with " + f"{provider.__class__.__name__} providers." ) if self.instance and self.instance.managed == MANAGED_OUTPOST: return providers @@ -76,7 +74,6 @@ class OutpostSerializer(ModelSerializer): return config class Meta: - model = Outpost fields = [ "pk", @@ -124,7 +121,6 @@ class OutpostFilter(FilterSet): ) class Meta: - model = Outpost fields = { "providers": ["isnull"], diff --git a/authentik/outposts/api/service_connections.py b/authentik/outposts/api/service_connections.py index e32bbffb4..0e1f46af8 100644 --- a/authentik/outposts/api/service_connections.py +++ b/authentik/outposts/api/service_connections.py @@ -37,7 +37,6 @@ class ServiceConnectionSerializer(ModelSerializer, MetaNameSerializer): return obj.component class Meta: - model = OutpostServiceConnection fields = [ "pk", @@ -101,7 +100,6 @@ class DockerServiceConnectionSerializer(ServiceConnectionSerializer): """DockerServiceConnection Serializer""" class Meta: - model = DockerServiceConnection fields = ServiceConnectionSerializer.Meta.fields + [ "url", @@ -140,7 +138,6 @@ class KubernetesServiceConnectionSerializer(ServiceConnectionSerializer): return kubeconfig class Meta: - model = KubernetesServiceConnection fields = ServiceConnectionSerializer.Meta.fields + ["kubeconfig", "verify_ssl"] diff --git a/authentik/outposts/migrations/0001_squashed_0017_outpost_managed.py b/authentik/outposts/migrations/0001_squashed_0017_outpost_managed.py index 030854f11..7bd9d4f42 100644 --- a/authentik/outposts/migrations/0001_squashed_0017_outpost_managed.py +++ b/authentik/outposts/migrations/0001_squashed_0017_outpost_managed.py @@ -80,7 +80,6 @@ def update_config_prefix(apps: Apps, schema_editor: BaseDatabaseSchemaEditor): class Migration(migrations.Migration): - replaces = [ ("authentik_outposts", "0001_initial"), ("authentik_outposts", "0002_auto_20200826_1306"), @@ -136,7 +135,10 @@ class Migration(migrations.Migration): ("custom", "Custom"), ], default="custom", - help_text="Select between authentik-managed deployment types or a custom deployment.", + help_text=( + "Select between authentik-managed deployment types or a custom" + " deployment." + ), ), ), ], @@ -158,7 +160,10 @@ class Migration(migrations.Migration): "local", models.BooleanField( default=False, - help_text="If enabled, use the local connection. Required Docker socket/Kubernetes Integration", + help_text=( + "If enabled, use the local connection. Required Docker" + " socket/Kubernetes Integration" + ), unique=True, ), ), @@ -207,7 +212,10 @@ class Migration(migrations.Migration): field=models.ForeignKey( blank=True, default=None, - help_text="Select Service-Connection authentik should use to manage this outpost. Leave empty if authentik should not handle the deployment.", + help_text=( + "Select Service-Connection authentik should use to manage this outpost. Leave" + " empty if authentik should not handle the deployment." + ), null=True, on_delete=django.db.models.deletion.SET_DEFAULT, to="authentik_outposts.outpostserviceconnection", @@ -240,7 +248,10 @@ class Migration(migrations.Migration): field=authentik.lib.models.InheritanceForeignKey( blank=True, default=None, - help_text="Select Service-Connection authentik should use to manage this outpost. Leave empty if authentik should not handle the deployment.", + help_text=( + "Select Service-Connection authentik should use to manage this outpost. Leave" + " empty if authentik should not handle the deployment." + ), null=True, on_delete=django.db.models.deletion.SET_DEFAULT, to="authentik_outposts.outpostserviceconnection", @@ -258,7 +269,10 @@ class Migration(migrations.Migration): name="kubeconfig", field=models.JSONField( default=None, - help_text="Paste your kubeconfig here. authentik will automatically use the currently selected context.", + help_text=( + "Paste your kubeconfig here. authentik will automatically use the currently" + " selected context." + ), ), preserve_default=False, ), @@ -272,7 +286,10 @@ class Migration(migrations.Migration): field=models.ForeignKey( blank=True, default=None, - help_text="Certificate/Key used for authentication. Can be left empty for no authentication.", + help_text=( + "Certificate/Key used for authentication. Can be left empty for no" + " authentication." + ), null=True, on_delete=django.db.models.deletion.SET_DEFAULT, related_name="+", @@ -285,7 +302,10 @@ class Migration(migrations.Migration): field=models.ForeignKey( blank=True, default=None, - help_text="CA which the endpoint's Certificate is verified against. Can be left empty for no validation.", + help_text=( + "CA which the endpoint's Certificate is verified against. Can be left empty for" + " no validation." + ), null=True, on_delete=django.db.models.deletion.SET_DEFAULT, related_name="+", @@ -297,7 +317,10 @@ class Migration(migrations.Migration): name="local", field=models.BooleanField( default=False, - help_text="If enabled, use the local connection. Required Docker socket/Kubernetes Integration", + help_text=( + "If enabled, use the local connection. Required Docker socket/Kubernetes" + " Integration" + ), ), ), migrations.RunPython( @@ -310,7 +333,10 @@ class Migration(migrations.Migration): model_name="dockerserviceconnection", name="url", field=models.TextField( - help_text="Can be in the format of 'unix://' when connecting to a local docker daemon, or 'https://:2376' when connecting to a remote system." + help_text=( + "Can be in the format of 'unix://' when connecting to a local docker" + " daemon, or 'https://:2376' when connecting to a remote system." + ) ), ), migrations.AlterField( @@ -318,7 +344,10 @@ class Migration(migrations.Migration): name="kubeconfig", field=models.JSONField( blank=True, - help_text="Paste your kubeconfig here. authentik will automatically use the currently selected context.", + help_text=( + "Paste your kubeconfig here. authentik will automatically use the currently" + " selected context." + ), ), ), migrations.AlterField( @@ -331,7 +360,12 @@ class Migration(migrations.Migration): name="managed", field=models.TextField( default=None, - help_text="Objects which are managed by authentik. These objects are created and updated automatically. This is flag only indicates that an object can be overwritten by migrations. You can still modify the objects via the API, but expect changes to be overwritten in a later update.", + help_text=( + "Objects which are managed by authentik. These objects are created and updated" + " automatically. This is flag only indicates that an object can be overwritten" + " by migrations. You can still modify the objects via the API, but expect" + " changes to be overwritten in a later update." + ), null=True, unique=True, verbose_name="Managed by authentik", diff --git a/authentik/outposts/migrations/0018_kubernetesserviceconnection_verify_ssl.py b/authentik/outposts/migrations/0018_kubernetesserviceconnection_verify_ssl.py index df93a4576..3c7e961c2 100644 --- a/authentik/outposts/migrations/0018_kubernetesserviceconnection_verify_ssl.py +++ b/authentik/outposts/migrations/0018_kubernetesserviceconnection_verify_ssl.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_outposts", "0001_squashed_0017_outpost_managed"), ] diff --git a/authentik/outposts/models.py b/authentik/outposts/models.py index f09792f21..3276a71c1 100644 --- a/authentik/outposts/models.py +++ b/authentik/outposts/models.py @@ -86,7 +86,6 @@ class OutpostModel(Model): return [self] class Meta: - abstract = True @@ -119,10 +118,7 @@ class OutpostServiceConnection(models.Model): local = models.BooleanField( default=False, help_text=_( - ( - "If enabled, use the local connection. Required Docker " - "socket/Kubernetes Integration" - ) + "If enabled, use the local connection. Required Docker socket/Kubernetes Integration" ), ) @@ -152,7 +148,6 @@ class OutpostServiceConnection(models.Model): return "" class Meta: - verbose_name = _("Outpost Service-Connection") verbose_name_plural = _("Outpost Service-Connections") @@ -162,10 +157,8 @@ class DockerServiceConnection(SerializerModel, OutpostServiceConnection): url = models.TextField( help_text=_( - ( - "Can be in the format of 'unix://' when connecting to a local docker daemon, " - "or 'https://:2376' when connecting to a remote system." - ) + "Can be in the format of 'unix://' when connecting to a local docker daemon, " + "or 'https://:2376' when connecting to a remote system." ) ) tls_verification = models.ForeignKey( @@ -176,10 +169,8 @@ class DockerServiceConnection(SerializerModel, OutpostServiceConnection): related_name="+", on_delete=models.SET_DEFAULT, help_text=_( - ( - "CA which the endpoint's Certificate is verified against. " - "Can be left empty for no validation." - ) + "CA which the endpoint's Certificate is verified against. " + "Can be left empty for no validation." ), ) tls_authentication = models.ForeignKey( @@ -208,7 +199,6 @@ class DockerServiceConnection(SerializerModel, OutpostServiceConnection): return f"Docker Service-Connection {self.name}" class Meta: - verbose_name = _("Docker Service-Connection") verbose_name_plural = _("Docker Service-Connections") @@ -218,10 +208,8 @@ class KubernetesServiceConnection(SerializerModel, OutpostServiceConnection): kubeconfig = models.JSONField( help_text=_( - ( - "Paste your kubeconfig here. authentik will automatically use " - "the currently selected context." - ) + "Paste your kubeconfig here. authentik will automatically use " + "the currently selected context." ), blank=True, ) @@ -243,7 +231,6 @@ class KubernetesServiceConnection(SerializerModel, OutpostServiceConnection): return f"Kubernetes Service-Connection {self.name}" class Meta: - verbose_name = _("Kubernetes Service-Connection") verbose_name_plural = _("Kubernetes Service-Connections") @@ -261,10 +248,8 @@ class Outpost(SerializerModel, ManagedModel): null=True, blank=True, help_text=_( - ( - "Select Service-Connection authentik should use to manage this outpost. " - "Leave empty if authentik should not handle the deployment." - ) + "Select Service-Connection authentik should use to manage this outpost. " + "Leave empty if authentik should not handle the deployment." ), on_delete=models.SET_DEFAULT, ) @@ -315,7 +300,7 @@ class Outpost(SerializerModel, ManagedModel): if isinstance(model_or_perm, models.Model): model_or_perm: models.Model code_name = ( - f"{model_or_perm._meta.app_label}." f"view_{model_or_perm._meta.model_name}" + f"{model_or_perm._meta.app_label}.view_{model_or_perm._meta.model_name}" ) try: assign_perm(code_name, user, model_or_perm) diff --git a/authentik/policies/api/bindings.py b/authentik/policies/api/bindings.py index e6214d91a..38041b14c 100644 --- a/authentik/policies/api/bindings.py +++ b/authentik/policies/api/bindings.py @@ -63,7 +63,6 @@ class PolicyBindingSerializer(ModelSerializer): user_obj = UserSerializer(required=False, read_only=True, source="user") class Meta: - model = PolicyBinding fields = [ "pk", @@ -109,7 +108,6 @@ class PolicyBindingFilter(FilterSet): policy__isnull = BooleanFilter("policy", "isnull") class Meta: - model = PolicyBinding fields = ["policy", "policy__isnull", "target", "target_in", "enabled", "order", "timeout"] diff --git a/authentik/policies/api/policies.py b/authentik/policies/api/policies.py index 17ec9aec1..e5c555f93 100644 --- a/authentik/policies/api/policies.py +++ b/authentik/policies/api/policies.py @@ -56,7 +56,6 @@ class PolicySerializer(ModelSerializer, MetaNameSerializer): return dict(instance.serializer(instance=instance, resolve_inheritance=False).data) class Meta: - model = Policy fields = [ "pk", diff --git a/authentik/policies/dummy/migrations/0001_initial.py b/authentik/policies/dummy/migrations/0001_initial.py index 4da576a7e..6a886b7b2 100644 --- a/authentik/policies/dummy/migrations/0001_initial.py +++ b/authentik/policies/dummy/migrations/0001_initial.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [ diff --git a/authentik/policies/dummy/migrations/0002_dummypolicy_authentik_p_policy__648f9b_idx.py b/authentik/policies/dummy/migrations/0002_dummypolicy_authentik_p_policy__648f9b_idx.py index d5c6989f9..1e16b18cf 100644 --- a/authentik/policies/dummy/migrations/0002_dummypolicy_authentik_p_policy__648f9b_idx.py +++ b/authentik/policies/dummy/migrations/0002_dummypolicy_authentik_p_policy__648f9b_idx.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_policies_dummy", "0001_initial"), ] diff --git a/authentik/policies/dummy/models.py b/authentik/policies/dummy/models.py index 597aff05c..eb2c60441 100644 --- a/authentik/policies/dummy/models.py +++ b/authentik/policies/dummy/models.py @@ -41,6 +41,5 @@ class DummyPolicy(Policy): return PolicyResult(self.result, "dummy") class Meta(Policy.PolicyMeta): - verbose_name = _("Dummy Policy") verbose_name_plural = _("Dummy Policies") diff --git a/authentik/policies/engine.py b/authentik/policies/engine.py index 4f285f377..539910793 100644 --- a/authentik/policies/engine.py +++ b/authentik/policies/engine.py @@ -80,13 +80,16 @@ class PolicyEngine: def build(self) -> "PolicyEngine": """Build wrapper which monitors performance""" - with Hub.current.start_span( - op="authentik.policy.engine.build", - description=self.__pbm, - ) as span, HIST_POLICIES_BUILD_TIME.labels( - object_pk=str(self.__pbm.pk), - object_type=f"{self.__pbm._meta.app_label}.{self.__pbm._meta.model_name}", - ).time(): + with ( + Hub.current.start_span( + op="authentik.policy.engine.build", + description=self.__pbm, + ) as span, + HIST_POLICIES_BUILD_TIME.labels( + object_pk=str(self.__pbm.pk), + object_type=f"{self.__pbm._meta.app_label}.{self.__pbm._meta.model_name}", + ).time(), + ): span: Span span.set_data("pbm", self.__pbm) span.set_data("request", self.request) diff --git a/authentik/policies/event_matcher/migrations/0001_squashed_0018_alter_eventmatcherpolicy_action.py b/authentik/policies/event_matcher/migrations/0001_squashed_0018_alter_eventmatcherpolicy_action.py index dca5a3d91..ec0be51c6 100644 --- a/authentik/policies/event_matcher/migrations/0001_squashed_0018_alter_eventmatcherpolicy_action.py +++ b/authentik/policies/event_matcher/migrations/0001_squashed_0018_alter_eventmatcherpolicy_action.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - replaces = [ ("authentik_policies_event_matcher", "0001_initial"), ("authentik_policies_event_matcher", "0002_auto_20201230_2046"), @@ -81,14 +80,20 @@ class Migration(migrations.Migration): ("update_available", "Update Available"), ("custom_", "Custom Prefix"), ], - help_text="Match created events with this action type. When left empty, all action types will be matched.", + help_text=( + "Match created events with this action type. When left empty, all" + " action types will be matched." + ), ), ), ( "client_ip", models.TextField( blank=True, - help_text="Matches Event's Client IP (strict matching, for network matching use an Expression Policy)", + help_text=( + "Matches Event's Client IP (strict matching, for network matching use" + " an Expression Policy)" + ), ), ), ( @@ -161,7 +166,10 @@ class Migration(migrations.Migration): ("authentik.blueprints", "authentik Blueprints"), ], default="", - help_text="Match events created by selected application. When left empty, all applications are matched.", + help_text=( + "Match events created by selected application. When left empty, all" + " applications are matched." + ), ), ), ], diff --git a/authentik/policies/event_matcher/migrations/0019_alter_eventmatcherpolicy_app.py b/authentik/policies/event_matcher/migrations/0019_alter_eventmatcherpolicy_app.py index b50b13711..bc46851b2 100644 --- a/authentik/policies/event_matcher/migrations/0019_alter_eventmatcherpolicy_app.py +++ b/authentik/policies/event_matcher/migrations/0019_alter_eventmatcherpolicy_app.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_policies_event_matcher", "0018_alter_eventmatcherpolicy_action"), ] @@ -73,7 +72,10 @@ class Migration(migrations.Migration): ("authentik.core", "authentik Core"), ], default="", - help_text="Match events created by selected application. When left empty, all applications are matched.", + help_text=( + "Match events created by selected application. When left empty, all" + " applications are matched." + ), ), ), ] diff --git a/authentik/policies/event_matcher/migrations/0020_eventmatcherpolicy_authentik_p_policy__e605cf_idx.py b/authentik/policies/event_matcher/migrations/0020_eventmatcherpolicy_authentik_p_policy__e605cf_idx.py index 3aeb8b86f..f56559c7c 100644 --- a/authentik/policies/event_matcher/migrations/0020_eventmatcherpolicy_authentik_p_policy__e605cf_idx.py +++ b/authentik/policies/event_matcher/migrations/0020_eventmatcherpolicy_authentik_p_policy__e605cf_idx.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_policies_event_matcher", "0019_alter_eventmatcherpolicy_app"), ] diff --git a/authentik/policies/event_matcher/migrations/0021_alter_eventmatcherpolicy_app.py b/authentik/policies/event_matcher/migrations/0021_alter_eventmatcherpolicy_app.py index c92f69029..c8769f0d6 100644 --- a/authentik/policies/event_matcher/migrations/0021_alter_eventmatcherpolicy_app.py +++ b/authentik/policies/event_matcher/migrations/0021_alter_eventmatcherpolicy_app.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ( "authentik_policies_event_matcher", @@ -19,7 +18,10 @@ class Migration(migrations.Migration): field=models.TextField( blank=True, default="", - help_text="Match events created by selected application. When left empty, all applications are matched.", + help_text=( + "Match events created by selected application. When left empty, all" + " applications are matched." + ), ), ), ] diff --git a/authentik/policies/event_matcher/models.py b/authentik/policies/event_matcher/models.py index e46bb4eeb..cad2f261f 100644 --- a/authentik/policies/event_matcher/models.py +++ b/authentik/policies/event_matcher/models.py @@ -26,29 +26,23 @@ class EventMatcherPolicy(Policy): choices=EventAction.choices, blank=True, help_text=_( - ( - "Match created events with this action type. " - "When left empty, all action types will be matched." - ) + "Match created events with this action type. " + "When left empty, all action types will be matched." ), ) app = models.TextField( blank=True, default="", help_text=_( - ( - "Match events created by selected application. " - "When left empty, all applications are matched." - ) + "Match events created by selected application. " + "When left empty, all applications are matched." ), ) client_ip = models.TextField( blank=True, help_text=_( - ( - "Matches Event's Client IP (strict matching, " - "for network matching use an Expression Policy)" - ) + "Matches Event's Client IP (strict matching, " + "for network matching use an Expression Policy)" ), ) @@ -75,6 +69,5 @@ class EventMatcherPolicy(Policy): return PolicyResult(False) class Meta(Policy.PolicyMeta): - verbose_name = _("Event Matcher Policy") verbose_name_plural = _("Event Matcher Policies") diff --git a/authentik/policies/expiry/migrations/0001_initial.py b/authentik/policies/expiry/migrations/0001_initial.py index 401b6bfad..1302b5074 100644 --- a/authentik/policies/expiry/migrations/0001_initial.py +++ b/authentik/policies/expiry/migrations/0001_initial.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [ diff --git a/authentik/policies/expiry/migrations/0002_passwordexpirypolicy_authentik_p_policy__cf73a7_idx.py b/authentik/policies/expiry/migrations/0002_passwordexpirypolicy_authentik_p_policy__cf73a7_idx.py index 6e797c961..0f1bf4a62 100644 --- a/authentik/policies/expiry/migrations/0002_passwordexpirypolicy_authentik_p_policy__cf73a7_idx.py +++ b/authentik/policies/expiry/migrations/0002_passwordexpirypolicy_authentik_p_policy__cf73a7_idx.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_policies_expiry", "0001_initial"), ] diff --git a/authentik/policies/expiry/models.py b/authentik/policies/expiry/models.py index 58ce968a7..b4f2b58f6 100644 --- a/authentik/policies/expiry/models.py +++ b/authentik/policies/expiry/models.py @@ -42,7 +42,7 @@ class PasswordExpiryPolicy(Policy): request.user.set_unusable_password() request.user.save() message = _( - ("Password expired %(days)d days ago. " "Please update your password.") + "Password expired %(days)d days ago. Please update your password." % {"days": days_since_expiry} ) return PolicyResult(False, message) @@ -50,6 +50,5 @@ class PasswordExpiryPolicy(Policy): return PolicyResult(True) class Meta(Policy.PolicyMeta): - verbose_name = _("Password Expiry Policy") verbose_name_plural = _("Password Expiry Policies") diff --git a/authentik/policies/expression/migrations/0001_initial.py b/authentik/policies/expression/migrations/0001_initial.py index 2087532a1..afa9ae937 100644 --- a/authentik/policies/expression/migrations/0001_initial.py +++ b/authentik/policies/expression/migrations/0001_initial.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [ diff --git a/authentik/policies/expression/migrations/0002_auto_20200926_1156.py b/authentik/policies/expression/migrations/0002_auto_20200926_1156.py index 59d1a0a70..73ac81e37 100644 --- a/authentik/policies/expression/migrations/0002_auto_20200926_1156.py +++ b/authentik/policies/expression/migrations/0002_auto_20200926_1156.py @@ -16,7 +16,6 @@ def remove_pb_flow_plan(apps: Apps, schema_editor: BaseDatabaseSchemaEditor): class Migration(migrations.Migration): - dependencies = [ ("authentik_policies_expression", "0001_initial"), ] diff --git a/authentik/policies/expression/migrations/0003_auto_20201203_1223.py b/authentik/policies/expression/migrations/0003_auto_20201203_1223.py index f9f335681..e00c09bb9 100644 --- a/authentik/policies/expression/migrations/0003_auto_20201203_1223.py +++ b/authentik/policies/expression/migrations/0003_auto_20201203_1223.py @@ -18,7 +18,6 @@ def replace_pb_prefix(apps: Apps, schema_editor: BaseDatabaseSchemaEditor): class Migration(migrations.Migration): - dependencies = [ ("authentik_policies_expression", "0002_auto_20200926_1156"), ] diff --git a/authentik/policies/expression/migrations/0004_expressionpolicy_authentik_p_policy__fb6feb_idx.py b/authentik/policies/expression/migrations/0004_expressionpolicy_authentik_p_policy__fb6feb_idx.py index 7f069c490..55bd3935a 100644 --- a/authentik/policies/expression/migrations/0004_expressionpolicy_authentik_p_policy__fb6feb_idx.py +++ b/authentik/policies/expression/migrations/0004_expressionpolicy_authentik_p_policy__fb6feb_idx.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_policies_expression", "0003_auto_20201203_1223"), ] diff --git a/authentik/policies/expression/models.py b/authentik/policies/expression/models.py index 9fb8967e9..c1b2c2062 100644 --- a/authentik/policies/expression/models.py +++ b/authentik/policies/expression/models.py @@ -37,6 +37,5 @@ class ExpressionPolicy(Policy): return super().save(*args, **kwargs) class Meta(Policy.PolicyMeta): - verbose_name = _("Expression Policy") verbose_name_plural = _("Expression Policies") diff --git a/authentik/policies/migrations/0001_initial.py b/authentik/policies/migrations/0001_initial.py index 5b2d0ff45..1426f84ad 100644 --- a/authentik/policies/migrations/0001_initial.py +++ b/authentik/policies/migrations/0001_initial.py @@ -7,7 +7,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [] diff --git a/authentik/policies/migrations/0002_auto_20200528_1647.py b/authentik/policies/migrations/0002_auto_20200528_1647.py index 3c0d636a6..1a2285108 100644 --- a/authentik/policies/migrations/0002_auto_20200528_1647.py +++ b/authentik/policies/migrations/0002_auto_20200528_1647.py @@ -7,7 +7,6 @@ import authentik.lib.models class Migration(migrations.Migration): - dependencies = [ ("authentik_policies", "0001_initial"), ] diff --git a/authentik/policies/migrations/0003_auto_20200908_1542.py b/authentik/policies/migrations/0003_auto_20200908_1542.py index ed808ed79..e3383992b 100644 --- a/authentik/policies/migrations/0003_auto_20200908_1542.py +++ b/authentik/policies/migrations/0003_auto_20200908_1542.py @@ -7,7 +7,6 @@ import authentik.lib.models class Migration(migrations.Migration): - dependencies = [ ("authentik_policies", "0002_auto_20200528_1647"), ] diff --git a/authentik/policies/migrations/0004_policy_execution_logging.py b/authentik/policies/migrations/0004_policy_execution_logging.py index 6240a5e0d..e23d0e6a3 100644 --- a/authentik/policies/migrations/0004_policy_execution_logging.py +++ b/authentik/policies/migrations/0004_policy_execution_logging.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_policies", "0003_auto_20200908_1542"), ] @@ -15,7 +14,10 @@ class Migration(migrations.Migration): name="execution_logging", field=models.BooleanField( default=False, - help_text="When this option is enabled, all executions of this policy will be logged. By default, only execution errors are logged.", + help_text=( + "When this option is enabled, all executions of this policy will be logged. By" + " default, only execution errors are logged." + ), ), ), ] diff --git a/authentik/policies/migrations/0005_binding_group.py b/authentik/policies/migrations/0005_binding_group.py index f73ec953c..4eced114a 100644 --- a/authentik/policies/migrations/0005_binding_group.py +++ b/authentik/policies/migrations/0005_binding_group.py @@ -30,7 +30,6 @@ def migrate_from_groupmembership(apps: Apps, schema_editor: BaseDatabaseSchemaEd class Migration(migrations.Migration): - dependencies = [ ("authentik_core", "0017_managed"), migrations.swappable_dependency(settings.AUTH_USER_MODEL), diff --git a/authentik/policies/migrations/0006_auto_20210329_1334.py b/authentik/policies/migrations/0006_auto_20210329_1334.py index e35b550a0..5f049d285 100644 --- a/authentik/policies/migrations/0006_auto_20210329_1334.py +++ b/authentik/policies/migrations/0006_auto_20210329_1334.py @@ -4,7 +4,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ("authentik_policies", "0005_binding_group"), ] diff --git a/authentik/policies/migrations/0007_policybindingmodel_policy_engine_mode.py b/authentik/policies/migrations/0007_policybindingmodel_policy_engine_mode.py index dd9438b22..97803c4e0 100644 --- a/authentik/policies/migrations/0007_policybindingmodel_policy_engine_mode.py +++ b/authentik/policies/migrations/0007_policybindingmodel_policy_engine_mode.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_policies", "0006_auto_20210329_1334"), ] diff --git a/authentik/policies/migrations/0008_policybinding_authentik_p_policy__534e15_idx_and_more.py b/authentik/policies/migrations/0008_policybinding_authentik_p_policy__534e15_idx_and_more.py index 83244faca..8cd239974 100644 --- a/authentik/policies/migrations/0008_policybinding_authentik_p_policy__534e15_idx_and_more.py +++ b/authentik/policies/migrations/0008_policybinding_authentik_p_policy__534e15_idx_and_more.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_policies", "0007_policybindingmodel_policy_engine_mode"), ] diff --git a/authentik/policies/migrations/0009_alter_policy_name.py b/authentik/policies/migrations/0009_alter_policy_name.py index 732e9f0ba..5b3702aef 100644 --- a/authentik/policies/migrations/0009_alter_policy_name.py +++ b/authentik/policies/migrations/0009_alter_policy_name.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_policies", "0008_policybinding_authentik_p_policy__534e15_idx_and_more"), ] diff --git a/authentik/policies/models.py b/authentik/policies/models.py index a6cf73c91..02913a07e 100644 --- a/authentik/policies/models.py +++ b/authentik/policies/models.py @@ -141,7 +141,6 @@ class PolicyBinding(SerializerModel): return "" class Meta: - verbose_name = _("Policy Binding") verbose_name_plural = _("Policy Bindings") unique_together = ("policy", "target", "order") @@ -164,10 +163,8 @@ class Policy(SerializerModel, CreatedUpdatedModel): execution_logging = models.BooleanField( default=False, help_text=_( - ( - "When this option is enabled, all executions of this policy will be logged. " - "By default, only execution errors are logged." - ) + "When this option is enabled, all executions of this policy will be logged. " + "By default, only execution errors are logged." ), ) diff --git a/authentik/policies/password/migrations/0001_initial.py b/authentik/policies/password/migrations/0001_initial.py index 4352a661a..7defc2e4a 100644 --- a/authentik/policies/password/migrations/0001_initial.py +++ b/authentik/policies/password/migrations/0001_initial.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [ diff --git a/authentik/policies/password/migrations/0002_passwordpolicy_password_field.py b/authentik/policies/password/migrations/0002_passwordpolicy_password_field.py index b0f16010b..99b64d933 100644 --- a/authentik/policies/password/migrations/0002_passwordpolicy_password_field.py +++ b/authentik/policies/password/migrations/0002_passwordpolicy_password_field.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_policies_password", "0001_initial"), ] diff --git a/authentik/policies/password/migrations/0003_passwordpolicy_amount_digits.py b/authentik/policies/password/migrations/0003_passwordpolicy_amount_digits.py index 7e9130e8f..dc30cea00 100644 --- a/authentik/policies/password/migrations/0003_passwordpolicy_amount_digits.py +++ b/authentik/policies/password/migrations/0003_passwordpolicy_amount_digits.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_policies_password", "0002_passwordpolicy_password_field"), ] diff --git a/authentik/policies/password/migrations/0004_passwordpolicy_authentik_p_policy__855e80_idx.py b/authentik/policies/password/migrations/0004_passwordpolicy_authentik_p_policy__855e80_idx.py index 1c984525b..7568d69e2 100644 --- a/authentik/policies/password/migrations/0004_passwordpolicy_authentik_p_policy__855e80_idx.py +++ b/authentik/policies/password/migrations/0004_passwordpolicy_authentik_p_policy__855e80_idx.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_policies_password", "0003_passwordpolicy_amount_digits"), ] diff --git a/authentik/policies/password/migrations/0005_passwordpolicy_check_have_i_been_pwned_and_more.py b/authentik/policies/password/migrations/0005_passwordpolicy_check_have_i_been_pwned_and_more.py index 3b12a7773..421198839 100644 --- a/authentik/policies/password/migrations/0005_passwordpolicy_check_have_i_been_pwned_and_more.py +++ b/authentik/policies/password/migrations/0005_passwordpolicy_check_have_i_been_pwned_and_more.py @@ -3,7 +3,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_policies_password", "0004_passwordpolicy_authentik_p_policy__855e80_idx"), ] @@ -37,7 +36,9 @@ class Migration(migrations.Migration): name="zxcvbn_score_threshold", field=models.PositiveIntegerField( default=2, - help_text="If the zxcvbn score is equal or less than this value, the policy will fail.", + help_text=( + "If the zxcvbn score is equal or less than this value, the policy will fail." + ), ), ), migrations.AlterField( diff --git a/authentik/policies/password/models.py b/authentik/policies/password/models.py index 97697136f..b17fb0b4f 100644 --- a/authentik/policies/password/models.py +++ b/authentik/policies/password/models.py @@ -159,6 +159,5 @@ class PasswordPolicy(Policy): return result class Meta(Policy.PolicyMeta): - verbose_name = _("Password Policy") verbose_name_plural = _("Password Policies") diff --git a/authentik/policies/process.py b/authentik/policies/process.py index 9d43eda75..6340162ae 100644 --- a/authentik/policies/process.py +++ b/authentik/policies/process.py @@ -119,15 +119,20 @@ class PolicyProcess(PROCESS_CLASS): def profiling_wrapper(self): """Run with profiling enabled""" - with Hub.current.start_span( - op="authentik.policy.process.execute", - ) as span, HIST_POLICIES_EXECUTION_TIME.labels( - binding_order=self.binding.order, - binding_target_type=self.binding.target_type, - binding_target_name=self.binding.target_name, - object_pk=str(self.request.obj.pk), - object_type=f"{self.request.obj._meta.app_label}.{self.request.obj._meta.model_name}", - ).time(): + with ( + Hub.current.start_span( + op="authentik.policy.process.execute", + ) as span, + HIST_POLICIES_EXECUTION_TIME.labels( + binding_order=self.binding.order, + binding_target_type=self.binding.target_type, + binding_target_name=self.binding.target_name, + object_pk=str(self.request.obj.pk), + object_type=( + f"{self.request.obj._meta.app_label}.{self.request.obj._meta.model_name}" + ), + ).time(), + ): span: Span span.set_data("policy", self.binding.policy) span.set_data("request", self.request) diff --git a/authentik/policies/reputation/migrations/0001_initial.py b/authentik/policies/reputation/migrations/0001_initial.py index fe7eaf9c2..2cbd065c4 100644 --- a/authentik/policies/reputation/migrations/0001_initial.py +++ b/authentik/policies/reputation/migrations/0001_initial.py @@ -6,7 +6,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [ diff --git a/authentik/policies/reputation/migrations/0002_auto_20210529_2046.py b/authentik/policies/reputation/migrations/0002_auto_20210529_2046.py index e1a3cb247..40861e0f7 100644 --- a/authentik/policies/reputation/migrations/0002_auto_20210529_2046.py +++ b/authentik/policies/reputation/migrations/0002_auto_20210529_2046.py @@ -15,7 +15,6 @@ def migrate_to_username(apps: Apps, schema_editor: BaseDatabaseSchemaEditor): class Migration(migrations.Migration): - dependencies = [ ("authentik_policies_reputation", "0001_initial"), ] diff --git a/authentik/policies/reputation/migrations/0003_reputation_delete_ipreputation_delete_userreputation.py b/authentik/policies/reputation/migrations/0003_reputation_delete_ipreputation_delete_userreputation.py index 6da464f30..f0a5c93ce 100644 --- a/authentik/policies/reputation/migrations/0003_reputation_delete_ipreputation_delete_userreputation.py +++ b/authentik/policies/reputation/migrations/0003_reputation_delete_ipreputation_delete_userreputation.py @@ -6,7 +6,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_policies_reputation", "0002_auto_20210529_2046"), ] diff --git a/authentik/policies/reputation/migrations/0004_reputationpolicy_authentik_p_policy__8f0d70_idx.py b/authentik/policies/reputation/migrations/0004_reputationpolicy_authentik_p_policy__8f0d70_idx.py index 9c6800c01..9c212994e 100644 --- a/authentik/policies/reputation/migrations/0004_reputationpolicy_authentik_p_policy__8f0d70_idx.py +++ b/authentik/policies/reputation/migrations/0004_reputationpolicy_authentik_p_policy__8f0d70_idx.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ( "authentik_policies_reputation", diff --git a/authentik/policies/reputation/models.py b/authentik/policies/reputation/models.py index 8ea7a1674..8bc999d01 100644 --- a/authentik/policies/reputation/models.py +++ b/authentik/policies/reputation/models.py @@ -55,7 +55,6 @@ class ReputationPolicy(Policy): return PolicyResult(bool(passing)) class Meta(Policy.PolicyMeta): - verbose_name = _("Reputation Policy") verbose_name_plural = _("Reputation Policies") @@ -82,5 +81,4 @@ class Reputation(SerializerModel): return f"Reputation {self.identifier}/{self.ip} @ {self.score}" class Meta: - unique_together = ("identifier", "ip") diff --git a/authentik/providers/ldap/api.py b/authentik/providers/ldap/api.py index ba1250998..51810eaf6 100644 --- a/authentik/providers/ldap/api.py +++ b/authentik/providers/ldap/api.py @@ -14,7 +14,6 @@ class LDAPProviderSerializer(ProviderSerializer): outpost_set = ListField(child=CharField(), read_only=True, source="outpost_set.all") class Meta: - model = LDAPProvider fields = ProviderSerializer.Meta.fields + [ "base_dn", @@ -58,7 +57,6 @@ class LDAPOutpostConfigSerializer(ModelSerializer): bind_flow_slug = CharField(source="authorization_flow.slug") class Meta: - model = LDAPProvider fields = [ "pk", diff --git a/authentik/providers/ldap/migrations/0001_squashed_0005_ldapprovider_search_mode.py b/authentik/providers/ldap/migrations/0001_squashed_0005_ldapprovider_search_mode.py index 9f88ccc76..304f91b40 100644 --- a/authentik/providers/ldap/migrations/0001_squashed_0005_ldapprovider_search_mode.py +++ b/authentik/providers/ldap/migrations/0001_squashed_0005_ldapprovider_search_mode.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - replaces = [ ("authentik_providers_ldap", "0001_initial"), ("authentik_providers_ldap", "0002_ldapprovider_search_group"), @@ -47,7 +46,10 @@ class Migration(migrations.Migration): "search_group", models.ForeignKey( default=None, - help_text="Users in this group can do search queries. If not set, every user can execute search queries.", + help_text=( + "Users in this group can do search queries. If not set, every user can" + " execute search queries." + ), null=True, on_delete=django.db.models.deletion.SET_DEFAULT, to="authentik_core.group", @@ -67,14 +69,23 @@ class Migration(migrations.Migration): "gid_start_number", models.IntegerField( default=4000, - help_text="The start for gidNumbers, this number is added to a number generated from the group.Pk to make sure that the numbers aren't too low for POSIX groups. Default is 4000 to ensure that we don't collide with local groups or users primary groups gidNumber", + help_text=( + "The start for gidNumbers, this number is added to a number generated" + " from the group.Pk to make sure that the numbers aren't too low for" + " POSIX groups. Default is 4000 to ensure that we don't collide with" + " local groups or users primary groups gidNumber" + ), ), ), ( "uid_start_number", models.IntegerField( default=2000, - help_text="The start for uidNumbers, this number is added to the user.Pk to make sure that the numbers aren't too low for POSIX users. Default is 2000 to ensure that we don't collide with local users uidNumber", + help_text=( + "The start for uidNumbers, this number is added to the user.Pk to make" + " sure that the numbers aren't too low for POSIX users. Default is 2000" + " to ensure that we don't collide with local users uidNumber" + ), ), ), ( diff --git a/authentik/providers/ldap/migrations/0002_ldapprovider_bind_mode.py b/authentik/providers/ldap/migrations/0002_ldapprovider_bind_mode.py index f39ab1db4..8cc53e8e1 100644 --- a/authentik/providers/ldap/migrations/0002_ldapprovider_bind_mode.py +++ b/authentik/providers/ldap/migrations/0002_ldapprovider_bind_mode.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_providers_ldap", "0001_squashed_0005_ldapprovider_search_mode"), ] diff --git a/authentik/providers/ldap/models.py b/authentik/providers/ldap/models.py index ae2037c6b..ad90777ec 100644 --- a/authentik/providers/ldap/models.py +++ b/authentik/providers/ldap/models.py @@ -94,6 +94,5 @@ class LDAPProvider(OutpostModel, Provider): return required_models class Meta: - verbose_name = _("LDAP Provider") verbose_name_plural = _("LDAP Providers") diff --git a/authentik/providers/oauth2/api/providers.py b/authentik/providers/oauth2/api/providers.py index db59d311a..7eb994c40 100644 --- a/authentik/providers/oauth2/api/providers.py +++ b/authentik/providers/oauth2/api/providers.py @@ -20,7 +20,6 @@ class OAuth2ProviderSerializer(ProviderSerializer): """OAuth2Provider Serializer""" class Meta: - model = OAuth2Provider fields = ProviderSerializer.Meta.fields + [ "authorization_flow", diff --git a/authentik/providers/oauth2/api/scopes.py b/authentik/providers/oauth2/api/scopes.py index 576110fc2..5b88b698a 100644 --- a/authentik/providers/oauth2/api/scopes.py +++ b/authentik/providers/oauth2/api/scopes.py @@ -25,7 +25,6 @@ class ScopeMappingSerializer(PropertyMappingSerializer): scope_name = CharField(help_text="Scope name requested by the client", validators=[no_space]) class Meta: - model = ScopeMapping fields = PropertyMappingSerializer.Meta.fields + [ "scope_name", diff --git a/authentik/providers/oauth2/api/tokens.py b/authentik/providers/oauth2/api/tokens.py index 882c28e57..9c64a7ea7 100644 --- a/authentik/providers/oauth2/api/tokens.py +++ b/authentik/providers/oauth2/api/tokens.py @@ -24,7 +24,6 @@ class ExpiringBaseGrantModelSerializer(ModelSerializer, MetaNameSerializer): scope = ListField(child=CharField()) class Meta: - model = AuthorizationCode fields = ["pk", "provider", "user", "is_expired", "expires", "scope"] depth = 2 @@ -40,7 +39,6 @@ class RefreshTokenModelSerializer(ExpiringBaseGrantModelSerializer): return dumps(instance.id_token.to_dict(), indent=4) class Meta: - model = RefreshToken fields = [ "pk", diff --git a/authentik/providers/oauth2/errors.py b/authentik/providers/oauth2/errors.py index 5545f34f1..9d78d290d 100644 --- a/authentik/providers/oauth2/errors.py +++ b/authentik/providers/oauth2/errors.py @@ -55,8 +55,10 @@ class RedirectUriError(OAuth2Error): def to_event(self, **kwargs) -> Event: return super().to_event( - f"Invalid redirect URI was used. Client used '{self.provided_uri}'. " - f"Allowed redirect URIs are {','.join(self.allowed_uris)}", + ( + f"Invalid redirect URI was used. Client used '{self.provided_uri}'. " + f"Allowed redirect URIs are {','.join(self.allowed_uris)}" + ), **kwargs, ) @@ -246,7 +248,7 @@ class DeviceCodeError(OAuth2Error): "The authorization request is still pending as the end user hasn't " "yet completed the user-interaction steps" ), - "access_denied": ("The authorization request was denied."), + "access_denied": "The authorization request was denied.", "expired_token": ( 'The "device_code" has expired, and the device authorization ' "session has concluded. The client MAY commence a new device " diff --git a/authentik/providers/oauth2/migrations/0001_initial.py b/authentik/providers/oauth2/migrations/0001_initial.py index 01fae0762..24f8019fe 100644 --- a/authentik/providers/oauth2/migrations/0001_initial.py +++ b/authentik/providers/oauth2/migrations/0001_initial.py @@ -12,7 +12,6 @@ import authentik.lib.utils.time class Migration(migrations.Migration): - initial = True dependencies = [ @@ -47,7 +46,11 @@ class Migration(migrations.Migration): ("public", "Public"), ], default="confidential", - help_text="Confidential clients are capable of maintaining the confidentiality\n of their credentials. Public clients are incapable.", + help_text=( + "Confidential clients are capable of maintaining the" + " confidentiality\n of their credentials. Public clients are" + " incapable." + ), max_length=30, verbose_name="Client Type", ), @@ -123,7 +126,10 @@ class Migration(migrations.Migration): "include_claims_in_id_token", models.BooleanField( default=True, - help_text="Include User claims from scopes in the id_token, for applications that don't access the userinfo endpoint.", + help_text=( + "Include User claims from scopes in the id_token, for applications that" + " don't access the userinfo endpoint." + ), verbose_name="Include claims in id_token", ), ), @@ -131,14 +137,20 @@ class Migration(migrations.Migration): "token_validity", models.TextField( default="minutes=10", - help_text="Tokens not valid on or after current time + this value (Format: hours=1;minutes=2;seconds=3).", + help_text=( + "Tokens not valid on or after current time + this value (Format:" + " hours=1;minutes=2;seconds=3)." + ), validators=[authentik.lib.utils.time.timedelta_string_validator], ), ), ( "rsa_key", models.ForeignKey( - help_text="Key used to sign the tokens. Only required when JWT Algorithm is set to RS256.", + help_text=( + "Key used to sign the tokens. Only required when JWT Algorithm is set" + " to RS256." + ), on_delete=django.db.models.deletion.CASCADE, to="authentik_crypto.certificatekeypair", verbose_name="RSA Key", @@ -172,7 +184,10 @@ class Migration(migrations.Migration): "description", models.TextField( blank=True, - help_text="Description shown to the user when consenting. If left empty, the user won't be informed.", + help_text=( + "Description shown to the user when consenting. If left empty, the user" + " won't be informed." + ), ), ), ], diff --git a/authentik/providers/oauth2/migrations/0002_oauth2provider_sub_mode.py b/authentik/providers/oauth2/migrations/0002_oauth2provider_sub_mode.py index 895d6fa03..e3cdb8538 100644 --- a/authentik/providers/oauth2/migrations/0002_oauth2provider_sub_mode.py +++ b/authentik/providers/oauth2/migrations/0002_oauth2provider_sub_mode.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_providers_oauth2", "0001_initial"), ] @@ -23,11 +22,17 @@ class Migration(migrations.Migration): ), ( "user_upn", - "Based on the User's UPN, only works if user has a 'upn' attribute set. Use this method only if you have different UPN and Mail domains.", + ( + "Based on the User's UPN, only works if user has a 'upn' attribute set." + " Use this method only if you have different UPN and Mail domains." + ), ), ], default="hashed_user_id", - help_text="Configure what data should be used as unique User Identifier. For most cases, the default should be fine.", + help_text=( + "Configure what data should be used as unique User Identifier. For most cases," + " the default should be fine." + ), ), ), ] diff --git a/authentik/providers/oauth2/migrations/0003_auto_20200916_2129.py b/authentik/providers/oauth2/migrations/0003_auto_20200916_2129.py index 2481d6f88..91706d5ba 100644 --- a/authentik/providers/oauth2/migrations/0003_auto_20200916_2129.py +++ b/authentik/providers/oauth2/migrations/0003_auto_20200916_2129.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_providers_oauth2", "0002_oauth2provider_sub_mode"), ] @@ -16,7 +15,10 @@ class Migration(migrations.Migration): field=models.CharField( choices=[("confidential", "Confidential"), ("public", "Public")], default="confidential", - help_text="Confidential clients are capable of maintaining the confidentiality\n of their credentials. Public clients are incapable.", + help_text=( + "Confidential clients are capable of maintaining the confidentiality\n of" + " their credentials. Public clients are incapable." + ), max_length=30, verbose_name="Client Type", ), diff --git a/authentik/providers/oauth2/migrations/0004_remove_oauth2provider_post_logout_redirect_uris.py b/authentik/providers/oauth2/migrations/0004_remove_oauth2provider_post_logout_redirect_uris.py index a5776fee8..baa2d2c2c 100644 --- a/authentik/providers/oauth2/migrations/0004_remove_oauth2provider_post_logout_redirect_uris.py +++ b/authentik/providers/oauth2/migrations/0004_remove_oauth2provider_post_logout_redirect_uris.py @@ -4,7 +4,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ("authentik_providers_oauth2", "0003_auto_20200916_2129"), ] diff --git a/authentik/providers/oauth2/migrations/0005_auto_20200920_1240.py b/authentik/providers/oauth2/migrations/0005_auto_20200920_1240.py index 4a12ca312..fb75c72c5 100644 --- a/authentik/providers/oauth2/migrations/0005_auto_20200920_1240.py +++ b/authentik/providers/oauth2/migrations/0005_auto_20200920_1240.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ( "authentik_providers_oauth2", diff --git a/authentik/providers/oauth2/migrations/0006_remove_oauth2provider_name.py b/authentik/providers/oauth2/migrations/0006_remove_oauth2provider_name.py index cead8957f..1cdb222cc 100644 --- a/authentik/providers/oauth2/migrations/0006_remove_oauth2provider_name.py +++ b/authentik/providers/oauth2/migrations/0006_remove_oauth2provider_name.py @@ -15,7 +15,6 @@ def update_name_temp(apps: Apps, schema_editor: BaseDatabaseSchemaEditor): class Migration(migrations.Migration): - dependencies = [ ("authentik_core", "0011_provider_name_temp"), ("authentik_providers_oauth2", "0005_auto_20200920_1240"), diff --git a/authentik/providers/oauth2/migrations/0007_auto_20201016_1107_squashed_0017_alter_oauth2provider_token_validity.py b/authentik/providers/oauth2/migrations/0007_auto_20201016_1107_squashed_0017_alter_oauth2provider_token_validity.py index 7363310e8..81656d9cc 100644 --- a/authentik/providers/oauth2/migrations/0007_auto_20201016_1107_squashed_0017_alter_oauth2provider_token_validity.py +++ b/authentik/providers/oauth2/migrations/0007_auto_20201016_1107_squashed_0017_alter_oauth2provider_token_validity.py @@ -23,7 +23,6 @@ def set_managed_flag(apps: Apps, schema_editor): class Migration(migrations.Migration): - replaces = [ ("authentik_providers_oauth2", "0007_auto_20201016_1107"), ("authentik_providers_oauth2", "0008_oauth2provider_issuer_mode"), @@ -81,7 +80,10 @@ class Migration(migrations.Migration): name="access_code_validity", field=models.TextField( default="minutes=1", - help_text="Access codes not valid on or after current time + this value (Format: hours=1;minutes=2;seconds=3).", + help_text=( + "Access codes not valid on or after current time + this value (Format:" + " hours=1;minutes=2;seconds=3)." + ), validators=[authentik.lib.utils.time.timedelta_string_validator], ), ), @@ -94,7 +96,9 @@ class Migration(migrations.Migration): model_name="oauth2provider", name="rsa_key", field=models.ForeignKey( - help_text="Key used to sign the tokens. Only required when JWT Algorithm is set to RS256.", + help_text=( + "Key used to sign the tokens. Only required when JWT Algorithm is set to RS256." + ), null=True, on_delete=django.db.models.deletion.SET_NULL, to="authentik_crypto.certificatekeypair", @@ -121,7 +125,10 @@ class Migration(migrations.Migration): name="token_validity", field=models.TextField( default="days=30", - help_text="Tokens not valid on or after current time + this value (Format: hours=1;minutes=2;seconds=3).", + help_text=( + "Tokens not valid on or after current time + this value (Format:" + " hours=1;minutes=2;seconds=3)." + ), validators=[authentik.lib.utils.time.timedelta_string_validator], ), ), diff --git a/authentik/providers/oauth2/migrations/0008_rename_rsa_key_oauth2provider_signing_key_and_more.py b/authentik/providers/oauth2/migrations/0008_rename_rsa_key_oauth2provider_signing_key_and_more.py index 297c11ad0..903405589 100644 --- a/authentik/providers/oauth2/migrations/0008_rename_rsa_key_oauth2provider_signing_key_and_more.py +++ b/authentik/providers/oauth2/migrations/0008_rename_rsa_key_oauth2provider_signing_key_and_more.py @@ -4,7 +4,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ( "authentik_providers_oauth2", diff --git a/authentik/providers/oauth2/migrations/0009_oauth2provider_verification_keys_and_more.py b/authentik/providers/oauth2/migrations/0009_oauth2provider_verification_keys_and_more.py index 8503b060b..69ed298c4 100644 --- a/authentik/providers/oauth2/migrations/0009_oauth2provider_verification_keys_and_more.py +++ b/authentik/providers/oauth2/migrations/0009_oauth2provider_verification_keys_and_more.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_crypto", "0003_certificatekeypair_managed"), ("authentik_providers_oauth2", "0008_rename_rsa_key_oauth2provider_signing_key_and_more"), @@ -16,7 +15,10 @@ class Migration(migrations.Migration): model_name="oauth2provider", name="verification_keys", field=models.ManyToManyField( - help_text="JWTs created with the configured certificates can authenticate with this provider.", + help_text=( + "JWTs created with the configured certificates can authenticate with this" + " provider." + ), related_name="+", to="authentik_crypto.certificatekeypair", verbose_name="Allowed certificates for JWT-based client_credentials", @@ -26,7 +28,9 @@ class Migration(migrations.Migration): model_name="oauth2provider", name="signing_key", field=models.ForeignKey( - help_text="Key used to sign the tokens. Only required when JWT Algorithm is set to RS256.", + help_text=( + "Key used to sign the tokens. Only required when JWT Algorithm is set to RS256." + ), null=True, on_delete=django.db.models.deletion.SET_NULL, to="authentik_crypto.certificatekeypair", diff --git a/authentik/providers/oauth2/migrations/0010_alter_oauth2provider_verification_keys.py b/authentik/providers/oauth2/migrations/0010_alter_oauth2provider_verification_keys.py index 11718cb38..4abcb74d1 100644 --- a/authentik/providers/oauth2/migrations/0010_alter_oauth2provider_verification_keys.py +++ b/authentik/providers/oauth2/migrations/0010_alter_oauth2provider_verification_keys.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_crypto", "0003_certificatekeypair_managed"), ("authentik_providers_oauth2", "0009_oauth2provider_verification_keys_and_more"), @@ -17,7 +16,10 @@ class Migration(migrations.Migration): field=models.ManyToManyField( blank=True, default=None, - help_text="JWTs created with the configured certificates can authenticate with this provider.", + help_text=( + "JWTs created with the configured certificates can authenticate with this" + " provider." + ), related_name="+", to="authentik_crypto.certificatekeypair", verbose_name="Allowed certificates for JWT-based client_credentials", diff --git a/authentik/providers/oauth2/migrations/0011_oauth2provider_jwks_sources_and_more.py b/authentik/providers/oauth2/migrations/0011_oauth2provider_jwks_sources_and_more.py index 8d1983c53..969f67bcf 100644 --- a/authentik/providers/oauth2/migrations/0011_oauth2provider_jwks_sources_and_more.py +++ b/authentik/providers/oauth2/migrations/0011_oauth2provider_jwks_sources_and_more.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ( "authentik_sources_oauth", @@ -23,7 +22,9 @@ class Migration(migrations.Migration): default=None, related_name="oauth2_providers", to="authentik_sources_oauth.oauthsource", - verbose_name="Any JWT signed by the JWK of the selected source can be used to authenticate.", + verbose_name=( + "Any JWT signed by the JWK of the selected source can be used to authenticate." + ), ), ), migrations.AlterField( @@ -32,7 +33,10 @@ class Migration(migrations.Migration): field=models.ManyToManyField( blank=True, default=None, - help_text="JWTs created with the configured certificates can authenticate with this provider.", + help_text=( + "JWTs created with the configured certificates can authenticate with this" + " provider." + ), related_name="oauth2_providers", to="authentik_crypto.certificatekeypair", verbose_name="Allowed certificates for JWT-based client_credentials", diff --git a/authentik/providers/oauth2/migrations/0012_remove_oauth2provider_verification_keys.py b/authentik/providers/oauth2/migrations/0012_remove_oauth2provider_verification_keys.py index d75063ba1..8a2cea9ab 100644 --- a/authentik/providers/oauth2/migrations/0012_remove_oauth2provider_verification_keys.py +++ b/authentik/providers/oauth2/migrations/0012_remove_oauth2provider_verification_keys.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_providers_oauth2", "0011_oauth2provider_jwks_sources_and_more"), ] @@ -20,7 +19,10 @@ class Migration(migrations.Migration): field=models.CharField( choices=[("confidential", "Confidential"), ("public", "Public")], default="confidential", - help_text="Confidential clients are capable of maintaining the confidentiality of their credentials. Public clients are incapable", + help_text=( + "Confidential clients are capable of maintaining the confidentiality of their" + " credentials. Public clients are incapable" + ), max_length=30, verbose_name="Client Type", ), diff --git a/authentik/providers/oauth2/migrations/0013_devicetoken.py b/authentik/providers/oauth2/migrations/0013_devicetoken.py index 987f2a354..6eeb8ef2a 100644 --- a/authentik/providers/oauth2/migrations/0013_devicetoken.py +++ b/authentik/providers/oauth2/migrations/0013_devicetoken.py @@ -9,7 +9,6 @@ import authentik.lib.generators class Migration(migrations.Migration): - dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ("authentik_providers_oauth2", "0012_remove_oauth2provider_verification_keys"), diff --git a/authentik/providers/oauth2/models.py b/authentik/providers/oauth2/models.py index a85b1869a..a14e2140f 100644 --- a/authentik/providers/oauth2/models.py +++ b/authentik/providers/oauth2/models.py @@ -74,10 +74,8 @@ class SubModes(models.TextChoices): USER_UPN = ( "user_upn", _( - ( - "Based on the User's UPN, only works if user has a 'upn' attribute set. " - "Use this method only if you have different UPN and Mail domains." - ) + "Based on the User's UPN, only works if user has a 'upn' attribute set. " + "Use this method only if you have different UPN and Mail domains." ), ) @@ -117,10 +115,8 @@ class ScopeMapping(PropertyMapping): description = models.TextField( blank=True, help_text=_( - ( - "Description shown to the user when consenting. " - "If left empty, the user won't be informed." - ) + "Description shown to the user when consenting. " + "If left empty, the user won't be informed." ), ) @@ -138,7 +134,6 @@ class ScopeMapping(PropertyMapping): return f"Scope Mapping {self.name} ({self.scope_name})" class Meta: - verbose_name = _("Scope Mapping") verbose_name_plural = _("Scope Mappings") @@ -179,10 +174,8 @@ class OAuth2Provider(Provider): default=True, verbose_name=_("Include claims in id_token"), help_text=_( - ( - "Include User claims from scopes in the id_token, for applications " - "that don't access the userinfo endpoint." - ) + "Include User claims from scopes in the id_token, for applications " + "that don't access the userinfo endpoint." ), ) @@ -190,20 +183,16 @@ class OAuth2Provider(Provider): default="minutes=1", validators=[timedelta_string_validator], help_text=_( - ( - "Access codes not valid on or after current time + this value " - "(Format: hours=1;minutes=2;seconds=3)." - ) + "Access codes not valid on or after current time + this value " + "(Format: hours=1;minutes=2;seconds=3)." ), ) token_validity = models.TextField( default="days=30", validators=[timedelta_string_validator], help_text=_( - ( - "Tokens not valid on or after current time + this value " - "(Format: hours=1;minutes=2;seconds=3)." - ) + "Tokens not valid on or after current time + this value " + "(Format: hours=1;minutes=2;seconds=3)." ), ) @@ -211,16 +200,14 @@ class OAuth2Provider(Provider): choices=SubModes.choices, default=SubModes.HASHED_USER_ID, help_text=_( - ( - "Configure what data should be used as unique User Identifier. For most cases, " - "the default should be fine." - ) + "Configure what data should be used as unique User Identifier. For most cases, " + "the default should be fine." ), ) issuer_mode = models.TextField( choices=IssuerMode.choices, default=IssuerMode.PER_PROVIDER, - help_text=_(("Configure how the issuer field of the ID Token should be filled.")), + help_text=_("Configure how the issuer field of the ID Token should be filled."), ) signing_key = models.ForeignKey( @@ -321,7 +308,6 @@ class OAuth2Provider(Provider): return encode(payload, key, algorithm=alg, headers=headers) class Meta: - verbose_name = _("OAuth2/OpenID Provider") verbose_name_plural = _("OAuth2/OpenID Providers") @@ -496,10 +482,7 @@ class RefreshToken(SerializerModel, ExpiringModel, BaseGrantModel): sub = user.attributes.get("upn", user.uid) else: raise ValueError( - ( - f"Provider {self.provider} has invalid sub_mode " - f"selected: {self.provider.sub_mode}" - ) + f"Provider {self.provider} has invalid sub_mode selected: {self.provider.sub_mode}" ) # Convert datetimes into timestamps. now = datetime.now() diff --git a/authentik/providers/oauth2/views/authorize.py b/authentik/providers/oauth2/views/authorize.py index 963a60f87..60a17a5d2 100644 --- a/authentik/providers/oauth2/views/authorize.py +++ b/authentik/providers/oauth2/views/authorize.py @@ -405,11 +405,9 @@ class OAuthFulfillmentStage(StageView): data={ "type": ChallengeTypes.NATIVE.value, "component": "ak-stage-autosubmit", - "title": ( - self.executor.plan.context.get( - PLAN_CONTEXT_TITLE, - _("Redirecting to %(app)s..." % {"app": self.application.name}), - ) + "title": self.executor.plan.context.get( + PLAN_CONTEXT_TITLE, + _("Redirecting to %(app)s..." % {"app": self.application.name}), ), "url": self.params.redirect_uri, "attrs": query_params, diff --git a/authentik/providers/oauth2/views/device_backchannel.py b/authentik/providers/oauth2/views/device_backchannel.py index ff5168904..a8b511f96 100644 --- a/authentik/providers/oauth2/views/device_backchannel.py +++ b/authentik/providers/oauth2/views/device_backchannel.py @@ -68,12 +68,14 @@ class DeviceView(View): { "device_code": token.device_code, "verification_uri": device_url, - "verification_uri_complete": device_url - + "?" - + urlencode( - { - QS_KEY_CODE: token.user_code, - } + "verification_uri_complete": ( + device_url + + "?" + + urlencode( + { + QS_KEY_CODE: token.user_code, + } + ) ), "user_code": token.user_code, "expires_in": int(until.total_seconds()), diff --git a/authentik/providers/oauth2/views/jwks.py b/authentik/providers/oauth2/views/jwks.py index b6b397e66..166d583f4 100644 --- a/authentik/providers/oauth2/views/jwks.py +++ b/authentik/providers/oauth2/views/jwks.py @@ -34,6 +34,7 @@ min_length_map = { SECP521R1: 66, } + # https://github.com/jpadilla/pyjwt/issues/709 def bytes_from_int(val: int, min_length: int = 0) -> bytes: """Custom bytes_from_int that accepts a minimum length""" diff --git a/authentik/providers/proxy/api.py b/authentik/providers/proxy/api.py index a4733b520..85830ac8e 100644 --- a/authentik/providers/proxy/api.py +++ b/authentik/providers/proxy/api.py @@ -75,7 +75,6 @@ class ProxyProviderSerializer(ProviderSerializer): return instance class Meta: - model = ProxyProvider fields = ProviderSerializer.Meta.fields + [ "client_id", @@ -152,7 +151,6 @@ class ProxyOutpostConfigSerializer(ModelSerializer): return list(scope_names) class Meta: - model = ProxyProvider fields = [ "pk", diff --git a/authentik/providers/proxy/migrations/0001_squashed_0014_proxy_v2.py b/authentik/providers/proxy/migrations/0001_squashed_0014_proxy_v2.py index 618c79062..58b3b9213 100644 --- a/authentik/providers/proxy/migrations/0001_squashed_0014_proxy_v2.py +++ b/authentik/providers/proxy/migrations/0001_squashed_0014_proxy_v2.py @@ -36,7 +36,6 @@ def migrate_mode(apps: Apps, schema_editor: BaseDatabaseSchemaEditor): class Migration(migrations.Migration): - replaces = [ ("authentik_providers_proxy", "0001_initial"), ("authentik_providers_proxy", "0002_proxyprovider_cookie_secret"), @@ -111,7 +110,10 @@ class Migration(migrations.Migration): models.TextField( blank=True, default="", - help_text="Regular expressions for which authentication is not required. Each new line is interpreted as a new Regular Expression.", + help_text=( + "Regular expressions for which authentication is not required. Each new" + " line is interpreted as a new Regular Expression." + ), ), ), ( @@ -126,7 +128,10 @@ class Migration(migrations.Migration): "basic_auth_enabled", models.BooleanField( default=False, - help_text="Set a custom HTTP-Basic Authentication header based on values from authentik.", + help_text=( + "Set a custom HTTP-Basic Authentication header based on values from" + " authentik." + ), verbose_name="Set HTTP-Basic Authentication", ), ), @@ -134,7 +139,10 @@ class Migration(migrations.Migration): "basic_auth_password_attribute", models.TextField( blank=True, - help_text="User/Group Attribute used for the password part of the HTTP-Basic Header.", + help_text=( + "User/Group Attribute used for the password part of the HTTP-Basic" + " Header." + ), verbose_name="HTTP-Basic Password Key", ), ), @@ -142,7 +150,10 @@ class Migration(migrations.Migration): "basic_auth_user_attribute", models.TextField( blank=True, - help_text="User/Group Attribute used for the user part of the HTTP-Basic Header. If not set, the user's Email address is used.", + help_text=( + "User/Group Attribute used for the user part of the HTTP-Basic Header." + " If not set, the user's Email address is used." + ), verbose_name="HTTP-Basic Username Key", ), ), @@ -150,7 +161,10 @@ class Migration(migrations.Migration): "forward_auth_mode", models.BooleanField( default=False, - help_text="Enable support for forwardAuth in traefik and nginx auth_request. Exclusive with internal_host.", + help_text=( + "Enable support for forwardAuth in traefik and nginx auth_request." + " Exclusive with internal_host." + ), ), ), ("cookie_domain", models.TextField(blank=True, default="")), @@ -163,7 +177,10 @@ class Migration(migrations.Migration): ("forward_domain", "Forward Domain"), ], default="proxy", - help_text="Enable support for forwardAuth in traefik and nginx auth_request. Exclusive with internal_host.", + help_text=( + "Enable support for forwardAuth in traefik and nginx auth_request." + " Exclusive with internal_host." + ), ), ), ], diff --git a/authentik/providers/proxy/migrations/0015_proxyprovider_receive_header_auth.py b/authentik/providers/proxy/migrations/0015_proxyprovider_receive_header_auth.py index 5770ac306..f91c9ec1e 100644 --- a/authentik/providers/proxy/migrations/0015_proxyprovider_receive_header_auth.py +++ b/authentik/providers/proxy/migrations/0015_proxyprovider_receive_header_auth.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_providers_proxy", "0001_squashed_0014_proxy_v2"), ] @@ -15,7 +14,10 @@ class Migration(migrations.Migration): name="intercept_header_auth", field=models.BooleanField( default=True, - help_text="When enabled, this provider will intercept the authorization header and authenticate requests based on its value.", + help_text=( + "When enabled, this provider will intercept the authorization header and" + " authenticate requests based on its value." + ), ), ), ] diff --git a/authentik/providers/proxy/models.py b/authentik/providers/proxy/models.py index d5c7fdce1..18aef3d3e 100644 --- a/authentik/providers/proxy/models.py +++ b/authentik/providers/proxy/models.py @@ -67,10 +67,8 @@ class ProxyProvider(OutpostModel, OAuth2Provider): default="", blank=True, help_text=_( - ( - "Regular expressions for which authentication is not required. " - "Each new line is interpreted as a new Regular Expression." - ) + "Regular expressions for which authentication is not required. " + "Each new line is interpreted as a new Regular Expression." ), ) @@ -92,16 +90,14 @@ class ProxyProvider(OutpostModel, OAuth2Provider): blank=True, verbose_name=_("HTTP-Basic Username Key"), help_text=_( - ( - "User/Group Attribute used for the user part of the HTTP-Basic Header. " - "If not set, the user's Email address is used." - ) + "User/Group Attribute used for the user part of the HTTP-Basic Header. " + "If not set, the user's Email address is used." ), ) basic_auth_password_attribute = models.TextField( blank=True, verbose_name=_("HTTP-Basic Password Key"), - help_text=_(("User/Group Attribute used for the password part of the HTTP-Basic Header.")), + help_text=_("User/Group Attribute used for the password part of the HTTP-Basic Header."), ) certificate = models.ForeignKey( @@ -155,7 +151,6 @@ class ProxyProvider(OutpostModel, OAuth2Provider): return required_models class Meta: - verbose_name = _("Proxy Provider") verbose_name_plural = _("Proxy Providers") authentik_used_by_shadows = ["authentik_providers_oauth2.oauth2provider"] diff --git a/authentik/providers/saml/api/property_mapping.py b/authentik/providers/saml/api/property_mapping.py index 33c1e0cc4..33ca6e4bd 100644 --- a/authentik/providers/saml/api/property_mapping.py +++ b/authentik/providers/saml/api/property_mapping.py @@ -14,7 +14,6 @@ class SAMLPropertyMappingSerializer(PropertyMappingSerializer): """SAMLPropertyMapping Serializer""" class Meta: - model = SAMLPropertyMapping fields = PropertyMappingSerializer.Meta.fields + [ "saml_name", diff --git a/authentik/providers/saml/api/providers.py b/authentik/providers/saml/api/providers.py index 7164e1d2f..6dffe55fa 100644 --- a/authentik/providers/saml/api/providers.py +++ b/authentik/providers/saml/api/providers.py @@ -132,7 +132,6 @@ class SAMLProviderSerializer(ProviderSerializer): return "-" class Meta: - model = SAMLProvider fields = ProviderSerializer.Meta.fields + [ "acs_url", @@ -204,7 +203,7 @@ class SAMLProviderViewSet(UsedByMixin, ModelViewSet): SAML_BINDING_REDIRECT, SAML_BINDING_POST, ], - description=("Optionally force the metadata to only include one binding."), + description="Optionally force the metadata to only include one binding.", ), ], ) diff --git a/authentik/providers/saml/migrations/0001_squashed_0005_remove_samlprovider_processor_path.py b/authentik/providers/saml/migrations/0001_squashed_0005_remove_samlprovider_processor_path.py index 463d59dc0..db7a26da2 100644 --- a/authentik/providers/saml/migrations/0001_squashed_0005_remove_samlprovider_processor_path.py +++ b/authentik/providers/saml/migrations/0001_squashed_0005_remove_samlprovider_processor_path.py @@ -7,7 +7,6 @@ import authentik.lib.utils.time class Migration(migrations.Migration): - replaces = [ ("authentik_providers_saml", "0001_initial"), ("authentik_providers_saml", "0002_default_saml_property_mappings"), @@ -69,7 +68,10 @@ class Migration(migrations.Migration): "assertion_valid_not_before", models.TextField( default="minutes=-5", - help_text="Assertion valid not before current time + this value (Format: hours=-1;minutes=-2;seconds=-3).", + help_text=( + "Assertion valid not before current time + this value (Format:" + " hours=-1;minutes=-2;seconds=-3)." + ), validators=[authentik.lib.utils.time.timedelta_string_validator], ), ), @@ -77,7 +79,10 @@ class Migration(migrations.Migration): "assertion_valid_not_on_or_after", models.TextField( default="minutes=5", - help_text="Assertion not valid on or after current time + this value (Format: hours=1;minutes=2;seconds=3).", + help_text=( + "Assertion not valid on or after current time + this value (Format:" + " hours=1;minutes=2;seconds=3)." + ), validators=[authentik.lib.utils.time.timedelta_string_validator], ), ), @@ -85,7 +90,10 @@ class Migration(migrations.Migration): "session_valid_not_on_or_after", models.TextField( default="minutes=86400", - help_text="Session not valid on or after current time + this value (Format: hours=1;minutes=2;seconds=3).", + help_text=( + "Session not valid on or after current time + this value (Format:" + " hours=1;minutes=2;seconds=3)." + ), validators=[authentik.lib.utils.time.timedelta_string_validator], ), ), @@ -114,7 +122,10 @@ class Migration(migrations.Migration): "require_signing", models.BooleanField( default=False, - help_text="Require Requests to be signed by an X509 Certificate. Must match the Certificate selected in `Signing Keypair`.", + help_text=( + "Require Requests to be signed by an X509 Certificate. Must match the" + " Certificate selected in `Signing Keypair`." + ), ), ), ( diff --git a/authentik/providers/saml/migrations/0006_remove_samlprovider_name.py b/authentik/providers/saml/migrations/0006_remove_samlprovider_name.py index d68e1b059..cda71cdcd 100644 --- a/authentik/providers/saml/migrations/0006_remove_samlprovider_name.py +++ b/authentik/providers/saml/migrations/0006_remove_samlprovider_name.py @@ -15,7 +15,6 @@ def update_name_temp(apps: Apps, schema_editor: BaseDatabaseSchemaEditor): class Migration(migrations.Migration): - dependencies = [ ("authentik_core", "0011_provider_name_temp"), ("authentik_providers_saml", "0005_remove_samlprovider_processor_path"), diff --git a/authentik/providers/saml/migrations/0007_samlprovider_verification_kp.py b/authentik/providers/saml/migrations/0007_samlprovider_verification_kp.py index 016b4bc07..b83cf6ea8 100644 --- a/authentik/providers/saml/migrations/0007_samlprovider_verification_kp.py +++ b/authentik/providers/saml/migrations/0007_samlprovider_verification_kp.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_crypto", "0002_create_self_signed_kp"), ("authentik_providers_saml", "0006_remove_samlprovider_name"), diff --git a/authentik/providers/saml/migrations/0008_auto_20201112_1036.py b/authentik/providers/saml/migrations/0008_auto_20201112_1036.py index 86aa08b34..c0260518e 100644 --- a/authentik/providers/saml/migrations/0008_auto_20201112_1036.py +++ b/authentik/providers/saml/migrations/0008_auto_20201112_1036.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_crypto", "0002_create_self_signed_kp"), ("authentik_providers_saml", "0007_samlprovider_verification_kp"), @@ -48,7 +47,9 @@ class Migration(migrations.Migration): field=models.TextField( choices=[("redirect", "Redirect"), ("post", "Post")], default="redirect", - help_text="This determines how authentik sends the response back to the Service Provider.", + help_text=( + "This determines how authentik sends the response back to the Service Provider." + ), verbose_name="Service Provider Binding", ), ), @@ -58,7 +59,10 @@ class Migration(migrations.Migration): field=models.ForeignKey( blank=True, default=None, - help_text="When selected, incoming assertion's Signatures will be validated against this certificate. To allow unsigned Requests, leave on default.", + help_text=( + "When selected, incoming assertion's Signatures will be validated against this" + " certificate. To allow unsigned Requests, leave on default." + ), null=True, on_delete=django.db.models.deletion.SET_NULL, related_name="+", diff --git a/authentik/providers/saml/migrations/0009_auto_20201112_2016.py b/authentik/providers/saml/migrations/0009_auto_20201112_2016.py index 5ac5b73a1..cd794b4fe 100644 --- a/authentik/providers/saml/migrations/0009_auto_20201112_2016.py +++ b/authentik/providers/saml/migrations/0009_auto_20201112_2016.py @@ -31,7 +31,6 @@ def update_algorithms(apps: Apps, schema_editor: BaseDatabaseSchemaEditor): class Migration(migrations.Migration): - dependencies = [ ("authentik_providers_saml", "0008_auto_20201112_1036"), ] diff --git a/authentik/providers/saml/migrations/0010_auto_20201230_2112.py b/authentik/providers/saml/migrations/0010_auto_20201230_2112.py index c7919bee7..178da8702 100644 --- a/authentik/providers/saml/migrations/0010_auto_20201230_2112.py +++ b/authentik/providers/saml/migrations/0010_auto_20201230_2112.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_providers_saml", "0009_auto_20201112_2016"), ] @@ -16,7 +15,10 @@ class Migration(migrations.Migration): field=models.TextField( blank=True, default="", - help_text="Value of the audience restriction field of the assertion. When left empty, no audience restriction will be added.", + help_text=( + "Value of the audience restriction field of the assertion. When left empty, no" + " audience restriction will be added." + ), ), ), ] diff --git a/authentik/providers/saml/migrations/0011_samlprovider_name_id_mapping.py b/authentik/providers/saml/migrations/0011_samlprovider_name_id_mapping.py index 7425f6ca4..f7cf3b1dd 100644 --- a/authentik/providers/saml/migrations/0011_samlprovider_name_id_mapping.py +++ b/authentik/providers/saml/migrations/0011_samlprovider_name_id_mapping.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_providers_saml", "0010_auto_20201230_2112"), ] @@ -17,7 +16,10 @@ class Migration(migrations.Migration): field=models.ForeignKey( blank=True, default=None, - help_text="Configure how the NameID value will be created. When left empty, the NameIDPolicy of the incoming request will be considered", + help_text=( + "Configure how the NameID value will be created. When left empty, the" + " NameIDPolicy of the incoming request will be considered" + ), null=True, verbose_name="NameID Property Mapping", on_delete=django.db.models.deletion.SET_DEFAULT, diff --git a/authentik/providers/saml/migrations/0012_managed.py b/authentik/providers/saml/migrations/0012_managed.py index ae5754f25..78d540bd2 100644 --- a/authentik/providers/saml/migrations/0012_managed.py +++ b/authentik/providers/saml/migrations/0012_managed.py @@ -3,25 +3,39 @@ from django.db import migrations saml_name_map = { - "http://schemas.xmlsoap.org/claims/CommonName": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name", - "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname": "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname", + "http://schemas.xmlsoap.org/claims/CommonName": ( + "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name" + ), + "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname": ( + "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname" + ), "member-of": "http://schemas.xmlsoap.org/claims/Group", "http://schemas.xmlsoap.org/claims/Group": "http://schemas.xmlsoap.org/claims/Group", "urn:oid:0.9.2342.19200300.100.1.1": "http://schemas.goauthentik.io/2021/02/saml/uid", - "urn:oid:0.9.2342.19200300.100.1.3": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress", + "urn:oid:0.9.2342.19200300.100.1.3": ( + "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" + ), "urn:oid:1.3.6.1.4.1.5923.1.1.1.6": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn", "urn:oid:2.16.840.1.113730.3.1.241": "http://schemas.goauthentik.io/2021/02/saml/username", "urn:oid:2.5.4.3": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name", } saml_name_uid_map = { - "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn": "goauthentik.io/providers/saml/upn", - "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name": "goauthentik.io/providers/saml/name", - "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress": "goauthentik.io/providers/saml/email", + "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn": ( + "goauthentik.io/providers/saml/upn" + ), + "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name": ( + "goauthentik.io/providers/saml/name" + ), + "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress": ( + "goauthentik.io/providers/saml/email" + ), "http://schemas.goauthentik.io/2021/02/saml/username": "goauthentik.io/providers/saml/username", "http://schemas.goauthentik.io/2021/02/saml/uid": "goauthentik.io/providers/saml/uid", "http://schemas.xmlsoap.org/claims/Group": "goauthentik.io/providers/saml/groups", - "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname": "goauthentik.io/providers/saml/ms-windowsaccountname", + "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname": ( + "goauthentik.io/providers/saml/ms-windowsaccountname" + ), } @@ -42,7 +56,6 @@ def add_managed_update(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ ("authentik_core", "0017_managed"), ("authentik_providers_saml", "0011_samlprovider_name_id_mapping"), diff --git a/authentik/providers/saml/models.py b/authentik/providers/saml/models.py index 19c7e4395..e92f62943 100644 --- a/authentik/providers/saml/models.py +++ b/authentik/providers/saml/models.py @@ -40,10 +40,8 @@ class SAMLProvider(Provider): default="", blank=True, help_text=_( - ( - "Value of the audience restriction field of the assertion. When left empty, " - "no audience restriction will be added." - ) + "Value of the audience restriction field of the assertion. When left empty, " + "no audience restriction will be added." ), ) issuer = models.TextField(help_text=_("Also known as EntityID"), default="authentik") @@ -52,7 +50,7 @@ class SAMLProvider(Provider): default=SAMLBindings.REDIRECT, verbose_name=_("Service Provider Binding"), help_text=_( - ("This determines how authentik sends the response back to the Service Provider.") + "This determines how authentik sends the response back to the Service Provider." ), ) @@ -64,10 +62,8 @@ class SAMLProvider(Provider): on_delete=models.SET_DEFAULT, verbose_name=_("NameID Property Mapping"), help_text=_( - ( - "Configure how the NameID value will be created. When left empty, " - "the NameIDPolicy of the incoming request will be considered" - ) + "Configure how the NameID value will be created. When left empty, " + "the NameIDPolicy of the incoming request will be considered" ), ) @@ -75,20 +71,16 @@ class SAMLProvider(Provider): default="minutes=-5", validators=[timedelta_string_validator], help_text=_( - ( - "Assertion valid not before current time + this value " - "(Format: hours=-1;minutes=-2;seconds=-3)." - ) + "Assertion valid not before current time + this value " + "(Format: hours=-1;minutes=-2;seconds=-3)." ), ) assertion_valid_not_on_or_after = models.TextField( default="minutes=5", validators=[timedelta_string_validator], help_text=_( - ( - "Assertion not valid on or after current time + this value " - "(Format: hours=1;minutes=2;seconds=3)." - ) + "Assertion not valid on or after current time + this value " + "(Format: hours=1;minutes=2;seconds=3)." ), ) @@ -96,10 +88,8 @@ class SAMLProvider(Provider): default="minutes=86400", validators=[timedelta_string_validator], help_text=_( - ( - "Session not valid on or after current time + this value " - "(Format: hours=1;minutes=2;seconds=3)." - ) + "Session not valid on or after current time + this value " + "(Format: hours=1;minutes=2;seconds=3)." ), ) @@ -131,10 +121,8 @@ class SAMLProvider(Provider): null=True, blank=True, help_text=_( - ( - "When selected, incoming assertion's Signatures will be validated against this " - "certificate. To allow unsigned Requests, leave on default." - ) + "When selected, incoming assertion's Signatures will be validated against this " + "certificate. To allow unsigned Requests, leave on default." ), on_delete=models.SET_NULL, verbose_name=_("Verification Certificate"), @@ -176,7 +164,6 @@ class SAMLProvider(Provider): return f"SAML Provider {self.name}" class Meta: - verbose_name = _("SAML Provider") verbose_name_plural = _("SAML Providers") @@ -202,6 +189,5 @@ class SAMLPropertyMapping(PropertyMapping): return f"{self.name} ({name})" class Meta: - verbose_name = _("SAML Property Mapping") verbose_name_plural = _("SAML Property Mappings") diff --git a/authentik/providers/saml/views/flows.py b/authentik/providers/saml/views/flows.py index 0ad50001b..479686bd0 100644 --- a/authentik/providers/saml/views/flows.py +++ b/authentik/providers/saml/views/flows.py @@ -82,11 +82,9 @@ class SAMLFlowFinalView(ChallengeStageView): **{ "type": ChallengeTypes.NATIVE.value, "component": "ak-stage-autosubmit", - "title": ( - self.executor.plan.context.get( - PLAN_CONTEXT_TITLE, - _("Redirecting to %(app)s..." % {"app": application.name}), - ) + "title": self.executor.plan.context.get( + PLAN_CONTEXT_TITLE, + _("Redirecting to %(app)s..." % {"app": application.name}), ), "url": provider.acs_url, "attrs": form_attrs, diff --git a/authentik/recovery/management/commands/create_recovery_key.py b/authentik/recovery/management/commands/create_recovery_key.py index cf9eca632..1b768fd73 100644 --- a/authentik/recovery/management/commands/create_recovery_key.py +++ b/authentik/recovery/management/commands/create_recovery_key.py @@ -47,6 +47,6 @@ class Command(BaseCommand): identifier=slugify(f"ak-recovery-{user}-{_now}"), ) self.stdout.write( - (f"Store this link safely, as it will allow" f" anyone to access authentik as {user}.") + f"Store this link safely, as it will allow anyone to access authentik as {user}." ) self.stdout.write(self.get_url(token)) diff --git a/authentik/sources/ldap/migrations/0001_squashed_0012_auto_20210812_1703.py b/authentik/sources/ldap/migrations/0001_squashed_0012_auto_20210812_1703.py index e993f16c4..bb13c6a70 100644 --- a/authentik/sources/ldap/migrations/0001_squashed_0012_auto_20210812_1703.py +++ b/authentik/sources/ldap/migrations/0001_squashed_0012_auto_20210812_1703.py @@ -42,7 +42,6 @@ def set_default_group_mappings(apps: Apps, schema_editor): class Migration(migrations.Migration): - replaces = [ ("authentik_sources_ldap", "0001_initial"), ("authentik_sources_ldap", "0002_ldapsource_sync_users"), @@ -173,7 +172,10 @@ class Migration(migrations.Migration): "sync_users_password", models.BooleanField( default=True, - help_text="When a user changes their password, sync it back to LDAP. This can only be enabled on a single LDAP source.", + help_text=( + "When a user changes their password, sync it back to LDAP. This can" + " only be enabled on a single LDAP source." + ), unique=True, ), ), @@ -242,7 +244,10 @@ class Migration(migrations.Migration): name="sync_users_password", field=models.BooleanField( default=True, - help_text="When a user changes their password, sync it back to LDAP. This can only be enabled on a single LDAP source.", + help_text=( + "When a user changes their password, sync it back to LDAP. This can only be" + " enabled on a single LDAP source." + ), ), ), ] diff --git a/authentik/sources/ldap/migrations/0002_auto_20211203_0900.py b/authentik/sources/ldap/migrations/0002_auto_20211203_0900.py index 2161b7cbf..c48bfae8e 100644 --- a/authentik/sources/ldap/migrations/0002_auto_20211203_0900.py +++ b/authentik/sources/ldap/migrations/0002_auto_20211203_0900.py @@ -7,7 +7,6 @@ import authentik.sources.ldap.models class Migration(migrations.Migration): - dependencies = [ ("authentik_crypto", "0003_certificatekeypair_managed"), ("authentik_sources_ldap", "0001_squashed_0012_auto_20210812_1703"), @@ -19,7 +18,10 @@ class Migration(migrations.Migration): name="peer_certificate", field=models.ForeignKey( default=None, - help_text="Optionally verify the LDAP Server's Certificate against the CA Chain in this keypair.", + help_text=( + "Optionally verify the LDAP Server's Certificate against the CA Chain in this" + " keypair." + ), null=True, on_delete=django.db.models.deletion.SET_DEFAULT, to="authentik_crypto.certificatekeypair", diff --git a/authentik/sources/ldap/models.py b/authentik/sources/ldap/models.py index 880d134d9..759747c89 100644 --- a/authentik/sources/ldap/models.py +++ b/authentik/sources/ldap/models.py @@ -38,8 +38,7 @@ class LDAPSource(Source): default=None, null=True, help_text=_( - "Optionally verify the LDAP Server's Certificate " - "against the CA Chain in this keypair." + "Optionally verify the LDAP Server's Certificate against the CA Chain in this keypair." ), ) @@ -85,10 +84,8 @@ class LDAPSource(Source): sync_users_password = models.BooleanField( default=True, help_text=_( - ( - "When a user changes their password, sync it back to LDAP. " - "This can only be enabled on a single LDAP source." - ) + "When a user changes their password, sync it back to LDAP. " + "This can only be enabled on a single LDAP source." ), ) sync_groups = models.BooleanField(default=True) @@ -145,7 +142,6 @@ class LDAPSource(Source): return connection class Meta: - verbose_name = _("LDAP Source") verbose_name_plural = _("LDAP Sources") @@ -169,6 +165,5 @@ class LDAPPropertyMapping(PropertyMapping): return str(self.name) class Meta: - verbose_name = _("LDAP Property Mapping") verbose_name_plural = _("LDAP Property Mappings") diff --git a/authentik/sources/ldap/tests/mock_ad.py b/authentik/sources/ldap/tests/mock_ad.py index 248a8dd13..7a13e92aa 100644 --- a/authentik/sources/ldap/tests/mock_ad.py +++ b/authentik/sources/ldap/tests/mock_ad.py @@ -56,8 +56,9 @@ def mock_ad_connection(password: str) -> Connection: "objectSid": "user0", "objectClass": "person", "distinguishedName": "cn=user0,ou=users,dc=goauthentik,dc=io", - "userAccountControl": UserAccountControl.ACCOUNTDISABLE - + UserAccountControl.NORMAL_ACCOUNT, + "userAccountControl": ( + UserAccountControl.ACCOUNTDISABLE + UserAccountControl.NORMAL_ACCOUNT + ), }, ) # User without SID diff --git a/authentik/sources/oauth/api/source.py b/authentik/sources/oauth/api/source.py index af84f23fa..6c9399f95 100644 --- a/authentik/sources/oauth/api/source.py +++ b/authentik/sources/oauth/api/source.py @@ -123,7 +123,6 @@ class OAuthSourceFilter(FilterSet): return queryset.exclude(oidc_jwks__iexact="{}") class Meta: - model = OAuthSource fields = [ "name", diff --git a/authentik/sources/oauth/migrations/0001_initial.py b/authentik/sources/oauth/migrations/0001_initial.py index a312f1cec..a77b3bfd2 100644 --- a/authentik/sources/oauth/migrations/0001_initial.py +++ b/authentik/sources/oauth/migrations/0001_initial.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [ diff --git a/authentik/sources/oauth/migrations/0002_auto_20200520_1108.py b/authentik/sources/oauth/migrations/0002_auto_20200520_1108.py index 350321bd4..41c887695 100644 --- a/authentik/sources/oauth/migrations/0002_auto_20200520_1108.py +++ b/authentik/sources/oauth/migrations/0002_auto_20200520_1108.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_sources_oauth", "0001_initial"), ] @@ -24,7 +23,9 @@ class Migration(migrations.Migration): name="request_token_url", field=models.CharField( blank=True, - help_text="URL used to request the initial token. This URL is only required for OAuth 1.", + help_text=( + "URL used to request the initial token. This URL is only required for OAuth 1." + ), max_length=255, verbose_name="Request Token URL", ), diff --git a/authentik/sources/oauth/migrations/0003_auto_20210416_0726.py b/authentik/sources/oauth/migrations/0003_auto_20210416_0726.py index ef43d8085..bdf6429b6 100644 --- a/authentik/sources/oauth/migrations/0003_auto_20210416_0726.py +++ b/authentik/sources/oauth/migrations/0003_auto_20210416_0726.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_sources_oauth", "0002_auto_20200520_1108"), ] diff --git a/authentik/sources/oauth/migrations/0004_auto_20210417_1900.py b/authentik/sources/oauth/migrations/0004_auto_20210417_1900.py index e40ae34fa..ffcf1fa8a 100644 --- a/authentik/sources/oauth/migrations/0004_auto_20210417_1900.py +++ b/authentik/sources/oauth/migrations/0004_auto_20210417_1900.py @@ -29,7 +29,6 @@ def update_empty_urls(apps: Apps, schema_editor: BaseDatabaseSchemaEditor): class Migration(migrations.Migration): - dependencies = [ ("authentik_sources_oauth", "0003_auto_20210416_0726"), ] @@ -69,7 +68,9 @@ class Migration(migrations.Migration): model_name="oauthsource", name="request_token_url", field=models.CharField( - help_text="URL used to request the initial token. This URL is only required for OAuth 1.", + help_text=( + "URL used to request the initial token. This URL is only required for OAuth 1." + ), max_length=255, null=True, verbose_name="Request Token URL", diff --git a/authentik/sources/oauth/migrations/0005_update_provider_type_names.py b/authentik/sources/oauth/migrations/0005_update_provider_type_names.py index a699effa7..eb8baa53a 100644 --- a/authentik/sources/oauth/migrations/0005_update_provider_type_names.py +++ b/authentik/sources/oauth/migrations/0005_update_provider_type_names.py @@ -23,7 +23,6 @@ def update_provider_types(apps: Apps, schema_editor: BaseDatabaseSchemaEditor): class Migration(migrations.Migration): - dependencies = [ ("authentik_sources_oauth", "0004_auto_20210417_1900"), ] diff --git a/authentik/sources/oauth/migrations/0006_oauthsource_additional_scopes.py b/authentik/sources/oauth/migrations/0006_oauthsource_additional_scopes.py index 44da4a5aa..900b594c4 100644 --- a/authentik/sources/oauth/migrations/0006_oauthsource_additional_scopes.py +++ b/authentik/sources/oauth/migrations/0006_oauthsource_additional_scopes.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_sources_oauth", "0005_update_provider_type_names"), ] diff --git a/authentik/sources/oauth/migrations/0007_oauthsource_oidc_jwks_oauthsource_oidc_jwks_url_and_more.py b/authentik/sources/oauth/migrations/0007_oauthsource_oidc_jwks_oauthsource_oidc_jwks_url_and_more.py index 742bcf922..f82c08022 100644 --- a/authentik/sources/oauth/migrations/0007_oauthsource_oidc_jwks_oauthsource_oidc_jwks_url_and_more.py +++ b/authentik/sources/oauth/migrations/0007_oauthsource_oidc_jwks_oauthsource_oidc_jwks_url_and_more.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_sources_oauth", "0006_oauthsource_additional_scopes"), ] diff --git a/authentik/sources/oauth/models.py b/authentik/sources/oauth/models.py index 8e559878e..80d55f147 100644 --- a/authentik/sources/oauth/models.py +++ b/authentik/sources/oauth/models.py @@ -105,7 +105,6 @@ class OAuthSource(Source): return f"OAuth Source {self.name}" class Meta: - verbose_name = _("OAuth Source") verbose_name_plural = _("OAuth Sources") @@ -114,7 +113,6 @@ class GitHubOAuthSource(OAuthSource): """Social Login using GitHub.com or a GitHub-Enterprise Instance.""" class Meta: - abstract = True verbose_name = _("GitHub OAuth Source") verbose_name_plural = _("GitHub OAuth Sources") @@ -124,7 +122,6 @@ class TwitchOAuthSource(OAuthSource): """Social Login using Twitch.""" class Meta: - abstract = True verbose_name = _("Twitch OAuth Source") verbose_name_plural = _("Twitch OAuth Sources") @@ -134,7 +131,6 @@ class MailcowOAuthSource(OAuthSource): """Social Login using Mailcow.""" class Meta: - abstract = True verbose_name = _("Mailcow OAuth Source") verbose_name_plural = _("Mailcow OAuth Sources") @@ -144,7 +140,6 @@ class TwitterOAuthSource(OAuthSource): """Social Login using Twitter.com""" class Meta: - abstract = True verbose_name = _("Twitter OAuth Source") verbose_name_plural = _("Twitter OAuth Sources") @@ -154,7 +149,6 @@ class FacebookOAuthSource(OAuthSource): """Social Login using Facebook.com.""" class Meta: - abstract = True verbose_name = _("Facebook OAuth Source") verbose_name_plural = _("Facebook OAuth Sources") @@ -164,7 +158,6 @@ class DiscordOAuthSource(OAuthSource): """Social Login using Discord.""" class Meta: - abstract = True verbose_name = _("Discord OAuth Source") verbose_name_plural = _("Discord OAuth Sources") @@ -174,7 +167,6 @@ class GoogleOAuthSource(OAuthSource): """Social Login using Google or Google Workspace (GSuite).""" class Meta: - abstract = True verbose_name = _("Google OAuth Source") verbose_name_plural = _("Google OAuth Sources") @@ -184,7 +176,6 @@ class AzureADOAuthSource(OAuthSource): """Social Login using Azure AD.""" class Meta: - abstract = True verbose_name = _("Azure AD OAuth Source") verbose_name_plural = _("Azure AD OAuth Sources") @@ -194,7 +185,6 @@ class OpenIDConnectOAuthSource(OAuthSource): """Login using a Generic OpenID-Connect compliant provider.""" class Meta: - abstract = True verbose_name = _("OpenID OAuth Source") verbose_name_plural = _("OpenID OAuth Sources") @@ -204,7 +194,6 @@ class AppleOAuthSource(OAuthSource): """Social Login using Apple.""" class Meta: - abstract = True verbose_name = _("Apple OAuth Source") verbose_name_plural = _("Apple OAuth Sources") @@ -214,7 +203,6 @@ class OktaOAuthSource(OAuthSource): """Social Login using Okta.""" class Meta: - abstract = True verbose_name = _("Okta OAuth Source") verbose_name_plural = _("Okta OAuth Sources") @@ -239,6 +227,5 @@ class UserOAuthSourceConnection(UserSourceConnection): super().save(*args, **kwargs) class Meta: - verbose_name = _("User OAuth Source Connection") verbose_name_plural = _("User OAuth Source Connections") diff --git a/authentik/sources/oauth/types/apple.py b/authentik/sources/oauth/types/apple.py index d91c48627..eeab7a5ef 100644 --- a/authentik/sources/oauth/types/apple.py +++ b/authentik/sources/oauth/types/apple.py @@ -48,10 +48,8 @@ class AppleOAuthClient(OAuth2Client): parts: list[str] = self.source.consumer_key.split(";") if len(parts) < 3: raise ValueError( - ( - "Apple Source client_id should be formatted like " - "services_id_identifier;apple_team_id;key_id" - ) + "Apple Source client_id should be formatted like " + "services_id_identifier;apple_team_id;key_id" ) LOGGER.debug("got values from client_id", team=parts[1], kid=parts[2]) payload = { diff --git a/authentik/sources/plex/migrations/0001_initial.py b/authentik/sources/plex/migrations/0001_initial.py index 09b37a6d0..fd078276e 100644 --- a/authentik/sources/plex/migrations/0001_initial.py +++ b/authentik/sources/plex/migrations/0001_initial.py @@ -8,7 +8,6 @@ import authentik.lib.generators class Migration(migrations.Migration): - initial = True dependencies = [ @@ -42,7 +41,10 @@ class Migration(migrations.Migration): django.contrib.postgres.fields.ArrayField( base_field=models.TextField(), default=list, - help_text="Which servers a user has to be a member of to be granted access. Empty list allows every server.", + help_text=( + "Which servers a user has to be a member of to be granted access. Empty" + " list allows every server." + ), size=None, ), ), diff --git a/authentik/sources/plex/migrations/0002_auto_20210505_1717.py b/authentik/sources/plex/migrations/0002_auto_20210505_1717.py index 0b2f70a22..6f3292bc6 100644 --- a/authentik/sources/plex/migrations/0002_auto_20210505_1717.py +++ b/authentik/sources/plex/migrations/0002_auto_20210505_1717.py @@ -7,7 +7,6 @@ import authentik.lib.generators class Migration(migrations.Migration): - dependencies = [ ("authentik_sources_plex", "0001_initial"), ] @@ -33,7 +32,10 @@ class Migration(migrations.Migration): base_field=models.TextField(), blank=True, default=list, - help_text="Which servers a user has to be a member of to be granted access. Empty list allows every server.", + help_text=( + "Which servers a user has to be a member of to be granted access. Empty list" + " allows every server." + ), size=None, ), ), diff --git a/authentik/sources/plex/migrations/0003_alter_plexsource_plex_token.py b/authentik/sources/plex/migrations/0003_alter_plexsource_plex_token.py index 92b658a8e..9eee660e7 100644 --- a/authentik/sources/plex/migrations/0003_alter_plexsource_plex_token.py +++ b/authentik/sources/plex/migrations/0003_alter_plexsource_plex_token.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_sources_plex", "0002_auto_20210505_1717"), ] diff --git a/authentik/sources/plex/models.py b/authentik/sources/plex/models.py index 01b3bdfe8..06d46dc67 100644 --- a/authentik/sources/plex/models.py +++ b/authentik/sources/plex/models.py @@ -41,10 +41,8 @@ class PlexSource(Source): default=list, blank=True, help_text=_( - ( - "Which servers a user has to be a member of to be granted access. " - "Empty list allows every server." - ) + "Which servers a user has to be a member of to be granted access. " + "Empty list allows every server." ), ) allow_friends = models.BooleanField( @@ -94,7 +92,6 @@ class PlexSource(Source): ) class Meta: - verbose_name = _("Plex Source") verbose_name_plural = _("Plex Sources") @@ -112,6 +109,5 @@ class PlexSourceConnection(UserSourceConnection): return PlexSourceConnectionSerializer class Meta: - verbose_name = _("User Plex Source Connection") verbose_name_plural = _("User Plex Source Connections") diff --git a/authentik/sources/saml/api/source.py b/authentik/sources/saml/api/source.py index 07fa55ba2..6ef930119 100644 --- a/authentik/sources/saml/api/source.py +++ b/authentik/sources/saml/api/source.py @@ -17,7 +17,6 @@ class SAMLSourceSerializer(SourceSerializer): """SAMLSource Serializer""" class Meta: - model = SAMLSource fields = SourceSerializer.Meta.fields + [ "pre_authentication_flow", diff --git a/authentik/sources/saml/migrations/0001_squashed_0009_auto_20210301_0949.py b/authentik/sources/saml/migrations/0001_squashed_0009_auto_20210301_0949.py index bf081e03f..52335ab82 100644 --- a/authentik/sources/saml/migrations/0001_squashed_0009_auto_20210301_0949.py +++ b/authentik/sources/saml/migrations/0001_squashed_0009_auto_20210301_0949.py @@ -33,7 +33,6 @@ def update_algorithms(apps: Apps, schema_editor: BaseDatabaseSchemaEditor): class Migration(migrations.Migration): - replaces = [ ("authentik_sources_saml", "0001_initial"), ("authentik_sources_saml", "0002_auto_20200523_2329"), @@ -100,7 +99,10 @@ class Migration(migrations.Migration): models.ForeignKey( blank=True, default=None, - help_text="Keypair which is used to sign outgoing requests. Leave empty to disable signing.", + help_text=( + "Keypair which is used to sign outgoing requests. Leave empty to" + " disable signing." + ), null=True, on_delete=django.db.models.deletion.SET_DEFAULT, to="authentik_crypto.certificatekeypair", @@ -123,7 +125,11 @@ class Migration(migrations.Migration): "temporary_user_delete_after", models.TextField( default="days=1", - help_text="Time offset when temporary users should be deleted. This only applies if your IDP uses the NameID Format 'transient', and the user doesn't log out manually. (Format: hours=1;minutes=2;seconds=3).", + help_text=( + "Time offset when temporary users should be deleted. This only applies" + " if your IDP uses the NameID Format 'transient', and the user doesn't" + " log out manually. (Format: hours=1;minutes=2;seconds=3)." + ), validators=[authentik.lib.utils.time.timedelta_string_validator], verbose_name="Delete temporary users after", ), @@ -142,14 +148,20 @@ class Migration(migrations.Migration): ("urn:oasis:names:tc:SAML:2.0:nameid-format:transient", "Transient"), ], default="urn:oasis:names:tc:SAML:2.0:nameid-format:transient", - help_text="NameID Policy sent to the IdP. Can be unset, in which case no Policy is sent.", + help_text=( + "NameID Policy sent to the IdP. Can be unset, in which case no Policy" + " is sent." + ), ), ), ( "allow_idp_initiated", models.BooleanField( default=False, - help_text="Allows authentication flows initiated by the IdP. This can be a security risk, as no validation of the request ID is done.", + help_text=( + "Allows authentication flows initiated by the IdP. This can be a" + " security risk, as no validation of the request ID is done." + ), ), ), ( @@ -204,7 +216,9 @@ class Migration(migrations.Migration): ("urn:oasis:names:tc:SAML:2.0:nameid-format:transient", "Transient"), ], default="urn:oasis:names:tc:SAML:2.0:nameid-format:persistent", - help_text="NameID Policy sent to the IdP. Can be unset, in which case no Policy is sent.", + help_text=( + "NameID Policy sent to the IdP. Can be unset, in which case no Policy is sent." + ), ), ), ] diff --git a/authentik/sources/saml/migrations/0010_samlsource_pre_authentication_flow.py b/authentik/sources/saml/migrations/0010_samlsource_pre_authentication_flow.py index 266ce490c..88c631ce9 100644 --- a/authentik/sources/saml/migrations/0010_samlsource_pre_authentication_flow.py +++ b/authentik/sources/saml/migrations/0010_samlsource_pre_authentication_flow.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_flows", "0016_auto_20201202_1307"), ("authentik_sources_saml", "0009_auto_20210301_0949"), diff --git a/authentik/sources/saml/migrations/0011_auto_20210324_0736.py b/authentik/sources/saml/migrations/0011_auto_20210324_0736.py index f2470b57f..48199aa7f 100644 --- a/authentik/sources/saml/migrations/0011_auto_20210324_0736.py +++ b/authentik/sources/saml/migrations/0011_auto_20210324_0736.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_flows", "0016_auto_20201202_1307"), ("authentik_sources_saml", "0010_samlsource_pre_authentication_flow"), diff --git a/authentik/sources/saml/migrations/0012_usersamlsourceconnection.py b/authentik/sources/saml/migrations/0012_usersamlsourceconnection.py index f2b55050c..0891d32f7 100644 --- a/authentik/sources/saml/migrations/0012_usersamlsourceconnection.py +++ b/authentik/sources/saml/migrations/0012_usersamlsourceconnection.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_core", "0022_alter_group_parent"), ("authentik_sources_saml", "0011_auto_20210324_0736"), diff --git a/authentik/sources/saml/models.py b/authentik/sources/saml/models.py index c1a3e028e..a3f065eac 100644 --- a/authentik/sources/saml/models.py +++ b/authentik/sources/saml/models.py @@ -115,11 +115,9 @@ class SAMLSource(Source): verbose_name=_("Delete temporary users after"), validators=[timedelta_string_validator], help_text=_( - ( - "Time offset when temporary users should be deleted. This only applies if your IDP " - "uses the NameID Format 'transient', and the user doesn't log out manually. " - "(Format: hours=1;minutes=2;seconds=3)." - ) + "Time offset when temporary users should be deleted. This only applies if your IDP " + "uses the NameID Format 'transient', and the user doesn't log out manually. " + "(Format: hours=1;minutes=2;seconds=3)." ), ) @@ -214,7 +212,6 @@ class SAMLSource(Source): return f"SAML Source {self.name}" class Meta: - verbose_name = _("SAML Source") verbose_name_plural = _("SAML Sources") @@ -231,6 +228,5 @@ class UserSAMLSourceConnection(UserSourceConnection): return UserSAMLSourceConnectionSerializer class Meta: - verbose_name = _("User SAML Source Connection") verbose_name_plural = _("User SAML Source Connections") diff --git a/authentik/stages/authenticator_duo/api.py b/authentik/stages/authenticator_duo/api.py index 55416001f..abebf26fa 100644 --- a/authentik/stages/authenticator_duo/api.py +++ b/authentik/stages/authenticator_duo/api.py @@ -30,7 +30,6 @@ class AuthenticatorDuoStageSerializer(StageSerializer): """AuthenticatorDuoStage Serializer""" class Meta: - model = AuthenticatorDuoStage fields = StageSerializer.Meta.fields + [ "configure_flow", @@ -155,10 +154,8 @@ class AuthenticatorDuoStageViewSet(UsedByMixin, ModelViewSet): return Response( data={ "non_field_errors": [ - ( - "Stage does not have Admin API configured, " - "which is required for automatic imports." - ) + "Stage does not have Admin API configured, " + "which is required for automatic imports." ] }, status=400, @@ -171,7 +168,6 @@ class DuoDeviceSerializer(ModelSerializer): """Serializer for Duo authenticator devices""" class Meta: - model = DuoDevice fields = ["pk", "name"] depth = 2 diff --git a/authentik/stages/authenticator_duo/migrations/0001_initial.py b/authentik/stages/authenticator_duo/migrations/0001_initial.py index 4585fe39e..bded76c0e 100644 --- a/authentik/stages/authenticator_duo/migrations/0001_initial.py +++ b/authentik/stages/authenticator_duo/migrations/0001_initial.py @@ -6,7 +6,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [ @@ -36,7 +35,10 @@ class Migration(migrations.Migration): "configure_flow", models.ForeignKey( blank=True, - help_text="Flow used by an authenticated user to configure this Stage. If empty, user will not be able to configure this stage.", + help_text=( + "Flow used by an authenticated user to configure this Stage. If empty," + " user will not be able to configure this stage." + ), null=True, on_delete=django.db.models.deletion.SET_NULL, to="authentik_flows.flow", diff --git a/authentik/stages/authenticator_duo/migrations/0002_default_setup_flow.py b/authentik/stages/authenticator_duo/migrations/0002_default_setup_flow.py index a1b58ff66..b0e2a4f21 100644 --- a/authentik/stages/authenticator_duo/migrations/0002_default_setup_flow.py +++ b/authentik/stages/authenticator_duo/migrations/0002_default_setup_flow.py @@ -4,7 +4,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ( "authentik_stages_authenticator_duo", diff --git a/authentik/stages/authenticator_duo/migrations/0003_duodevice_last_t.py b/authentik/stages/authenticator_duo/migrations/0003_duodevice_last_t.py index c00727629..3b6a62a38 100644 --- a/authentik/stages/authenticator_duo/migrations/0003_duodevice_last_t.py +++ b/authentik/stages/authenticator_duo/migrations/0003_duodevice_last_t.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_stages_authenticator_duo", "0002_default_setup_flow"), ] diff --git a/authentik/stages/authenticator_duo/migrations/0004_authenticatorduostage_admin_integration_key_and_more.py b/authentik/stages/authenticator_duo/migrations/0004_authenticatorduostage_admin_integration_key_and_more.py index 9934ed96c..b345145a1 100644 --- a/authentik/stages/authenticator_duo/migrations/0004_authenticatorduostage_admin_integration_key_and_more.py +++ b/authentik/stages/authenticator_duo/migrations/0004_authenticatorduostage_admin_integration_key_and_more.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_stages_authenticator_duo", "0003_duodevice_last_t"), ] diff --git a/authentik/stages/authenticator_duo/models.py b/authentik/stages/authenticator_duo/models.py index c3e875de9..1cb76970e 100644 --- a/authentik/stages/authenticator_duo/models.py +++ b/authentik/stages/authenticator_duo/models.py @@ -77,7 +77,6 @@ class AuthenticatorDuoStage(ConfigurableStage, Stage): return f"Duo Authenticator Setup Stage {self.name}" class Meta: - verbose_name = _("Duo Authenticator Setup Stage") verbose_name_plural = _("Duo Authenticator Setup Stages") @@ -102,6 +101,5 @@ class DuoDevice(SerializerModel, Device): return str(self.name) or str(self.user) class Meta: - verbose_name = _("Duo Device") verbose_name_plural = _("Duo Devices") diff --git a/authentik/stages/authenticator_sms/api.py b/authentik/stages/authenticator_sms/api.py index cf5d39c89..59f602cad 100644 --- a/authentik/stages/authenticator_sms/api.py +++ b/authentik/stages/authenticator_sms/api.py @@ -16,7 +16,6 @@ class AuthenticatorSMSStageSerializer(StageSerializer): """AuthenticatorSMSStage Serializer""" class Meta: - model = AuthenticatorSMSStage fields = StageSerializer.Meta.fields + [ "configure_flow", @@ -45,7 +44,6 @@ class SMSDeviceSerializer(ModelSerializer): """Serializer for sms authenticator devices""" class Meta: - model = SMSDevice fields = ["name", "pk", "phone_number"] depth = 2 diff --git a/authentik/stages/authenticator_sms/migrations/0001_squashed_0004_auto_20211014_0936.py b/authentik/stages/authenticator_sms/migrations/0001_squashed_0004_auto_20211014_0936.py index fcedae8a8..aab05671b 100644 --- a/authentik/stages/authenticator_sms/migrations/0001_squashed_0004_auto_20211014_0936.py +++ b/authentik/stages/authenticator_sms/migrations/0001_squashed_0004_auto_20211014_0936.py @@ -7,7 +7,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - replaces = [ ("authentik_stages_authenticator_sms", "0001_initial"), ("authentik_stages_authenticator_sms", "0002_authenticatorsmsstage_from_number"), @@ -47,7 +46,10 @@ class Migration(migrations.Migration): "configure_flow", models.ForeignKey( blank=True, - help_text="Flow used by an authenticated user to configure this Stage. If empty, user will not be able to configure this stage.", + help_text=( + "Flow used by an authenticated user to configure this Stage. If empty," + " user will not be able to configure this stage." + ), null=True, on_delete=django.db.models.deletion.SET_NULL, to="authentik_flows.flow", diff --git a/authentik/stages/authenticator_sms/migrations/0002_alter_authenticatorsmsstage_from_number.py b/authentik/stages/authenticator_sms/migrations/0002_alter_authenticatorsmsstage_from_number.py index 2dcc826d7..f704d3e96 100644 --- a/authentik/stages/authenticator_sms/migrations/0002_alter_authenticatorsmsstage_from_number.py +++ b/authentik/stages/authenticator_sms/migrations/0002_alter_authenticatorsmsstage_from_number.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_stages_authenticator_sms", "0001_squashed_0004_auto_20211014_0936"), ] diff --git a/authentik/stages/authenticator_sms/migrations/0003_smsdevice_last_used_on.py b/authentik/stages/authenticator_sms/migrations/0003_smsdevice_last_used_on.py index 6f94823af..662312497 100644 --- a/authentik/stages/authenticator_sms/migrations/0003_smsdevice_last_used_on.py +++ b/authentik/stages/authenticator_sms/migrations/0003_smsdevice_last_used_on.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_stages_authenticator_sms", "0002_alter_authenticatorsmsstage_from_number"), ] diff --git a/authentik/stages/authenticator_sms/migrations/0004_authenticatorsmsstage_verify_only_and_more.py b/authentik/stages/authenticator_sms/migrations/0004_authenticatorsmsstage_verify_only_and_more.py index 61ee52dbd..fd4af87cd 100644 --- a/authentik/stages/authenticator_sms/migrations/0004_authenticatorsmsstage_verify_only_and_more.py +++ b/authentik/stages/authenticator_sms/migrations/0004_authenticatorsmsstage_verify_only_and_more.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_stages_authenticator_sms", "0003_smsdevice_last_used_on"), ] @@ -15,7 +14,11 @@ class Migration(migrations.Migration): name="verify_only", field=models.BooleanField( default=False, - help_text="When enabled, the Phone number is only used during enrollment to verify the users authenticity. Only a hash of the phone number is saved to ensure it is not re-used in the future.", + help_text=( + "When enabled, the Phone number is only used during enrollment to verify the" + " users authenticity. Only a hash of the phone number is saved to ensure it is" + " not re-used in the future." + ), ), ), migrations.AlterUniqueTogether( diff --git a/authentik/stages/authenticator_sms/migrations/0005_authenticatorsmsstage_mapping.py b/authentik/stages/authenticator_sms/migrations/0005_authenticatorsmsstage_mapping.py index bf9f8d822..8cb9d53ff 100644 --- a/authentik/stages/authenticator_sms/migrations/0005_authenticatorsmsstage_mapping.py +++ b/authentik/stages/authenticator_sms/migrations/0005_authenticatorsmsstage_mapping.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_events", "0002_alter_notificationtransport_mode"), ("authentik_stages_authenticator_sms", "0004_authenticatorsmsstage_verify_only_and_more"), diff --git a/authentik/stages/authenticator_sms/models.py b/authentik/stages/authenticator_sms/models.py index 222aecb90..bec675222 100644 --- a/authentik/stages/authenticator_sms/models.py +++ b/authentik/stages/authenticator_sms/models.py @@ -177,7 +177,6 @@ class AuthenticatorSMSStage(ConfigurableStage, Stage): return f"SMS Authenticator Setup Stage {self.name}" class Meta: - verbose_name = _("SMS Authenticator Setup Stage") verbose_name_plural = _("SMS Authenticator Setup Stages") diff --git a/authentik/stages/authenticator_static/api.py b/authentik/stages/authenticator_static/api.py index 6af0e7e0d..32fd18051 100644 --- a/authentik/stages/authenticator_static/api.py +++ b/authentik/stages/authenticator_static/api.py @@ -17,7 +17,6 @@ class AuthenticatorStaticStageSerializer(StageSerializer): """AuthenticatorStaticStage Serializer""" class Meta: - model = AuthenticatorStaticStage fields = StageSerializer.Meta.fields + ["configure_flow", "token_count"] @@ -36,7 +35,6 @@ class StaticDeviceTokenSerializer(ModelSerializer): """Serializer for static device's tokens""" class Meta: - model = StaticToken fields = ["token"] @@ -47,7 +45,6 @@ class StaticDeviceSerializer(ModelSerializer): token_set = StaticDeviceTokenSerializer(many=True, read_only=True) class Meta: - model = StaticDevice fields = ["name", "token_set", "pk"] diff --git a/authentik/stages/authenticator_static/migrations/0001_initial.py b/authentik/stages/authenticator_static/migrations/0001_initial.py index 21f2bd60f..feb597988 100644 --- a/authentik/stages/authenticator_static/migrations/0001_initial.py +++ b/authentik/stages/authenticator_static/migrations/0001_initial.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [ diff --git a/authentik/stages/authenticator_static/migrations/0002_otpstaticstage_configure_flow.py b/authentik/stages/authenticator_static/migrations/0002_otpstaticstage_configure_flow.py index 73110bc72..3f7a4df99 100644 --- a/authentik/stages/authenticator_static/migrations/0002_otpstaticstage_configure_flow.py +++ b/authentik/stages/authenticator_static/migrations/0002_otpstaticstage_configure_flow.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_flows", "0013_auto_20200924_1605"), ("authentik_stages_authenticator_static", "0001_initial"), @@ -17,7 +16,10 @@ class Migration(migrations.Migration): name="configure_flow", field=models.ForeignKey( blank=True, - help_text="Flow used by an authenticated user to configure this Stage. If empty, user will not be able to configure this stage.", + help_text=( + "Flow used by an authenticated user to configure this Stage. If empty, user" + " will not be able to configure this stage." + ), null=True, on_delete=django.db.models.deletion.SET_NULL, to="authentik_flows.flow", diff --git a/authentik/stages/authenticator_static/migrations/0003_default_setup_flow.py b/authentik/stages/authenticator_static/migrations/0003_default_setup_flow.py index f4d223d57..a8c57511d 100644 --- a/authentik/stages/authenticator_static/migrations/0003_default_setup_flow.py +++ b/authentik/stages/authenticator_static/migrations/0003_default_setup_flow.py @@ -4,7 +4,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ( "authentik_stages_authenticator_static", diff --git a/authentik/stages/authenticator_static/migrations/0004_auto_20210216_0838.py b/authentik/stages/authenticator_static/migrations/0004_auto_20210216_0838.py index 92eada0ce..5c5f6e5d0 100644 --- a/authentik/stages/authenticator_static/migrations/0004_auto_20210216_0838.py +++ b/authentik/stages/authenticator_static/migrations/0004_auto_20210216_0838.py @@ -4,7 +4,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ("authentik_flows", "0016_auto_20201202_1307"), ("authentik_stages_authenticator_static", "0003_default_setup_flow"), diff --git a/authentik/stages/authenticator_static/migrations/0005_default_setup_flow.py b/authentik/stages/authenticator_static/migrations/0005_default_setup_flow.py index 49289b12e..2a778b16d 100644 --- a/authentik/stages/authenticator_static/migrations/0005_default_setup_flow.py +++ b/authentik/stages/authenticator_static/migrations/0005_default_setup_flow.py @@ -3,7 +3,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ( "authentik_stages_authenticator_static", diff --git a/authentik/stages/authenticator_static/models.py b/authentik/stages/authenticator_static/models.py index a34993b21..a4edaf167 100644 --- a/authentik/stages/authenticator_static/models.py +++ b/authentik/stages/authenticator_static/models.py @@ -43,6 +43,5 @@ class AuthenticatorStaticStage(ConfigurableStage, Stage): return f"Static Authenticator Stage {self.name}" class Meta: - verbose_name = _("Static Authenticator Stage") verbose_name_plural = _("Static Authenticator Stages") diff --git a/authentik/stages/authenticator_totp/api.py b/authentik/stages/authenticator_totp/api.py index d7669ea96..12b800f01 100644 --- a/authentik/stages/authenticator_totp/api.py +++ b/authentik/stages/authenticator_totp/api.py @@ -17,7 +17,6 @@ class AuthenticatorTOTPStageSerializer(StageSerializer): """AuthenticatorTOTPStage Serializer""" class Meta: - model = AuthenticatorTOTPStage fields = StageSerializer.Meta.fields + ["configure_flow", "digits"] @@ -36,7 +35,6 @@ class TOTPDeviceSerializer(ModelSerializer): """Serializer for totp authenticator devices""" class Meta: - model = TOTPDevice fields = [ "name", diff --git a/authentik/stages/authenticator_totp/migrations/0001_initial.py b/authentik/stages/authenticator_totp/migrations/0001_initial.py index d6a3aa739..afcb19e5c 100644 --- a/authentik/stages/authenticator_totp/migrations/0001_initial.py +++ b/authentik/stages/authenticator_totp/migrations/0001_initial.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [ diff --git a/authentik/stages/authenticator_totp/migrations/0002_auto_20200701_1900.py b/authentik/stages/authenticator_totp/migrations/0002_auto_20200701_1900.py index edcd23104..1fd67bafa 100644 --- a/authentik/stages/authenticator_totp/migrations/0002_auto_20200701_1900.py +++ b/authentik/stages/authenticator_totp/migrations/0002_auto_20200701_1900.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_stages_authenticator_totp", "0001_initial"), ] diff --git a/authentik/stages/authenticator_totp/migrations/0003_otptimestage_configure_flow.py b/authentik/stages/authenticator_totp/migrations/0003_otptimestage_configure_flow.py index a692ec9ca..29150f4b2 100644 --- a/authentik/stages/authenticator_totp/migrations/0003_otptimestage_configure_flow.py +++ b/authentik/stages/authenticator_totp/migrations/0003_otptimestage_configure_flow.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_flows", "0013_auto_20200924_1605"), ("authentik_stages_authenticator_totp", "0002_auto_20200701_1900"), @@ -17,7 +16,10 @@ class Migration(migrations.Migration): name="configure_flow", field=models.ForeignKey( blank=True, - help_text="Flow used by an authenticated user to configure this Stage. If empty, user will not be able to configure this stage.", + help_text=( + "Flow used by an authenticated user to configure this Stage. If empty, user" + " will not be able to configure this stage." + ), null=True, on_delete=django.db.models.deletion.SET_NULL, to="authentik_flows.flow", diff --git a/authentik/stages/authenticator_totp/migrations/0004_default_setup_flow.py b/authentik/stages/authenticator_totp/migrations/0004_default_setup_flow.py index 0bc3c705c..60dbb858f 100644 --- a/authentik/stages/authenticator_totp/migrations/0004_default_setup_flow.py +++ b/authentik/stages/authenticator_totp/migrations/0004_default_setup_flow.py @@ -4,7 +4,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ( "authentik_stages_authenticator_totp", diff --git a/authentik/stages/authenticator_totp/migrations/0005_auto_20210216_0838.py b/authentik/stages/authenticator_totp/migrations/0005_auto_20210216_0838.py index 3ba742263..df9fd4cc1 100644 --- a/authentik/stages/authenticator_totp/migrations/0005_auto_20210216_0838.py +++ b/authentik/stages/authenticator_totp/migrations/0005_auto_20210216_0838.py @@ -4,7 +4,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ("authentik_flows", "0016_auto_20201202_1307"), ("authentik_stages_authenticator_totp", "0004_default_setup_flow"), diff --git a/authentik/stages/authenticator_totp/migrations/0006_default_setup_flow.py b/authentik/stages/authenticator_totp/migrations/0006_default_setup_flow.py index 4a5251c85..d0b80e823 100644 --- a/authentik/stages/authenticator_totp/migrations/0006_default_setup_flow.py +++ b/authentik/stages/authenticator_totp/migrations/0006_default_setup_flow.py @@ -3,7 +3,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ( "authentik_stages_authenticator_totp", diff --git a/authentik/stages/authenticator_totp/models.py b/authentik/stages/authenticator_totp/models.py index 1494159f0..26e274557 100644 --- a/authentik/stages/authenticator_totp/models.py +++ b/authentik/stages/authenticator_totp/models.py @@ -50,6 +50,5 @@ class AuthenticatorTOTPStage(ConfigurableStage, Stage): return f"TOTP Authenticator Setup Stage {self.name}" class Meta: - verbose_name = _("TOTP Authenticator Setup Stage") verbose_name_plural = _("TOTP Authenticator Setup Stages") diff --git a/authentik/stages/authenticator_validate/api.py b/authentik/stages/authenticator_validate/api.py index 9d48b6aff..f4ea36fc1 100644 --- a/authentik/stages/authenticator_validate/api.py +++ b/authentik/stages/authenticator_validate/api.py @@ -17,15 +17,12 @@ class AuthenticatorValidateStageSerializer(StageSerializer): if value == NotConfiguredAction.CONFIGURE: if not configuration_stages or len(configuration_stages) < 1: raise ValidationError( - ( - 'When "Not configured action" is set to "Configure", ' - "you must set a configuration stage." - ) + 'When "Not configured action" is set to "Configure", ' + "you must set a configuration stage." ) return value class Meta: - model = AuthenticatorValidateStage fields = StageSerializer.Meta.fields + [ "not_configured_action", diff --git a/authentik/stages/authenticator_validate/migrations/0001_initial.py b/authentik/stages/authenticator_validate/migrations/0001_initial.py index 140b208cd..6f24cba42 100644 --- a/authentik/stages/authenticator_validate/migrations/0001_initial.py +++ b/authentik/stages/authenticator_validate/migrations/0001_initial.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [ diff --git a/authentik/stages/authenticator_validate/migrations/0002_auto_20210216_0838.py b/authentik/stages/authenticator_validate/migrations/0002_auto_20210216_0838.py index c6a53fb25..343ddcdb3 100644 --- a/authentik/stages/authenticator_validate/migrations/0002_auto_20210216_0838.py +++ b/authentik/stages/authenticator_validate/migrations/0002_auto_20210216_0838.py @@ -4,7 +4,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ("authentik_flows", "0016_auto_20201202_1307"), ("authentik_stages_authenticator_validate", "0001_initial"), diff --git a/authentik/stages/authenticator_validate/migrations/0003_authenticatorvalidatestage_device_classes.py b/authentik/stages/authenticator_validate/migrations/0003_authenticatorvalidatestage_device_classes.py index 8b865bbff..87d9beb3e 100644 --- a/authentik/stages/authenticator_validate/migrations/0003_authenticatorvalidatestage_device_classes.py +++ b/authentik/stages/authenticator_validate/migrations/0003_authenticatorvalidatestage_device_classes.py @@ -7,7 +7,6 @@ import authentik.stages.authenticator_validate.models class Migration(migrations.Migration): - dependencies = [ ("authentik_stages_authenticator_validate", "0002_auto_20210216_0838"), ] diff --git a/authentik/stages/authenticator_validate/migrations/0004_auto_20210301_0949.py b/authentik/stages/authenticator_validate/migrations/0004_auto_20210301_0949.py index 8d30e44ed..01927a19f 100644 --- a/authentik/stages/authenticator_validate/migrations/0004_auto_20210301_0949.py +++ b/authentik/stages/authenticator_validate/migrations/0004_auto_20210301_0949.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ( "authentik_stages_authenticator_validate", diff --git a/authentik/stages/authenticator_validate/migrations/0005_authenticatorvalidatestage_configuration_stage.py b/authentik/stages/authenticator_validate/migrations/0005_authenticatorvalidatestage_configuration_stage.py index e9a8ab6b3..aa8a40ae9 100644 --- a/authentik/stages/authenticator_validate/migrations/0005_authenticatorvalidatestage_configuration_stage.py +++ b/authentik/stages/authenticator_validate/migrations/0005_authenticatorvalidatestage_configuration_stage.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_flows", "0016_auto_20201202_1307"), ("authentik_stages_authenticator_validate", "0004_auto_20210301_0949"), @@ -18,7 +17,11 @@ class Migration(migrations.Migration): field=models.ForeignKey( blank=True, default=None, - help_text="Stage used to configure Authenticator when user doesn't have any compatible devices. After this configuration Stage passes, the user is not prompted again.", + help_text=( + "Stage used to configure Authenticator when user doesn't have any compatible" + " devices. After this configuration Stage passes, the user is not prompted" + " again." + ), null=True, on_delete=django.db.models.deletion.SET_DEFAULT, related_name="+", diff --git a/authentik/stages/authenticator_validate/migrations/0006_auto_20210301_1757.py b/authentik/stages/authenticator_validate/migrations/0006_auto_20210301_1757.py index 146e960d6..ba79b4cf2 100644 --- a/authentik/stages/authenticator_validate/migrations/0006_auto_20210301_1757.py +++ b/authentik/stages/authenticator_validate/migrations/0006_auto_20210301_1757.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ( "authentik_stages_authenticator_validate", diff --git a/authentik/stages/authenticator_validate/migrations/0007_auto_20210403_0927.py b/authentik/stages/authenticator_validate/migrations/0007_auto_20210403_0927.py index bebb772ae..00189edc7 100644 --- a/authentik/stages/authenticator_validate/migrations/0007_auto_20210403_0927.py +++ b/authentik/stages/authenticator_validate/migrations/0007_auto_20210403_0927.py @@ -7,7 +7,6 @@ import authentik.stages.authenticator_validate.models class Migration(migrations.Migration): - dependencies = [ ("authentik_stages_authenticator_validate", "0006_auto_20210301_1757"), ] diff --git a/authentik/stages/authenticator_validate/migrations/0008_alter_authenticatorvalidatestage_device_classes.py b/authentik/stages/authenticator_validate/migrations/0008_alter_authenticatorvalidatestage_device_classes.py index b74b4b33d..c9bf0cc60 100644 --- a/authentik/stages/authenticator_validate/migrations/0008_alter_authenticatorvalidatestage_device_classes.py +++ b/authentik/stages/authenticator_validate/migrations/0008_alter_authenticatorvalidatestage_device_classes.py @@ -7,7 +7,6 @@ import authentik.stages.authenticator_validate.models class Migration(migrations.Migration): - dependencies = [ ("authentik_stages_authenticator_validate", "0007_auto_20210403_0927"), ] diff --git a/authentik/stages/authenticator_validate/migrations/0009_default_stage.py b/authentik/stages/authenticator_validate/migrations/0009_default_stage.py index e963ea896..50adb8641 100644 --- a/authentik/stages/authenticator_validate/migrations/0009_default_stage.py +++ b/authentik/stages/authenticator_validate/migrations/0009_default_stage.py @@ -4,7 +4,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ( "authentik_stages_authenticator_validate", diff --git a/authentik/stages/authenticator_validate/migrations/0010_remove_authenticatorvalidatestage_configuration_stage_and_more.py b/authentik/stages/authenticator_validate/migrations/0010_remove_authenticatorvalidatestage_configuration_stage_and_more.py index be6377e6a..735a7d70e 100644 --- a/authentik/stages/authenticator_validate/migrations/0010_remove_authenticatorvalidatestage_configuration_stage_and_more.py +++ b/authentik/stages/authenticator_validate/migrations/0010_remove_authenticatorvalidatestage_configuration_stage_and_more.py @@ -18,7 +18,6 @@ def migrate_configuration_stage(apps: Apps, schema_editor: BaseDatabaseSchemaEdi class Migration(migrations.Migration): - dependencies = [ ("authentik_flows", "0021_auto_20211227_2103"), ("authentik_stages_authenticator_validate", "0009_default_stage"), @@ -31,7 +30,11 @@ class Migration(migrations.Migration): field=models.ManyToManyField( blank=True, default=None, - help_text="Stages used to configure Authenticator when user doesn't have any compatible devices. After this configuration Stage passes, the user is not prompted again.", + help_text=( + "Stages used to configure Authenticator when user doesn't have any compatible" + " devices. After this configuration Stage passes, the user is not prompted" + " again." + ), related_name="+", to="authentik_flows.Stage", ), diff --git a/authentik/stages/authenticator_validate/migrations/0011_authenticatorvalidatestage_last_auth_threshold.py b/authentik/stages/authenticator_validate/migrations/0011_authenticatorvalidatestage_last_auth_threshold.py index 4e10ea534..7061d854a 100644 --- a/authentik/stages/authenticator_validate/migrations/0011_authenticatorvalidatestage_last_auth_threshold.py +++ b/authentik/stages/authenticator_validate/migrations/0011_authenticatorvalidatestage_last_auth_threshold.py @@ -6,7 +6,6 @@ import authentik.lib.utils.time class Migration(migrations.Migration): - dependencies = [ ( "authentik_stages_authenticator_validate", @@ -20,7 +19,10 @@ class Migration(migrations.Migration): name="last_auth_threshold", field=models.TextField( default="seconds=0", - help_text="If any of the user's device has been used within this threshold, this stage will be skipped", + help_text=( + "If any of the user's device has been used within this threshold, this stage" + " will be skipped" + ), validators=[authentik.lib.utils.time.timedelta_string_validator], ), ), diff --git a/authentik/stages/authenticator_validate/migrations/0012_authenticatorvalidatestage_webauthn_user_verification.py b/authentik/stages/authenticator_validate/migrations/0012_authenticatorvalidatestage_webauthn_user_verification.py index d40dfe8be..81d07d47d 100644 --- a/authentik/stages/authenticator_validate/migrations/0012_authenticatorvalidatestage_webauthn_user_verification.py +++ b/authentik/stages/authenticator_validate/migrations/0012_authenticatorvalidatestage_webauthn_user_verification.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ( "authentik_stages_authenticator_validate", diff --git a/authentik/stages/authenticator_validate/models.py b/authentik/stages/authenticator_validate/models.py index f4203980e..45bf071b5 100644 --- a/authentik/stages/authenticator_validate/models.py +++ b/authentik/stages/authenticator_validate/models.py @@ -46,10 +46,8 @@ class AuthenticatorValidateStage(Stage): default=None, related_name="+", help_text=_( - ( - "Stages used to configure Authenticator when user doesn't have any compatible " - "devices. After this configuration Stage passes, the user is not prompted again." - ) + "Stages used to configure Authenticator when user doesn't have any compatible " + "devices. After this configuration Stage passes, the user is not prompted again." ), ) @@ -63,10 +61,8 @@ class AuthenticatorValidateStage(Stage): default="seconds=0", validators=[timedelta_string_validator], help_text=_( - ( - "If any of the user's device has been used within this threshold, this " - "stage will be skipped" - ) + "If any of the user's device has been used within this threshold, this " + "stage will be skipped" ), ) @@ -93,6 +89,5 @@ class AuthenticatorValidateStage(Stage): return "ak-stage-authenticator-validate-form" class Meta: - verbose_name = _("Authenticator Validation Stage") verbose_name_plural = _("Authenticator Validation Stages") diff --git a/authentik/stages/authenticator_validate/tests/test_webauthn.py b/authentik/stages/authenticator_validate/tests/test_webauthn.py index f22e92541..b4d383762 100644 --- a/authentik/stages/authenticator_validate/tests/test_webauthn.py +++ b/authentik/stages/authenticator_validate/tests/test_webauthn.py @@ -220,10 +220,7 @@ class AuthenticatorValidateStageWebAuthnTests(FlowTestCase): } ] session[SESSION_KEY_WEBAUTHN_CHALLENGE] = base64url_to_bytes( - ( - "g98I51mQvZXo5lxLfhrD2zfolhZbLRyCgqkkYap1" - "jwSaJ13BguoJWCF9_Lg3AgO4Wh-Bqa556JE20oKsYbl6RA" - ) + "g98I51mQvZXo5lxLfhrD2zfolhZbLRyCgqkkYap1jwSaJ13BguoJWCF9_Lg3AgO4Wh-Bqa556JE20oKsYbl6RA" ) session.save() @@ -237,12 +234,14 @@ class AuthenticatorValidateStageWebAuthnTests(FlowTestCase): "assertionClientExtensions": "{}", "response": { "clientDataJSON": ( - "eyJ0eXBlIjoid2ViYXV0aG4uZ2V0IiwiY2hhbGxlbmdlIjoiZzk4STUxbVF2WlhvNWx4T" - "GZockQyemZvbGhaYkxSeUNncWtrWWFwMWp3U2FKMTNCZ3VvSldDRjlfTGczQWdPNFdoLU" - "JxYTU1NkpFMjBvS3NZYmw2UkEiLCJvcmlnaW4iOiJodHRwOi8vbG9jYWxob3N0OjkwMDA" - "iLCJjcm9zc09yaWdpbiI6ZmFsc2UsIm90aGVyX2tleXNfY2FuX2JlX2FkZGVkX2hlcmUi" - "OiJkbyBub3QgY29tcGFyZSBjbGllbnREYXRhSlNPTiBhZ2FpbnN0IGEgdGVtcGxhdGUuI" - "FNlZSBodHRwczovL2dvby5nbC95YWJQZXgifQ==", + ( + "eyJ0eXBlIjoid2ViYXV0aG4uZ2V0IiwiY2hhbGxlbmdlIjoiZzk4STUxbVF2WlhvN" + "Wx4TGZockQyemZvbGhaYkxSeUNncWtrWWFwMWp3U2FKMTNCZ3VvSldDRjlfTGczQW" + "dPNFdoLUJxYTU1NkpFMjBvS3NZYmw2UkEiLCJvcmlnaW4iOiJodHRwOi8vbG9jYWx" + "ob3N0OjkwMDAiLCJjcm9zc09yaWdpbiI6ZmFsc2UsIm90aGVyX2tleXNfY2FuX2Jl" + "X2FkZGVkX2hlcmUiOiJkbyBub3QgY29tcGFyZSBjbGllbnREYXRhSlNPTiBhZ2Fpb" + "nN0IGEgdGVtcGxhdGUuIFNlZSBodHRwczovL2dvby5nbC95YWJQZXgifQ==" + ), ), "signature": ( "MEQCIFNlrHf9ablJAalXLWkrqvHB8oIu8kwvRpH3X3rbJVpI" @@ -293,10 +292,7 @@ class AuthenticatorValidateStageWebAuthnTests(FlowTestCase): } ] session[SESSION_KEY_WEBAUTHN_CHALLENGE] = base64url_to_bytes( - ( - "g98I51mQvZXo5lxLfhrD2zfolhZbLRyCgqkkYap1" - "jwSaJ13BguoJWCF9_Lg3AgO4Wh-Bqa556JE20oKsYbl6RA" - ) + "g98I51mQvZXo5lxLfhrD2zfolhZbLRyCgqkkYap1jwSaJ13BguoJWCF9_Lg3AgO4Wh-Bqa556JE20oKsYbl6RA" ) session.save() @@ -310,12 +306,14 @@ class AuthenticatorValidateStageWebAuthnTests(FlowTestCase): "assertionClientExtensions": "{}", "response": { "clientDataJSON": ( - "eyJ0eXBlIjoid2ViYXV0aG4uZ2V0IiwiY2hhbGxlbmdlIjoiZzk4STUxbVF2WlhvNWx4T" - "GZockQyemZvbGhaYkxSeUNncWtrWWFwMWp3U2FKMTNCZ3VvSldDRjlfTGczQWdPNFdoLU" - "JxYTU1NkpFMjBvS3NZYmw2UkEiLCJvcmlnaW4iOiJodHRwOi8vbG9jYWxob3N0OjkwMDA" - "iLCJjcm9zc09yaWdpbiI6ZmFsc2UsIm90aGVyX2tleXNfY2FuX2JlX2FkZGVkX2hlcmUi" - "OiJkbyBub3QgY29tcGFyZSBjbGllbnREYXRhSlNPTiBhZ2FpbnN0IGEgdGVtcGxhdGUuI" - "FNlZSBodHRwczovL2dvby5nbC95YWJQZXgifQ==", + ( + "eyJ0eXBlIjoid2ViYXV0aG4uZ2V0IiwiY2hhbGxlbmdlIjoiZzk4STUxbVF2Wlhv" + "NWx4TGZockQyemZvbGhaYkxSeUNncWtrWWFwMWp3U2FKMTNCZ3VvSldDRjlfTGcz" + "QWdPNFdoLUJxYTU1NkpFMjBvS3NZYmw2UkEiLCJvcmlnaW4iOiJodHRwOi8vbG9j" + "YWxob3N0OjkwMDAiLCJjcm9zc09yaWdpbiI6ZmFsc2UsIm90aGVyX2tleXNfY2Fu" + "X2JlX2FkZGVkX2hlcmUiOiJkbyBub3QgY29tcGFyZSBjbGllbnREYXRhSlNPTiBh" + "Z2FpbnN0IGEgdGVtcGxhdGUuIFNlZSBodHRwczovL2dvby5nbC95YWJQZXgifQ==" + ), ), "signature": ( "MEQCIFNlrHf9ablJAalXLWkrqvHB8oIu8kwvRpH3X3rbJVpI" @@ -362,10 +360,7 @@ class AuthenticatorValidateStageWebAuthnTests(FlowTestCase): ) request = get_request("/") request.session[SESSION_KEY_WEBAUTHN_CHALLENGE] = base64url_to_bytes( - ( - "g98I51mQvZXo5lxLfhrD2zfolhZbLRyCgqkkYap1j" - "wSaJ13BguoJWCF9_Lg3AgO4Wh-Bqa556JE20oKsYbl6RA" - ) + "g98I51mQvZXo5lxLfhrD2zfolhZbLRyCgqkkYap1jwSaJ13BguoJWCF9_Lg3AgO4Wh-Bqa556JE20oKsYbl6RA" ) request.session.save() diff --git a/authentik/stages/authenticator_webauthn/api.py b/authentik/stages/authenticator_webauthn/api.py index de93bf56f..6ca63155f 100644 --- a/authentik/stages/authenticator_webauthn/api.py +++ b/authentik/stages/authenticator_webauthn/api.py @@ -16,7 +16,6 @@ class AuthenticateWebAuthnStageSerializer(StageSerializer): """AuthenticateWebAuthnStage Serializer""" class Meta: - model = AuthenticateWebAuthnStage fields = StageSerializer.Meta.fields + [ "configure_flow", @@ -40,7 +39,6 @@ class WebAuthnDeviceSerializer(ModelSerializer): """Serializer for WebAuthn authenticator devices""" class Meta: - model = WebAuthnDevice fields = ["pk", "name", "created_on"] depth = 2 diff --git a/authentik/stages/authenticator_webauthn/migrations/0001_initial.py b/authentik/stages/authenticator_webauthn/migrations/0001_initial.py index 7d097bd6a..610c004e6 100644 --- a/authentik/stages/authenticator_webauthn/migrations/0001_initial.py +++ b/authentik/stages/authenticator_webauthn/migrations/0001_initial.py @@ -7,7 +7,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [ @@ -65,7 +64,10 @@ class Migration(migrations.Migration): "configure_flow", models.ForeignKey( blank=True, - help_text="Flow used by an authenticated user to configure this Stage. If empty, user will not be able to configure this stage.", + help_text=( + "Flow used by an authenticated user to configure this Stage. If empty," + " user will not be able to configure this stage." + ), null=True, on_delete=django.db.models.deletion.SET_NULL, to="authentik_flows.flow", diff --git a/authentik/stages/authenticator_webauthn/migrations/0002_default_setup_flow.py b/authentik/stages/authenticator_webauthn/migrations/0002_default_setup_flow.py index 89ca255b9..c732f1d85 100644 --- a/authentik/stages/authenticator_webauthn/migrations/0002_default_setup_flow.py +++ b/authentik/stages/authenticator_webauthn/migrations/0002_default_setup_flow.py @@ -4,7 +4,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ( "authentik_stages_authenticator_webauthn", diff --git a/authentik/stages/authenticator_webauthn/migrations/0003_webauthndevice_confirmed.py b/authentik/stages/authenticator_webauthn/migrations/0003_webauthndevice_confirmed.py index 0243fa2b8..fcca73b2c 100644 --- a/authentik/stages/authenticator_webauthn/migrations/0003_webauthndevice_confirmed.py +++ b/authentik/stages/authenticator_webauthn/migrations/0003_webauthndevice_confirmed.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_stages_authenticator_webauthn", "0002_default_setup_flow"), ] diff --git a/authentik/stages/authenticator_webauthn/migrations/0004_auto_20210304_1850.py b/authentik/stages/authenticator_webauthn/migrations/0004_auto_20210304_1850.py index e223ff7d4..40ecc003d 100644 --- a/authentik/stages/authenticator_webauthn/migrations/0004_auto_20210304_1850.py +++ b/authentik/stages/authenticator_webauthn/migrations/0004_auto_20210304_1850.py @@ -4,7 +4,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ("authentik_stages_authenticator_webauthn", "0003_webauthndevice_confirmed"), ] diff --git a/authentik/stages/authenticator_webauthn/migrations/0005_authenticatewebauthnstage_user_verification.py b/authentik/stages/authenticator_webauthn/migrations/0005_authenticatewebauthnstage_user_verification.py index 12c4b1815..32b5524e9 100644 --- a/authentik/stages/authenticator_webauthn/migrations/0005_authenticatewebauthnstage_user_verification.py +++ b/authentik/stages/authenticator_webauthn/migrations/0005_authenticatewebauthnstage_user_verification.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_stages_authenticator_webauthn", "0004_auto_20210304_1850"), ] diff --git a/authentik/stages/authenticator_webauthn/migrations/0006_authenticatewebauthnstage_authenticator_attachment_and_more.py b/authentik/stages/authenticator_webauthn/migrations/0006_authenticatewebauthnstage_authenticator_attachment_and_more.py index 43d824c46..eede3518e 100644 --- a/authentik/stages/authenticator_webauthn/migrations/0006_authenticatewebauthnstage_authenticator_attachment_and_more.py +++ b/authentik/stages/authenticator_webauthn/migrations/0006_authenticatewebauthnstage_authenticator_attachment_and_more.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ( "authentik_stages_authenticator_webauthn", diff --git a/authentik/stages/authenticator_webauthn/migrations/0007_rename_last_used_on_webauthndevice_last_t.py b/authentik/stages/authenticator_webauthn/migrations/0007_rename_last_used_on_webauthndevice_last_t.py index 4916b1415..43b606adf 100644 --- a/authentik/stages/authenticator_webauthn/migrations/0007_rename_last_used_on_webauthndevice_last_t.py +++ b/authentik/stages/authenticator_webauthn/migrations/0007_rename_last_used_on_webauthndevice_last_t.py @@ -4,7 +4,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ( "authentik_stages_authenticator_webauthn", diff --git a/authentik/stages/authenticator_webauthn/models.py b/authentik/stages/authenticator_webauthn/models.py index 39d002afe..3b495e6f7 100644 --- a/authentik/stages/authenticator_webauthn/models.py +++ b/authentik/stages/authenticator_webauthn/models.py @@ -109,7 +109,6 @@ class AuthenticateWebAuthnStage(ConfigurableStage, Stage): return f"WebAuthn Authenticator Setup Stage {self.name}" class Meta: - verbose_name = _("WebAuthn Authenticator Setup Stage") verbose_name_plural = _("WebAuthn Authenticator Setup Stages") @@ -149,6 +148,5 @@ class WebAuthnDevice(SerializerModel, Device): return str(self.name) or str(self.user) class Meta: - verbose_name = _("WebAuthn Device") verbose_name_plural = _("WebAuthn Devices") diff --git a/authentik/stages/captcha/api.py b/authentik/stages/captcha/api.py index 41079530c..b8ff793ce 100644 --- a/authentik/stages/captcha/api.py +++ b/authentik/stages/captcha/api.py @@ -10,7 +10,6 @@ class CaptchaStageSerializer(StageSerializer): """CaptchaStage Serializer""" class Meta: - model = CaptchaStage fields = StageSerializer.Meta.fields + ["public_key", "private_key", "js_url", "api_url"] extra_kwargs = {"private_key": {"write_only": True}} diff --git a/authentik/stages/captcha/migrations/0001_initial.py b/authentik/stages/captcha/migrations/0001_initial.py index b1e1c3e3a..47fdccea5 100644 --- a/authentik/stages/captcha/migrations/0001_initial.py +++ b/authentik/stages/captcha/migrations/0001_initial.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [ @@ -30,13 +29,19 @@ class Migration(migrations.Migration): ( "public_key", models.TextField( - help_text="Public key, acquired from https://www.google.com/recaptcha/intro/v3.html" + help_text=( + "Public key, acquired from" + " https://www.google.com/recaptcha/intro/v3.html" + ) ), ), ( "private_key", models.TextField( - help_text="Private key, acquired from https://www.google.com/recaptcha/intro/v3.html" + help_text=( + "Private key, acquired from" + " https://www.google.com/recaptcha/intro/v3.html" + ) ), ), ], diff --git a/authentik/stages/captcha/migrations/0002_captchastage_api_url_captchastage_js_url_and_more.py b/authentik/stages/captcha/migrations/0002_captchastage_api_url_captchastage_js_url_and_more.py index 97d3d15c1..54ef81f6c 100644 --- a/authentik/stages/captcha/migrations/0002_captchastage_api_url_captchastage_js_url_and_more.py +++ b/authentik/stages/captcha/migrations/0002_captchastage_api_url_captchastage_js_url_and_more.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_stages_captcha", "0001_initial"), ] diff --git a/authentik/stages/captcha/models.py b/authentik/stages/captcha/models.py index 9703b5f07..7ef2b6547 100644 --- a/authentik/stages/captcha/models.py +++ b/authentik/stages/captcha/models.py @@ -34,6 +34,5 @@ class CaptchaStage(Stage): return "ak-stage-captcha-form" class Meta: - verbose_name = _("Captcha Stage") verbose_name_plural = _("Captcha Stages") diff --git a/authentik/stages/consent/api.py b/authentik/stages/consent/api.py index fa6f7f938..ee8940325 100644 --- a/authentik/stages/consent/api.py +++ b/authentik/stages/consent/api.py @@ -17,7 +17,6 @@ class ConsentStageSerializer(StageSerializer): """ConsentStage Serializer""" class Meta: - model = ConsentStage fields = StageSerializer.Meta.fields + ["mode", "consent_expire_in"] @@ -39,7 +38,6 @@ class UserConsentSerializer(StageSerializer): application = ApplicationSerializer() class Meta: - model = UserConsent fields = ["pk", "expires", "user", "application", "permissions"] diff --git a/authentik/stages/consent/migrations/0001_initial.py b/authentik/stages/consent/migrations/0001_initial.py index af038a034..1c7d2b9be 100644 --- a/authentik/stages/consent/migrations/0001_initial.py +++ b/authentik/stages/consent/migrations/0001_initial.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [ diff --git a/authentik/stages/consent/migrations/0002_auto_20200720_0941.py b/authentik/stages/consent/migrations/0002_auto_20200720_0941.py index ff420a5ae..ddd13d72e 100644 --- a/authentik/stages/consent/migrations/0002_auto_20200720_0941.py +++ b/authentik/stages/consent/migrations/0002_auto_20200720_0941.py @@ -9,7 +9,6 @@ import authentik.lib.utils.time class Migration(migrations.Migration): - dependencies = [ ("authentik_core", "0006_auto_20200709_1608"), migrations.swappable_dependency(settings.AUTH_USER_MODEL), @@ -22,7 +21,9 @@ class Migration(migrations.Migration): name="consent_expire_in", field=models.TextField( default="weeks=4", - help_text="Offset after which consent expires. (Format: hours=1;minutes=2;seconds=3).", + help_text=( + "Offset after which consent expires. (Format: hours=1;minutes=2;seconds=3)." + ), validators=[authentik.lib.utils.time.timedelta_string_validator], verbose_name="Consent expires in", ), diff --git a/authentik/stages/consent/migrations/0003_auto_20200924_1403.py b/authentik/stages/consent/migrations/0003_auto_20200924_1403.py index aef024dc4..ba18077b5 100644 --- a/authentik/stages/consent/migrations/0003_auto_20200924_1403.py +++ b/authentik/stages/consent/migrations/0003_auto_20200924_1403.py @@ -6,7 +6,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ("authentik_stages_consent", "0002_auto_20200720_0941"), diff --git a/authentik/stages/consent/migrations/0004_alter_userconsent_unique_together_and_more.py b/authentik/stages/consent/migrations/0004_alter_userconsent_unique_together_and_more.py index 396f1e6c9..cddb663af 100644 --- a/authentik/stages/consent/migrations/0004_alter_userconsent_unique_together_and_more.py +++ b/authentik/stages/consent/migrations/0004_alter_userconsent_unique_together_and_more.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_core", "0021_source_user_path_user_path"), migrations.swappable_dependency(settings.AUTH_USER_MODEL), diff --git a/authentik/stages/consent/migrations/0005_alter_consentstage_mode.py b/authentik/stages/consent/migrations/0005_alter_consentstage_mode.py index 32273132a..c896aadb6 100644 --- a/authentik/stages/consent/migrations/0005_alter_consentstage_mode.py +++ b/authentik/stages/consent/migrations/0005_alter_consentstage_mode.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_stages_consent", "0004_alter_userconsent_unique_together_and_more"), ] diff --git a/authentik/stages/consent/models.py b/authentik/stages/consent/models.py index 12c603690..bf042cccf 100644 --- a/authentik/stages/consent/models.py +++ b/authentik/stages/consent/models.py @@ -27,7 +27,7 @@ class ConsentStage(Stage): validators=[timedelta_string_validator], default="weeks=4", verbose_name="Consent expires in", - help_text=_(("Offset after which consent expires. (Format: hours=1;minutes=2;seconds=3).")), + help_text=_("Offset after which consent expires. (Format: hours=1;minutes=2;seconds=3)."), ) @property @@ -47,7 +47,6 @@ class ConsentStage(Stage): return "ak-stage-consent-form" class Meta: - verbose_name = _("Consent Stage") verbose_name_plural = _("Consent Stages") @@ -69,7 +68,6 @@ class UserConsent(SerializerModel, ExpiringModel): return f"User Consent {self.application} by {self.user}" class Meta: - unique_together = (("user", "application", "permissions"),) verbose_name = _("User Consent") verbose_name_plural = _("User Consents") diff --git a/authentik/stages/deny/api.py b/authentik/stages/deny/api.py index 92d2a0e80..0cda5c214 100644 --- a/authentik/stages/deny/api.py +++ b/authentik/stages/deny/api.py @@ -10,7 +10,6 @@ class DenyStageSerializer(StageSerializer): """DenyStage Serializer""" class Meta: - model = DenyStage fields = StageSerializer.Meta.fields diff --git a/authentik/stages/deny/migrations/0001_initial.py b/authentik/stages/deny/migrations/0001_initial.py index 4937b00f2..95b651ead 100644 --- a/authentik/stages/deny/migrations/0001_initial.py +++ b/authentik/stages/deny/migrations/0001_initial.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [ diff --git a/authentik/stages/deny/models.py b/authentik/stages/deny/models.py index 6f1692563..4ef252e3c 100644 --- a/authentik/stages/deny/models.py +++ b/authentik/stages/deny/models.py @@ -27,6 +27,5 @@ class DenyStage(Stage): return "ak-stage-deny-form" class Meta: - verbose_name = _("Deny Stage") verbose_name_plural = _("Deny Stages") diff --git a/authentik/stages/dummy/api.py b/authentik/stages/dummy/api.py index bdc451ba7..b443b822c 100644 --- a/authentik/stages/dummy/api.py +++ b/authentik/stages/dummy/api.py @@ -10,7 +10,6 @@ class DummyStageSerializer(StageSerializer): """DummyStage Serializer""" class Meta: - model = DummyStage fields = StageSerializer.Meta.fields + ["throw_error"] diff --git a/authentik/stages/dummy/migrations/0001_initial.py b/authentik/stages/dummy/migrations/0001_initial.py index 180a09947..de75456e8 100644 --- a/authentik/stages/dummy/migrations/0001_initial.py +++ b/authentik/stages/dummy/migrations/0001_initial.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [ diff --git a/authentik/stages/dummy/migrations/0002_dummystage_throw_error.py b/authentik/stages/dummy/migrations/0002_dummystage_throw_error.py index 60a2895b4..8bb6e2258 100644 --- a/authentik/stages/dummy/migrations/0002_dummystage_throw_error.py +++ b/authentik/stages/dummy/migrations/0002_dummystage_throw_error.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_stages_dummy", "0001_initial"), ] diff --git a/authentik/stages/dummy/models.py b/authentik/stages/dummy/models.py index acf4e310e..41aa02218 100644 --- a/authentik/stages/dummy/models.py +++ b/authentik/stages/dummy/models.py @@ -31,6 +31,5 @@ class DummyStage(Stage): return "ak-stage-dummy-form" class Meta: - verbose_name = _("Dummy Stage") verbose_name_plural = _("Dummy Stages") diff --git a/authentik/stages/email/api.py b/authentik/stages/email/api.py index 4bc1d4c96..b77fff2e7 100644 --- a/authentik/stages/email/api.py +++ b/authentik/stages/email/api.py @@ -28,7 +28,6 @@ class EmailStageSerializer(StageSerializer): raise ValidationError(f"Invalid template '{value}' specified.") class Meta: - model = EmailStage fields = StageSerializer.Meta.fields + [ "use_global_settings", diff --git a/authentik/stages/email/migrations/0001_initial.py b/authentik/stages/email/migrations/0001_initial.py index 8db5fb842..2026835b5 100644 --- a/authentik/stages/email/migrations/0001_initial.py +++ b/authentik/stages/email/migrations/0001_initial.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [ diff --git a/authentik/stages/email/migrations/0002_emailstage_use_global_settings.py b/authentik/stages/email/migrations/0002_emailstage_use_global_settings.py index a13acf2de..027097176 100644 --- a/authentik/stages/email/migrations/0002_emailstage_use_global_settings.py +++ b/authentik/stages/email/migrations/0002_emailstage_use_global_settings.py @@ -15,7 +15,6 @@ def update_template_path(apps: Apps, schema_editor: BaseDatabaseSchemaEditor): class Migration(migrations.Migration): - dependencies = [ ("authentik_stages_email", "0001_initial"), ] @@ -26,7 +25,10 @@ class Migration(migrations.Migration): name="use_global_settings", field=models.BooleanField( default=False, - help_text="When enabled, global Email connection settings will be used and connection settings below will be ignored.", + help_text=( + "When enabled, global Email connection settings will be used and connection" + " settings below will be ignored." + ), ), ), migrations.RunPython(update_template_path), diff --git a/authentik/stages/email/migrations/0003_auto_20210404_1054.py b/authentik/stages/email/migrations/0003_auto_20210404_1054.py index f8a916f46..cd32f6326 100644 --- a/authentik/stages/email/migrations/0003_auto_20210404_1054.py +++ b/authentik/stages/email/migrations/0003_auto_20210404_1054.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_stages_email", "0002_emailstage_use_global_settings"), ] diff --git a/authentik/stages/email/migrations/0004_emailstage_activate_user_on_success.py b/authentik/stages/email/migrations/0004_emailstage_activate_user_on_success.py index 77c8be05f..aaa35f8e7 100644 --- a/authentik/stages/email/migrations/0004_emailstage_activate_user_on_success.py +++ b/authentik/stages/email/migrations/0004_emailstage_activate_user_on_success.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_stages_email", "0003_auto_20210404_1054"), ] diff --git a/authentik/stages/email/models.py b/authentik/stages/email/models.py index 402144762..156762ac5 100644 --- a/authentik/stages/email/models.py +++ b/authentik/stages/email/models.py @@ -55,10 +55,8 @@ class EmailStage(Stage): use_global_settings = models.BooleanField( default=False, help_text=_( - ( - "When enabled, global Email connection settings will be used and " - "connection settings below will be ignored." - ) + "When enabled, global Email connection settings will be used and " + "connection settings below will be ignored." ), ) @@ -121,6 +119,5 @@ class EmailStage(Stage): return f"Email Stage {self.name}" class Meta: - verbose_name = _("Email Stage") verbose_name_plural = _("Email Stages") diff --git a/authentik/stages/email/tasks.py b/authentik/stages/email/tasks.py index 2c304b081..02011d7f7 100644 --- a/authentik/stages/email/tasks.py +++ b/authentik/stages/email/tasks.py @@ -85,7 +85,7 @@ def send_mail(self: MonitoredTask, message: dict[Any, Any], email_stage_pk: Opti backend.send_messages([message_object]) Event.new( EventAction.EMAIL_SENT, - message=(f"Email to {', '.join(message_object.to)} sent"), + message=f"Email to {', '.join(message_object.to)} sent", subject=message_object.subject, body=get_email_body(message_object), from_email=message_object.from_email, diff --git a/authentik/stages/identification/api.py b/authentik/stages/identification/api.py index 682d2cc0c..d55f94911 100644 --- a/authentik/stages/identification/api.py +++ b/authentik/stages/identification/api.py @@ -10,7 +10,6 @@ class IdentificationStageSerializer(StageSerializer): """IdentificationStage Serializer""" class Meta: - model = IdentificationStage fields = StageSerializer.Meta.fields + [ "user_fields", diff --git a/authentik/stages/identification/migrations/0001_initial.py b/authentik/stages/identification/migrations/0001_initial.py index e28eb3ade..276e9b58f 100644 --- a/authentik/stages/identification/migrations/0001_initial.py +++ b/authentik/stages/identification/migrations/0001_initial.py @@ -6,7 +6,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [ diff --git a/authentik/stages/identification/migrations/0002_auto_20200530_2204_squashed_0013_identificationstage_passwordless_flow.py b/authentik/stages/identification/migrations/0002_auto_20200530_2204_squashed_0013_identificationstage_passwordless_flow.py index 7f1395174..5da254fa8 100644 --- a/authentik/stages/identification/migrations/0002_auto_20200530_2204_squashed_0013_identificationstage_passwordless_flow.py +++ b/authentik/stages/identification/migrations/0002_auto_20200530_2204_squashed_0013_identificationstage_passwordless_flow.py @@ -20,7 +20,6 @@ def assign_sources(apps: Apps, schema_editor: BaseDatabaseSchemaEditor): class Migration(migrations.Migration): - replaces = [ ("authentik_stages_identification", "0002_auto_20200530_2204"), ("authentik_stages_identification", "0003_auto_20200615_1641"), @@ -87,7 +86,10 @@ class Migration(migrations.Migration): base_field=models.CharField( choices=[("email", "E Mail"), ("username", "Username")], max_length=100 ), - help_text="Fields of the user object to match against. (Hold shift to select multiple options)", + help_text=( + "Fields of the user object to match against. (Hold shift to select multiple" + " options)" + ), size=None, ), ), @@ -96,7 +98,11 @@ class Migration(migrations.Migration): name="show_matched_user", field=models.BooleanField( default=True, - help_text="When a valid username/email has been entered, and this option is enabled, the user's username and avatar will be shown. Otherwise, the text that the user entered will be shown", + help_text=( + "When a valid username/email has been entered, and this option is enabled, the" + " user's username and avatar will be shown. Otherwise, the text that the user" + " entered will be shown" + ), ), ), migrations.RemoveField( @@ -111,7 +117,10 @@ class Migration(migrations.Migration): choices=[("email", "E Mail"), ("username", "Username")], max_length=100 ), blank=True, - help_text="Fields of the user object to match against. (Hold shift to select multiple options)", + help_text=( + "Fields of the user object to match against. (Hold shift to select multiple" + " options)" + ), size=None, ), ), @@ -133,7 +142,10 @@ class Migration(migrations.Migration): name="password_stage", field=models.ForeignKey( default=None, - help_text="When set, shows a password field, instead of showing the password field as seaprate step.", + help_text=( + "When set, shows a password field, instead of showing the password field as" + " seaprate step." + ), null=True, on_delete=django.db.models.deletion.SET_NULL, to="authentik_stages_password.passwordstage", @@ -148,7 +160,10 @@ class Migration(migrations.Migration): max_length=100, ), blank=True, - help_text="Fields of the user object to match against. (Hold shift to select multiple options)", + help_text=( + "Fields of the user object to match against. (Hold shift to select multiple" + " options)" + ), size=None, ), ), diff --git a/authentik/stages/identification/models.py b/authentik/stages/identification/models.py index 9ca742d96..a9f65b878 100644 --- a/authentik/stages/identification/models.py +++ b/authentik/stages/identification/models.py @@ -26,10 +26,7 @@ class IdentificationStage(Stage): models.CharField(max_length=100, choices=UserFields.choices), blank=True, help_text=_( - ( - "Fields of the user object to match against. " - "(Hold shift to select multiple options)" - ) + "Fields of the user object to match against. (Hold shift to select multiple options)" ), ) @@ -39,8 +36,10 @@ class IdentificationStage(Stage): default=None, on_delete=models.SET_NULL, help_text=_( - "When set, shows a password field, instead of showing the " - "password field as seaprate step.", + ( + "When set, shows a password field, instead of showing the " + "password field as seaprate step." + ), ), ) case_insensitive_matching = models.BooleanField( @@ -50,11 +49,9 @@ class IdentificationStage(Stage): show_matched_user = models.BooleanField( default=True, help_text=_( - ( - "When a valid username/email has been entered, and this option is enabled, " - "the user's username and avatar will be shown. Otherwise, the text that the user " - "entered will be shown" - ) + "When a valid username/email has been entered, and this option is enabled, " + "the user's username and avatar will be shown. Otherwise, the text that the user " + "entered will be shown" ), ) @@ -108,6 +105,5 @@ class IdentificationStage(Stage): return "ak-stage-identification-form" class Meta: - verbose_name = _("Identification Stage") verbose_name_plural = _("Identification Stages") diff --git a/authentik/stages/identification/tests.py b/authentik/stages/identification/tests.py index c1f740e48..2b6481c88 100644 --- a/authentik/stages/identification/tests.py +++ b/authentik/stages/identification/tests.py @@ -78,7 +78,7 @@ class TestIdentificationStage(FlowTestCase): password_fields=True, primary_action="Log in", response_errors={ - "non_field_errors": [{"code": "invalid", "string": "Failed to " "authenticate."}] + "non_field_errors": [{"code": "invalid", "string": "Failed to authenticate."}] }, sources=[ { @@ -120,7 +120,7 @@ class TestIdentificationStage(FlowTestCase): password_fields=False, primary_action="Log in", response_errors={ - "non_field_errors": [{"code": "invalid", "string": "Failed to " "authenticate."}] + "non_field_errors": [{"code": "invalid", "string": "Failed to authenticate."}] }, show_source_labels=False, sources=[ diff --git a/authentik/stages/invitation/api.py b/authentik/stages/invitation/api.py index 0c77cec4a..f064664b5 100644 --- a/authentik/stages/invitation/api.py +++ b/authentik/stages/invitation/api.py @@ -17,7 +17,6 @@ class InvitationStageSerializer(StageSerializer): """InvitationStage Serializer""" class Meta: - model = InvitationStage fields = StageSerializer.Meta.fields + [ "continue_flow_without_invitation", @@ -30,7 +29,6 @@ class InvitationStageFilter(FilterSet): no_flows = BooleanFilter("flow", "isnull") class Meta: - model = InvitationStage fields = ["name", "no_flows", "continue_flow_without_invitation", "stage_uuid"] @@ -53,7 +51,6 @@ class InvitationSerializer(ModelSerializer): flow_obj = FlowSerializer(read_only=True, required=False, source="flow") class Meta: - model = Invitation fields = [ "pk", diff --git a/authentik/stages/invitation/migrations/0001_squashed_0006_invitation_name.py b/authentik/stages/invitation/migrations/0001_squashed_0006_invitation_name.py index a9feff06e..17ac5ee40 100644 --- a/authentik/stages/invitation/migrations/0001_squashed_0006_invitation_name.py +++ b/authentik/stages/invitation/migrations/0001_squashed_0006_invitation_name.py @@ -22,7 +22,6 @@ def migrate_add_name(apps: Apps, schema_editor: BaseDatabaseSchemaEditor): class Migration(migrations.Migration): - replaces = [ ("authentik_stages_invitation", "0001_initial"), ("authentik_stages_invitation", "0002_auto_20201225_2143"), @@ -58,7 +57,11 @@ class Migration(migrations.Migration): "continue_flow_without_invitation", models.BooleanField( default=False, - help_text="If this flag is set, this Stage will jump to the next Stage when no Invitation is given. By default this Stage will cancel the Flow when no invitation is given.", + help_text=( + "If this flag is set, this Stage will jump to the next Stage when no" + " Invitation is given. By default this Stage will cancel the Flow when" + " no invitation is given." + ), ), ), ], diff --git a/authentik/stages/invitation/migrations/0007_invitation_flow.py b/authentik/stages/invitation/migrations/0007_invitation_flow.py index 2842a3039..c8f62a20f 100644 --- a/authentik/stages/invitation/migrations/0007_invitation_flow.py +++ b/authentik/stages/invitation/migrations/0007_invitation_flow.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_flows", "0024_flow_authentication"), ("authentik_stages_invitation", "0001_squashed_0006_invitation_name"), diff --git a/authentik/stages/invitation/models.py b/authentik/stages/invitation/models.py index 6ea564ae0..d5386c34e 100644 --- a/authentik/stages/invitation/models.py +++ b/authentik/stages/invitation/models.py @@ -18,11 +18,9 @@ class InvitationStage(Stage): continue_flow_without_invitation = models.BooleanField( default=False, help_text=_( - ( - "If this flag is set, this Stage will jump to the next Stage when " - "no Invitation is given. By default this Stage will cancel the " - "Flow when no invitation is given." - ) + "If this flag is set, this Stage will jump to the next Stage when " + "no Invitation is given. By default this Stage will cancel the " + "Flow when no invitation is given." ), ) @@ -43,7 +41,6 @@ class InvitationStage(Stage): return "ak-stage-invitation-form" class Meta: - verbose_name = _("Invitation Stage") verbose_name_plural = _("Invitation Stages") @@ -84,6 +81,5 @@ class Invitation(SerializerModel, ExpiringModel): return f"Invitation {self.invite_uuid.hex} created by {self.created_by}" class Meta: - verbose_name = _("Invitation") verbose_name_plural = _("Invitations") diff --git a/authentik/stages/password/api.py b/authentik/stages/password/api.py index 1ba780b2d..d90450e5e 100644 --- a/authentik/stages/password/api.py +++ b/authentik/stages/password/api.py @@ -10,7 +10,6 @@ class PasswordStageSerializer(StageSerializer): """PasswordStage Serializer""" class Meta: - model = PasswordStage fields = StageSerializer.Meta.fields + [ "backends", diff --git a/authentik/stages/password/migrations/0001_initial.py b/authentik/stages/password/migrations/0001_initial.py index 45b852720..15bd6579c 100644 --- a/authentik/stages/password/migrations/0001_initial.py +++ b/authentik/stages/password/migrations/0001_initial.py @@ -6,7 +6,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [ diff --git a/authentik/stages/password/migrations/0002_passwordstage_change_flow.py b/authentik/stages/password/migrations/0002_passwordstage_change_flow.py index 67b0cbba6..52d44444d 100644 --- a/authentik/stages/password/migrations/0002_passwordstage_change_flow.py +++ b/authentik/stages/password/migrations/0002_passwordstage_change_flow.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_stages_password", "0001_initial"), ] @@ -16,7 +15,10 @@ class Migration(migrations.Migration): name="change_flow", field=models.ForeignKey( blank=True, - help_text="Flow used by an authenticated user to change their password. If empty, user will be unable to change their password.", + help_text=( + "Flow used by an authenticated user to change their password. If empty, user" + " will be unable to change their password." + ), null=True, on_delete=django.db.models.deletion.SET_NULL, to="authentik_flows.Flow", diff --git a/authentik/stages/password/migrations/0003_passwordstage_failed_attempts_before_cancel.py b/authentik/stages/password/migrations/0003_passwordstage_failed_attempts_before_cancel.py index c5321f99a..7e1dbc623 100644 --- a/authentik/stages/password/migrations/0003_passwordstage_failed_attempts_before_cancel.py +++ b/authentik/stages/password/migrations/0003_passwordstage_failed_attempts_before_cancel.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_stages_password", "0002_passwordstage_change_flow"), ] @@ -15,7 +14,10 @@ class Migration(migrations.Migration): name="failed_attempts_before_cancel", field=models.IntegerField( default=5, - help_text="How many attempts a user has before the flow is canceled. To lock the user out, use a reputation policy and a user_write stage.", + help_text=( + "How many attempts a user has before the flow is canceled. To lock the user" + " out, use a reputation policy and a user_write stage." + ), ), ), ] diff --git a/authentik/stages/password/migrations/0004_auto_20200925_1057.py b/authentik/stages/password/migrations/0004_auto_20200925_1057.py index 2ac29f24a..c57c80987 100644 --- a/authentik/stages/password/migrations/0004_auto_20200925_1057.py +++ b/authentik/stages/password/migrations/0004_auto_20200925_1057.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_flows", "0013_auto_20200924_1605"), ( @@ -25,7 +24,10 @@ class Migration(migrations.Migration): name="configure_flow", field=models.ForeignKey( blank=True, - help_text="Flow used by an authenticated user to configure this Stage. If empty, user will not be able to configure this stage.", + help_text=( + "Flow used by an authenticated user to configure this Stage. If empty, user" + " will not be able to configure this stage." + ), null=True, on_delete=django.db.models.deletion.SET_NULL, to="authentik_flows.flow", diff --git a/authentik/stages/password/migrations/0005_auto_20210402_2221.py b/authentik/stages/password/migrations/0005_auto_20210402_2221.py index d88061dd3..95d7ef647 100644 --- a/authentik/stages/password/migrations/0005_auto_20210402_2221.py +++ b/authentik/stages/password/migrations/0005_auto_20210402_2221.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_stages_password", "0004_auto_20200925_1057"), ] diff --git a/authentik/stages/password/migrations/0006_passwordchange_rename.py b/authentik/stages/password/migrations/0006_passwordchange_rename.py index f1de27891..668c58e9d 100644 --- a/authentik/stages/password/migrations/0006_passwordchange_rename.py +++ b/authentik/stages/password/migrations/0006_passwordchange_rename.py @@ -3,7 +3,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ("authentik_stages_password", "0005_auto_20210402_2221"), ] diff --git a/authentik/stages/password/migrations/0007_app_password.py b/authentik/stages/password/migrations/0007_app_password.py index 641ccdb07..7961c22a6 100644 --- a/authentik/stages/password/migrations/0007_app_password.py +++ b/authentik/stages/password/migrations/0007_app_password.py @@ -21,7 +21,6 @@ def update_default_backends(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) class Migration(migrations.Migration): - dependencies = [ ("authentik_stages_password", "0006_passwordchange_rename"), ] diff --git a/authentik/stages/password/migrations/0008_replace_inbuilt.py b/authentik/stages/password/migrations/0008_replace_inbuilt.py index 4c8327e7c..3c5d55737 100644 --- a/authentik/stages/password/migrations/0008_replace_inbuilt.py +++ b/authentik/stages/password/migrations/0008_replace_inbuilt.py @@ -21,7 +21,6 @@ def replace_inbuilt(apps: Apps, schema_editor: BaseDatabaseSchemaEditor): class Migration(migrations.Migration): - dependencies = [ ("authentik_stages_password", "0007_app_password"), ] diff --git a/authentik/stages/password/models.py b/authentik/stages/password/models.py index 1e1dd2b05..792a81afc 100644 --- a/authentik/stages/password/models.py +++ b/authentik/stages/password/models.py @@ -40,10 +40,8 @@ class PasswordStage(ConfigurableStage, Stage): failed_attempts_before_cancel = models.IntegerField( default=5, help_text=_( - ( - "How many attempts a user has before the flow is canceled. " - "To lock the user out, use a reputation policy and a user_write stage." - ) + "How many attempts a user has before the flow is canceled. " + "To lock the user out, use a reputation policy and a user_write stage." ), ) @@ -74,6 +72,5 @@ class PasswordStage(ConfigurableStage, Stage): ) class Meta: - verbose_name = _("Password Stage") verbose_name_plural = _("Password Stages") diff --git a/authentik/stages/prompt/api.py b/authentik/stages/prompt/api.py index a95909252..0f333e32c 100644 --- a/authentik/stages/prompt/api.py +++ b/authentik/stages/prompt/api.py @@ -14,7 +14,6 @@ class PromptStageSerializer(StageSerializer): name = CharField(validators=[UniqueValidator(queryset=PromptStage.objects.all())]) class Meta: - model = PromptStage fields = StageSerializer.Meta.fields + [ "fields", @@ -38,7 +37,6 @@ class PromptSerializer(ModelSerializer): promptstage_set = StageSerializer(many=True, required=False) class Meta: - model = Prompt fields = [ "pk", diff --git a/authentik/stages/prompt/migrations/0001_initial.py b/authentik/stages/prompt/migrations/0001_initial.py index 91201c001..138626d34 100644 --- a/authentik/stages/prompt/migrations/0001_initial.py +++ b/authentik/stages/prompt/migrations/0001_initial.py @@ -7,7 +7,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [ @@ -42,7 +41,10 @@ class Migration(migrations.Migration): ("text", "Text: Simple Text input"), ( "username", - "Username: Same as Text input, but checks for and prevents duplicate usernames.", + ( + "Username: Same as Text input, but checks for and prevents" + " duplicate usernames." + ), ), ("email", "Email: Text field with Email type."), ("password", "Password"), diff --git a/authentik/stages/prompt/migrations/0002_auto_20200920_1859.py b/authentik/stages/prompt/migrations/0002_auto_20200920_1859.py index 2ded1bbb4..58145365f 100644 --- a/authentik/stages/prompt/migrations/0002_auto_20200920_1859.py +++ b/authentik/stages/prompt/migrations/0002_auto_20200920_1859.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_stages_prompt", "0001_initial"), ] @@ -18,12 +17,19 @@ class Migration(migrations.Migration): ("text", "Text: Simple Text input"), ( "username", - "Username: Same as Text input, but checks for and prevents duplicate usernames.", + ( + "Username: Same as Text input, but checks for and prevents duplicate" + " usernames." + ), ), ("email", "Email: Text field with Email type."), ( "password", - "Password: Masked input, password is validated against sources. Policies still have to be applied to this Stage. If two of these are used in the same stage, they are ensured to be identical.", + ( + "Password: Masked input, password is validated against sources." + " Policies still have to be applied to this Stage. If two of these are" + " used in the same stage, they are ensured to be identical." + ), ), ("number", "Number"), ("checkbox", "Checkbox"), diff --git a/authentik/stages/prompt/migrations/0003_auto_20210222_1821.py b/authentik/stages/prompt/migrations/0003_auto_20210222_1821.py index c6f97e91c..d876fc5c6 100644 --- a/authentik/stages/prompt/migrations/0003_auto_20210222_1821.py +++ b/authentik/stages/prompt/migrations/0003_auto_20210222_1821.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_stages_prompt", "0002_auto_20200920_1859"), ] @@ -18,12 +17,19 @@ class Migration(migrations.Migration): ("text", "Text: Simple Text input"), ( "username", - "Username: Same as Text input, but checks for and prevents duplicate usernames.", + ( + "Username: Same as Text input, but checks for and prevents duplicate" + " usernames." + ), ), ("email", "Email: Text field with Email type."), ( "password", - "Password: Masked input, password is validated against sources. Policies still have to be applied to this Stage. If two of these are used in the same stage, they are ensured to be identical.", + ( + "Password: Masked input, password is validated against sources." + " Policies still have to be applied to this Stage. If two of these are" + " used in the same stage, they are ensured to be identical." + ), ), ("number", "Number"), ("checkbox", "Checkbox"), diff --git a/authentik/stages/prompt/migrations/0004_prompt_sub_text.py b/authentik/stages/prompt/migrations/0004_prompt_sub_text.py index 36a796ca2..e15a52e40 100644 --- a/authentik/stages/prompt/migrations/0004_prompt_sub_text.py +++ b/authentik/stages/prompt/migrations/0004_prompt_sub_text.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_stages_prompt", "0003_auto_20210222_1821"), ] diff --git a/authentik/stages/prompt/migrations/0005_alter_prompt_field_key.py b/authentik/stages/prompt/migrations/0005_alter_prompt_field_key.py index 83c849746..c300de4c3 100644 --- a/authentik/stages/prompt/migrations/0005_alter_prompt_field_key.py +++ b/authentik/stages/prompt/migrations/0005_alter_prompt_field_key.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_stages_prompt", "0004_prompt_sub_text"), ] diff --git a/authentik/stages/prompt/migrations/0006_alter_prompt_type.py b/authentik/stages/prompt/migrations/0006_alter_prompt_type.py index eeeaf522b..2026e238f 100644 --- a/authentik/stages/prompt/migrations/0006_alter_prompt_type.py +++ b/authentik/stages/prompt/migrations/0006_alter_prompt_type.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_stages_prompt", "0005_alter_prompt_field_key"), ] @@ -22,12 +21,19 @@ class Migration(migrations.Migration): ), ( "username", - "Username: Same as Text input, but checks for and prevents duplicate usernames.", + ( + "Username: Same as Text input, but checks for and prevents duplicate" + " usernames." + ), ), ("email", "Email: Text field with Email type."), ( "password", - "Password: Masked input, password is validated against sources. Policies still have to be applied to this Stage. If two of these are used in the same stage, they are ensured to be identical.", + ( + "Password: Masked input, password is validated against sources." + " Policies still have to be applied to this Stage. If two of these are" + " used in the same stage, they are ensured to be identical." + ), ), ("number", "Number"), ("checkbox", "Checkbox"), diff --git a/authentik/stages/prompt/migrations/0007_prompt_placeholder_expression.py b/authentik/stages/prompt/migrations/0007_prompt_placeholder_expression.py index 581968456..9644af0d4 100644 --- a/authentik/stages/prompt/migrations/0007_prompt_placeholder_expression.py +++ b/authentik/stages/prompt/migrations/0007_prompt_placeholder_expression.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_stages_prompt", "0006_alter_prompt_type"), ] @@ -27,12 +26,19 @@ class Migration(migrations.Migration): ), ( "username", - "Username: Same as Text input, but checks for and prevents duplicate usernames.", + ( + "Username: Same as Text input, but checks for and prevents duplicate" + " usernames." + ), ), ("email", "Email: Text field with Email type."), ( "password", - "Password: Masked input, password is validated against sources. Policies still have to be applied to this Stage. If two of these are used in the same stage, they are ensured to be identical.", + ( + "Password: Masked input, password is validated against sources." + " Policies still have to be applied to this Stage. If two of these are" + " used in the same stage, they are ensured to be identical." + ), ), ("number", "Number"), ("checkbox", "Checkbox"), diff --git a/authentik/stages/prompt/migrations/0008_alter_prompt_type.py b/authentik/stages/prompt/migrations/0008_alter_prompt_type.py index a97946765..cf25793d2 100644 --- a/authentik/stages/prompt/migrations/0008_alter_prompt_type.py +++ b/authentik/stages/prompt/migrations/0008_alter_prompt_type.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_stages_prompt", "0007_prompt_placeholder_expression"), ] @@ -22,12 +21,19 @@ class Migration(migrations.Migration): ), ( "username", - "Username: Same as Text input, but checks for and prevents duplicate usernames.", + ( + "Username: Same as Text input, but checks for and prevents duplicate" + " usernames." + ), ), ("email", "Email: Text field with Email type."), ( "password", - "Password: Masked input, password is validated against sources. Policies still have to be applied to this Stage. If two of these are used in the same stage, they are ensured to be identical.", + ( + "Password: Masked input, password is validated against sources." + " Policies still have to be applied to this Stage. If two of these are" + " used in the same stage, they are ensured to be identical." + ), ), ("number", "Number"), ("checkbox", "Checkbox"), @@ -35,7 +41,10 @@ class Migration(migrations.Migration): ("date-time", "Date Time"), ( "file", - "File: File upload for arbitrary files. File content will be available in flow context as data-URI", + ( + "File: File upload for arbitrary files. File content will be available" + " in flow context as data-URI" + ), ), ("separator", "Separator: Static Separator Line"), ("hidden", "Hidden: Hidden field, can be used to insert data into form."), diff --git a/authentik/stages/prompt/migrations/0009_prompt_name.py b/authentik/stages/prompt/migrations/0009_prompt_name.py index 0f4aae503..ccaebe2e6 100644 --- a/authentik/stages/prompt/migrations/0009_prompt_name.py +++ b/authentik/stages/prompt/migrations/0009_prompt_name.py @@ -22,7 +22,6 @@ def set_generated_name(apps: Apps, schema_editor: BaseDatabaseSchemaEditor): class Migration(migrations.Migration): - dependencies = [ ("authentik_stages_prompt", "0008_alter_prompt_type"), ] diff --git a/authentik/stages/prompt/models.py b/authentik/stages/prompt/models.py index 87bbf4437..62be9df16 100644 --- a/authentik/stages/prompt/models.py +++ b/authentik/stages/prompt/models.py @@ -45,17 +45,15 @@ class FieldTypes(models.TextChoices): # Same as text, but has autocomplete for password managers USERNAME = ( "username", - _(("Username: Same as Text input, but checks for and prevents duplicate usernames.")), + _("Username: Same as Text input, but checks for and prevents duplicate usernames."), ) EMAIL = "email", _("Email: Text field with Email type.") PASSWORD = ( "password", # noqa # nosec _( - ( - "Password: Masked input, password is validated against sources. Policies still " - "have to be applied to this Stage. If two of these are used in the same stage, " - "they are ensured to be identical." - ) + "Password: Masked input, password is validated against sources. Policies still " + "have to be applied to this Stage. If two of these are used in the same stage, " + "they are ensured to be identical." ), ) NUMBER = "number" @@ -194,7 +192,6 @@ class Prompt(SerializerModel): return f"Prompt field '{self.field_key}' type {self.type}" class Meta: - verbose_name = _("Prompt") verbose_name_plural = _("Prompts") @@ -223,6 +220,5 @@ class PromptStage(Stage): return "ak-stage-prompt-form" class Meta: - verbose_name = _("Prompt Stage") verbose_name_plural = _("Prompt Stages") diff --git a/authentik/stages/user_delete/api.py b/authentik/stages/user_delete/api.py index 1ba14d8f8..1c557d714 100644 --- a/authentik/stages/user_delete/api.py +++ b/authentik/stages/user_delete/api.py @@ -10,7 +10,6 @@ class UserDeleteStageSerializer(StageSerializer): """UserDeleteStage Serializer""" class Meta: - model = UserDeleteStage fields = StageSerializer.Meta.fields diff --git a/authentik/stages/user_delete/migrations/0001_initial.py b/authentik/stages/user_delete/migrations/0001_initial.py index 6ae6061a2..c6e93a3c7 100644 --- a/authentik/stages/user_delete/migrations/0001_initial.py +++ b/authentik/stages/user_delete/migrations/0001_initial.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [ diff --git a/authentik/stages/user_delete/models.py b/authentik/stages/user_delete/models.py index 801cec5a5..154e4f9ae 100644 --- a/authentik/stages/user_delete/models.py +++ b/authentik/stages/user_delete/models.py @@ -28,6 +28,5 @@ class UserDeleteStage(Stage): return "ak-stage-user-delete-form" class Meta: - verbose_name = _("User Delete Stage") verbose_name_plural = _("User Delete Stages") diff --git a/authentik/stages/user_login/api.py b/authentik/stages/user_login/api.py index e8f8048b8..ca5937fa8 100644 --- a/authentik/stages/user_login/api.py +++ b/authentik/stages/user_login/api.py @@ -10,7 +10,6 @@ class UserLoginStageSerializer(StageSerializer): """UserLoginStage Serializer""" class Meta: - model = UserLoginStage fields = StageSerializer.Meta.fields + [ "session_duration", diff --git a/authentik/stages/user_login/migrations/0001_initial.py b/authentik/stages/user_login/migrations/0001_initial.py index ed82b2fe3..54dc0a47c 100644 --- a/authentik/stages/user_login/migrations/0001_initial.py +++ b/authentik/stages/user_login/migrations/0001_initial.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [ diff --git a/authentik/stages/user_login/migrations/0002_userloginstage_session_duration.py b/authentik/stages/user_login/migrations/0002_userloginstage_session_duration.py index 53bc43fda..2efcdae0e 100644 --- a/authentik/stages/user_login/migrations/0002_userloginstage_session_duration.py +++ b/authentik/stages/user_login/migrations/0002_userloginstage_session_duration.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_stages_user_login", "0001_initial"), ] @@ -15,7 +14,10 @@ class Migration(migrations.Migration): name="session_duration", field=models.PositiveIntegerField( default=0, - help_text="Determines how long a session lasts, in seconds. Default of 0 means that the sessions lasts until the browser is closed.", + help_text=( + "Determines how long a session lasts, in seconds. Default of 0 means that the" + " sessions lasts until the browser is closed." + ), ), ), ] diff --git a/authentik/stages/user_login/migrations/0003_session_duration_delta.py b/authentik/stages/user_login/migrations/0003_session_duration_delta.py index ebc8f09f9..a1fe83015 100644 --- a/authentik/stages/user_login/migrations/0003_session_duration_delta.py +++ b/authentik/stages/user_login/migrations/0003_session_duration_delta.py @@ -19,7 +19,6 @@ def update_duration(apps: Apps, schema_editor: BaseDatabaseSchemaEditor): class Migration(migrations.Migration): - dependencies = [ ("authentik_stages_user_login", "0002_userloginstage_session_duration"), ] @@ -30,7 +29,10 @@ class Migration(migrations.Migration): name="session_duration", field=models.TextField( default="seconds=0", - help_text="Determines how long a session lasts. Default of 0 means that the sessions lasts until the browser is closed. (Format: hours=-1;minutes=-2;seconds=-3)", + help_text=( + "Determines how long a session lasts. Default of 0 means that the sessions" + " lasts until the browser is closed. (Format: hours=-1;minutes=-2;seconds=-3)" + ), validators=[authentik.lib.utils.time.timedelta_string_validator], ), ), diff --git a/authentik/stages/user_login/models.py b/authentik/stages/user_login/models.py index c75e1bb3b..8ba581aa8 100644 --- a/authentik/stages/user_login/models.py +++ b/authentik/stages/user_login/models.py @@ -39,6 +39,5 @@ class UserLoginStage(Stage): return "ak-stage-user-login-form" class Meta: - verbose_name = _("User Login Stage") verbose_name_plural = _("User Login Stages") diff --git a/authentik/stages/user_logout/api.py b/authentik/stages/user_logout/api.py index 16e061f2f..2168df0fb 100644 --- a/authentik/stages/user_logout/api.py +++ b/authentik/stages/user_logout/api.py @@ -10,7 +10,6 @@ class UserLogoutStageSerializer(StageSerializer): """UserLogoutStage Serializer""" class Meta: - model = UserLogoutStage fields = StageSerializer.Meta.fields diff --git a/authentik/stages/user_logout/migrations/0001_initial.py b/authentik/stages/user_logout/migrations/0001_initial.py index 1b1ba2860..fa6e8b088 100644 --- a/authentik/stages/user_logout/migrations/0001_initial.py +++ b/authentik/stages/user_logout/migrations/0001_initial.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [ diff --git a/authentik/stages/user_logout/models.py b/authentik/stages/user_logout/models.py index 6d024077a..76e6f0db3 100644 --- a/authentik/stages/user_logout/models.py +++ b/authentik/stages/user_logout/models.py @@ -27,6 +27,5 @@ class UserLogoutStage(Stage): return "ak-stage-user-logout-form" class Meta: - verbose_name = _("User Logout Stage") verbose_name_plural = _("User Logout Stages") diff --git a/authentik/stages/user_write/api.py b/authentik/stages/user_write/api.py index 339041dde..4cf0f17d2 100644 --- a/authentik/stages/user_write/api.py +++ b/authentik/stages/user_write/api.py @@ -10,7 +10,6 @@ class UserWriteStageSerializer(StageSerializer): """UserWriteStage Serializer""" class Meta: - model = UserWriteStage fields = StageSerializer.Meta.fields + [ "user_creation_mode", diff --git a/authentik/stages/user_write/migrations/0001_initial.py b/authentik/stages/user_write/migrations/0001_initial.py index 94583d7ec..95682d349 100644 --- a/authentik/stages/user_write/migrations/0001_initial.py +++ b/authentik/stages/user_write/migrations/0001_initial.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [ diff --git a/authentik/stages/user_write/migrations/0002_auto_20200918_1653.py b/authentik/stages/user_write/migrations/0002_auto_20200918_1653.py index ddf6d96dd..f4983fb67 100644 --- a/authentik/stages/user_write/migrations/0002_auto_20200918_1653.py +++ b/authentik/stages/user_write/migrations/0002_auto_20200918_1653.py @@ -17,7 +17,6 @@ def remove_unintended_attributes(apps: Apps, schema_editor: BaseDatabaseSchemaEd class Migration(migrations.Migration): - dependencies = [ ("authentik_stages_user_write", "0001_initial"), ] diff --git a/authentik/stages/user_write/migrations/0003_userwritestage_create_users_as_inactive.py b/authentik/stages/user_write/migrations/0003_userwritestage_create_users_as_inactive.py index 5ca410291..a7ff798cf 100644 --- a/authentik/stages/user_write/migrations/0003_userwritestage_create_users_as_inactive.py +++ b/authentik/stages/user_write/migrations/0003_userwritestage_create_users_as_inactive.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_stages_user_write", "0002_auto_20200918_1653"), ] diff --git a/authentik/stages/user_write/migrations/0004_userwritestage_create_users_group.py b/authentik/stages/user_write/migrations/0004_userwritestage_create_users_group.py index 3ce5ba63b..dbb48fa1d 100644 --- a/authentik/stages/user_write/migrations/0004_userwritestage_create_users_group.py +++ b/authentik/stages/user_write/migrations/0004_userwritestage_create_users_group.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_core", "0028_alter_token_intent"), ("authentik_stages_user_write", "0003_userwritestage_create_users_as_inactive"), diff --git a/authentik/stages/user_write/migrations/0005_userwritestage_user_path_template.py b/authentik/stages/user_write/migrations/0005_userwritestage_user_path_template.py index acf691594..8774416ec 100644 --- a/authentik/stages/user_write/migrations/0005_userwritestage_user_path_template.py +++ b/authentik/stages/user_write/migrations/0005_userwritestage_user_path_template.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_stages_user_write", "0004_userwritestage_create_users_group"), ] diff --git a/authentik/stages/user_write/migrations/0006_userwritestage_can_create_users.py b/authentik/stages/user_write/migrations/0006_userwritestage_can_create_users.py index dda74f3fa..3745024f0 100644 --- a/authentik/stages/user_write/migrations/0006_userwritestage_can_create_users.py +++ b/authentik/stages/user_write/migrations/0006_userwritestage_can_create_users.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_stages_user_write", "0005_userwritestage_user_path_template"), ] @@ -15,7 +14,10 @@ class Migration(migrations.Migration): name="can_create_users", field=models.BooleanField( default=True, - help_text="When set, this stage can create users. If not enabled and no user is available, stage will fail.", + help_text=( + "When set, this stage can create users. If not enabled and no user is" + " available, stage will fail." + ), ), ), ] diff --git a/authentik/stages/user_write/migrations/0007_remove_userwritestage_can_create_users_and_more.py b/authentik/stages/user_write/migrations/0007_remove_userwritestage_can_create_users_and_more.py index 6e27efd7e..f7500735f 100644 --- a/authentik/stages/user_write/migrations/0007_remove_userwritestage_can_create_users_and_more.py +++ b/authentik/stages/user_write/migrations/0007_remove_userwritestage_can_create_users_and_more.py @@ -18,7 +18,6 @@ def migrate_to_user_creation_mode(apps: Apps, schema_editor: BaseDatabaseSchemaE class Migration(migrations.Migration): - dependencies = [ ("authentik_stages_user_write", "0006_userwritestage_can_create_users"), ] diff --git a/authentik/stages/user_write/models.py b/authentik/stages/user_write/models.py index a07e4c46c..ca50951a3 100644 --- a/authentik/stages/user_write/models.py +++ b/authentik/stages/user_write/models.py @@ -61,6 +61,5 @@ class UserWriteStage(Stage): return "ak-stage-user-write-form" class Meta: - verbose_name = _("User Write Stage") verbose_name_plural = _("User Write Stages") diff --git a/authentik/tenants/api.py b/authentik/tenants/api.py index 5568f956f..d7a281371 100644 --- a/authentik/tenants/api.py +++ b/authentik/tenants/api.py @@ -39,7 +39,6 @@ class TenantSerializer(ModelSerializer): return super().validate(attrs) class Meta: - model = Tenant fields = [ "tenant_uuid", diff --git a/authentik/tenants/migrations/0001_squashed_0005_tenant_web_certificate.py b/authentik/tenants/migrations/0001_squashed_0005_tenant_web_certificate.py index 3164ac674..fb0aae3e5 100644 --- a/authentik/tenants/migrations/0001_squashed_0005_tenant_web_certificate.py +++ b/authentik/tenants/migrations/0001_squashed_0005_tenant_web_certificate.py @@ -11,7 +11,6 @@ import authentik.lib.utils.time class Migration(migrations.Migration): - replaces = [ ("authentik_tenants", "0001_initial"), ("authentik_tenants", "0002_default"), @@ -39,7 +38,10 @@ class Migration(migrations.Migration): ( "domain", models.TextField( - help_text="Domain that activates this tenant. Can be a superset, i.e. `a.b` for `aa.b` and `ba.b`" + help_text=( + "Domain that activates this tenant. Can be a superset, i.e. `a.b` for" + " `aa.b` and `ba.b`" + ) ), ), ("default", models.BooleanField(default=False)), @@ -100,7 +102,10 @@ class Migration(migrations.Migration): name="event_retention", field=models.TextField( default="days=365", - help_text="Events will be deleted after this duration.(Format: weeks=3;days=2;hours=3,seconds=2).", + help_text=( + "Events will be deleted after this duration.(Format:" + " weeks=3;days=2;hours=3,seconds=2)." + ), validators=[authentik.lib.utils.time.timedelta_string_validator], ), ), diff --git a/authentik/tenants/migrations/0002_tenant_flow_user_settings.py b/authentik/tenants/migrations/0002_tenant_flow_user_settings.py index a8eb8fa64..2f17db4a1 100644 --- a/authentik/tenants/migrations/0002_tenant_flow_user_settings.py +++ b/authentik/tenants/migrations/0002_tenant_flow_user_settings.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_stages_prompt", "0007_prompt_placeholder_expression"), ("authentik_flows", "0021_auto_20211227_2103"), diff --git a/authentik/tenants/migrations/0003_tenant_attributes.py b/authentik/tenants/migrations/0003_tenant_attributes.py index c467ac0c6..3431af7f0 100644 --- a/authentik/tenants/migrations/0003_tenant_attributes.py +++ b/authentik/tenants/migrations/0003_tenant_attributes.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_tenants", "0002_tenant_flow_user_settings"), ] diff --git a/authentik/tenants/migrations/0004_tenant_flow_device_code.py b/authentik/tenants/migrations/0004_tenant_flow_device_code.py index 01172b38d..2e2fdcf45 100644 --- a/authentik/tenants/migrations/0004_tenant_flow_device_code.py +++ b/authentik/tenants/migrations/0004_tenant_flow_device_code.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("authentik_flows", "0023_flow_denied_action"), ("authentik_tenants", "0003_tenant_attributes"), diff --git a/authentik/tenants/models.py b/authentik/tenants/models.py index 9eb685ca3..b729eaaf2 100644 --- a/authentik/tenants/models.py +++ b/authentik/tenants/models.py @@ -20,8 +20,7 @@ class Tenant(SerializerModel): tenant_uuid = models.UUIDField(primary_key=True, editable=False, default=uuid4) domain = models.TextField( help_text=_( - "Domain that activates this tenant. " - "Can be a superset, i.e. `a.b` for `aa.b` and `ba.b`" + "Domain that activates this tenant. Can be a superset, i.e. `a.b` for `aa.b` and `ba.b`" ) ) default = models.BooleanField( @@ -56,10 +55,7 @@ class Tenant(SerializerModel): default="days=365", validators=[timedelta_string_validator], help_text=_( - ( - "Events will be deleted after this duration." - "(Format: weeks=3;days=2;hours=3,seconds=2)." - ) + "Events will be deleted after this duration.(Format: weeks=3;days=2;hours=3,seconds=2)." ), ) @@ -68,7 +64,7 @@ class Tenant(SerializerModel): null=True, default=None, on_delete=models.SET_DEFAULT, - help_text=_(("Web Certificate used by the authentik Core webserver.")), + help_text=_("Web Certificate used by the authentik Core webserver."), ) attributes = models.JSONField(default=dict, blank=True) @@ -94,6 +90,5 @@ class Tenant(SerializerModel): return f"Tenant {self.domain}" class Meta: - verbose_name = _("Tenant") verbose_name_plural = _("Tenants") diff --git a/lifecycle/system_migrations/to_2021_3_authenticator.py b/lifecycle/system_migrations/to_2021_3_authenticator.py index 607d2e2c4..3dd895bdb 100644 --- a/lifecycle/system_migrations/to_2021_3_authenticator.py +++ b/lifecycle/system_migrations/to_2021_3_authenticator.py @@ -20,7 +20,8 @@ END TRANSACTION;""" class Migration(BaseMigration): def needs_migration(self) -> bool: self.cur.execute( - "select * from information_schema.tables where table_name = 'authentik_stages_otp_static_otpstaticstage';" + "select * from information_schema.tables where table_name =" + " 'authentik_stages_otp_static_otpstaticstage';" ) return bool(self.cur.rowcount) diff --git a/lifecycle/system_migrations/to_2023_1_hibp_remove.py b/lifecycle/system_migrations/to_2023_1_hibp_remove.py index 28a926a8a..4c8b9e292 100644 --- a/lifecycle/system_migrations/to_2023_1_hibp_remove.py +++ b/lifecycle/system_migrations/to_2023_1_hibp_remove.py @@ -10,7 +10,8 @@ END TRANSACTION;""" class Migration(BaseMigration): def needs_migration(self) -> bool: self.cur.execute( - "SELECT * FROM information_schema.tables WHERE table_name = 'authentik_policies_hibp_haveibeenpwendpolicy';" + "SELECT * FROM information_schema.tables WHERE table_name =" + " 'authentik_policies_hibp_haveibeenpwendpolicy';" ) return bool(self.cur.rowcount) diff --git a/poetry.lock b/poetry.lock index 3962e8a36..d1dae789f 100644 --- a/poetry.lock +++ b/poetry.lock @@ -381,29 +381,43 @@ files = [ [[package]] name = "black" -version = "22.12.0" +version = "23.1.0" description = "The uncompromising code formatter." category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "black-22.12.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9eedd20838bd5d75b80c9f5487dbcb06836a43833a37846cf1d8c1cc01cef59d"}, - {file = "black-22.12.0-cp310-cp310-win_amd64.whl", hash = "sha256:159a46a4947f73387b4d83e87ea006dbb2337eab6c879620a3ba52699b1f4351"}, - {file = "black-22.12.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d30b212bffeb1e252b31dd269dfae69dd17e06d92b87ad26e23890f3efea366f"}, - {file = "black-22.12.0-cp311-cp311-win_amd64.whl", hash = "sha256:7412e75863aa5c5411886804678b7d083c7c28421210180d67dfd8cf1221e1f4"}, - {file = "black-22.12.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c116eed0efb9ff870ded8b62fe9f28dd61ef6e9ddd28d83d7d264a38417dcee2"}, - {file = "black-22.12.0-cp37-cp37m-win_amd64.whl", hash = "sha256:1f58cbe16dfe8c12b7434e50ff889fa479072096d79f0a7f25e4ab8e94cd8350"}, - {file = "black-22.12.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:77d86c9f3db9b1bf6761244bc0b3572a546f5fe37917a044e02f3166d5aafa7d"}, - {file = "black-22.12.0-cp38-cp38-win_amd64.whl", hash = "sha256:82d9fe8fee3401e02e79767016b4907820a7dc28d70d137eb397b92ef3cc5bfc"}, - {file = "black-22.12.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:101c69b23df9b44247bd88e1d7e90154336ac4992502d4197bdac35dd7ee3320"}, - {file = "black-22.12.0-cp39-cp39-win_amd64.whl", hash = "sha256:559c7a1ba9a006226f09e4916060982fd27334ae1998e7a38b3f33a37f7a2148"}, - {file = "black-22.12.0-py3-none-any.whl", hash = "sha256:436cc9167dd28040ad90d3b404aec22cedf24a6e4d7de221bec2730ec0c97bcf"}, - {file = "black-22.12.0.tar.gz", hash = "sha256:229351e5a18ca30f447bf724d007f890f97e13af070bb6ad4c0a441cd7596a2f"}, + {file = "black-23.1.0-cp310-cp310-macosx_10_16_arm64.whl", hash = "sha256:b6a92a41ee34b883b359998f0c8e6eb8e99803aa8bf3123bf2b2e6fec505a221"}, + {file = "black-23.1.0-cp310-cp310-macosx_10_16_universal2.whl", hash = "sha256:57c18c5165c1dbe291d5306e53fb3988122890e57bd9b3dcb75f967f13411a26"}, + {file = "black-23.1.0-cp310-cp310-macosx_10_16_x86_64.whl", hash = "sha256:9880d7d419bb7e709b37e28deb5e68a49227713b623c72b2b931028ea65f619b"}, + {file = "black-23.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e6663f91b6feca5d06f2ccd49a10f254f9298cc1f7f49c46e498a0771b507104"}, + {file = "black-23.1.0-cp310-cp310-win_amd64.whl", hash = "sha256:9afd3f493666a0cd8f8df9a0200c6359ac53940cbde049dcb1a7eb6ee2dd7074"}, + {file = "black-23.1.0-cp311-cp311-macosx_10_16_arm64.whl", hash = "sha256:bfffba28dc52a58f04492181392ee380e95262af14ee01d4bc7bb1b1c6ca8d27"}, + {file = "black-23.1.0-cp311-cp311-macosx_10_16_universal2.whl", hash = "sha256:c1c476bc7b7d021321e7d93dc2cbd78ce103b84d5a4cf97ed535fbc0d6660648"}, + {file = "black-23.1.0-cp311-cp311-macosx_10_16_x86_64.whl", hash = "sha256:382998821f58e5c8238d3166c492139573325287820963d2f7de4d518bd76958"}, + {file = "black-23.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2bf649fda611c8550ca9d7592b69f0637218c2369b7744694c5e4902873b2f3a"}, + {file = "black-23.1.0-cp311-cp311-win_amd64.whl", hash = "sha256:121ca7f10b4a01fd99951234abdbd97728e1240be89fde18480ffac16503d481"}, + {file = "black-23.1.0-cp37-cp37m-macosx_10_16_x86_64.whl", hash = "sha256:a8471939da5e824b891b25751955be52ee7f8a30a916d570a5ba8e0f2eb2ecad"}, + {file = "black-23.1.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8178318cb74f98bc571eef19068f6ab5613b3e59d4f47771582f04e175570ed8"}, + {file = "black-23.1.0-cp37-cp37m-win_amd64.whl", hash = "sha256:a436e7881d33acaf2536c46a454bb964a50eff59b21b51c6ccf5a40601fbef24"}, + {file = "black-23.1.0-cp38-cp38-macosx_10_16_arm64.whl", hash = "sha256:a59db0a2094d2259c554676403fa2fac3473ccf1354c1c63eccf7ae65aac8ab6"}, + {file = "black-23.1.0-cp38-cp38-macosx_10_16_universal2.whl", hash = "sha256:0052dba51dec07ed029ed61b18183942043e00008ec65d5028814afaab9a22fd"}, + {file = "black-23.1.0-cp38-cp38-macosx_10_16_x86_64.whl", hash = "sha256:49f7b39e30f326a34b5c9a4213213a6b221d7ae9d58ec70df1c4a307cf2a1580"}, + {file = "black-23.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:162e37d49e93bd6eb6f1afc3e17a3d23a823042530c37c3c42eeeaf026f38468"}, + {file = "black-23.1.0-cp38-cp38-win_amd64.whl", hash = "sha256:8b70eb40a78dfac24842458476135f9b99ab952dd3f2dab738c1881a9b38b753"}, + {file = "black-23.1.0-cp39-cp39-macosx_10_16_arm64.whl", hash = "sha256:a29650759a6a0944e7cca036674655c2f0f63806ddecc45ed40b7b8aa314b651"}, + {file = "black-23.1.0-cp39-cp39-macosx_10_16_universal2.whl", hash = "sha256:bb460c8561c8c1bec7824ecbc3ce085eb50005883a6203dcfb0122e95797ee06"}, + {file = "black-23.1.0-cp39-cp39-macosx_10_16_x86_64.whl", hash = "sha256:c91dfc2c2a4e50df0026f88d2215e166616e0c80e86004d0003ece0488db2739"}, + {file = "black-23.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2a951cc83ab535d248c89f300eccbd625e80ab880fbcfb5ac8afb5f01a258ac9"}, + {file = "black-23.1.0-cp39-cp39-win_amd64.whl", hash = "sha256:0680d4380db3719ebcfb2613f34e86c8e6d15ffeabcf8ec59355c5e7b85bb555"}, + {file = "black-23.1.0-py3-none-any.whl", hash = "sha256:7a0f701d314cfa0896b9001df70a530eb2472babb76086344e688829efd97d32"}, + {file = "black-23.1.0.tar.gz", hash = "sha256:b0bd97bea8903f5a2ba7219257a44e3f1f9d00073d6cc1add68f0beec69692ac"}, ] [package.dependencies] click = ">=8.0.0" mypy-extensions = ">=0.4.3" +packaging = ">=22.0" pathspec = ">=0.9.0" platformdirs = ">=2" diff --git a/tests/e2e/test_provider_oauth2_github.py b/tests/e2e/test_provider_oauth2_github.py index 9d0cf6253..5e2b12bd6 100644 --- a/tests/e2e/test_provider_oauth2_github.py +++ b/tests/e2e/test_provider_oauth2_github.py @@ -165,7 +165,7 @@ class TestProviderOAuth2Github(SeleniumTestCase): ) consent_stage.find_element( By.CSS_SELECTOR, - ("[type=submit]"), + "[type=submit]", ).click() self.wait_for_url("http://localhost:3000/?orgId=1") diff --git a/tests/e2e/test_provider_oauth2_grafana.py b/tests/e2e/test_provider_oauth2_grafana.py index baa930daa..71dc24e24 100644 --- a/tests/e2e/test_provider_oauth2_grafana.py +++ b/tests/e2e/test_provider_oauth2_grafana.py @@ -50,16 +50,12 @@ class TestProviderOAuth2OAuth(SeleniumTestCase): "GF_AUTH_GENERIC_OAUTH_CLIENT_ID": self.client_id, "GF_AUTH_GENERIC_OAUTH_CLIENT_SECRET": self.client_secret, "GF_AUTH_GENERIC_OAUTH_SCOPES": "openid email profile", - "GF_AUTH_GENERIC_OAUTH_AUTH_URL": ( - self.url("authentik_providers_oauth2:authorize") - ), - "GF_AUTH_GENERIC_OAUTH_TOKEN_URL": (self.url("authentik_providers_oauth2:token")), - "GF_AUTH_GENERIC_OAUTH_API_URL": (self.url("authentik_providers_oauth2:userinfo")), - "GF_AUTH_SIGNOUT_REDIRECT_URL": ( - self.url( - "authentik_providers_oauth2:end-session", - application_slug=self.app_slug, - ) + "GF_AUTH_GENERIC_OAUTH_AUTH_URL": self.url("authentik_providers_oauth2:authorize"), + "GF_AUTH_GENERIC_OAUTH_TOKEN_URL": self.url("authentik_providers_oauth2:token"), + "GF_AUTH_GENERIC_OAUTH_API_URL": self.url("authentik_providers_oauth2:userinfo"), + "GF_AUTH_SIGNOUT_REDIRECT_URL": self.url( + "authentik_providers_oauth2:end-session", + application_slug=self.app_slug, ), "GF_LOG_LEVEL": "debug", }, @@ -304,7 +300,7 @@ class TestProviderOAuth2OAuth(SeleniumTestCase): ) consent_stage.find_element( By.CSS_SELECTOR, - ("[type=submit]"), + "[type=submit]", ).click() self.wait_for_url("http://localhost:3000/?orgId=1") diff --git a/tests/e2e/test_provider_oidc.py b/tests/e2e/test_provider_oidc.py index 3af2f4f09..a828c446f 100644 --- a/tests/e2e/test_provider_oidc.py +++ b/tests/e2e/test_provider_oidc.py @@ -218,7 +218,7 @@ class TestProviderOAuth2OIDC(SeleniumTestCase): ) consent_stage.find_element( By.CSS_SELECTOR, - ("[type=submit]"), + "[type=submit]", ).click() self.wait.until(ec.presence_of_element_located((By.CSS_SELECTOR, "pre"))) diff --git a/tests/e2e/test_provider_oidc_implicit.py b/tests/e2e/test_provider_oidc_implicit.py index a130acbe6..4fbdb92a4 100644 --- a/tests/e2e/test_provider_oidc_implicit.py +++ b/tests/e2e/test_provider_oidc_implicit.py @@ -214,7 +214,7 @@ class TestProviderOAuth2OIDCImplicit(SeleniumTestCase): ) consent_stage.find_element( By.CSS_SELECTOR, - ("[type=submit]"), + "[type=submit]", ).click() self.wait.until(ec.presence_of_element_located((By.CSS_SELECTOR, "pre"))) diff --git a/tests/e2e/test_provider_saml.py b/tests/e2e/test_provider_saml.py index 8be60fe19..d54a7304a 100644 --- a/tests/e2e/test_provider_saml.py +++ b/tests/e2e/test_provider_saml.py @@ -181,7 +181,7 @@ class TestProviderSAML(SeleniumTestCase): ) consent_stage.find_element( By.CSS_SELECTOR, - ("[type=submit]"), + "[type=submit]", ).click() self.wait_for_url("http://localhost:9009/") @@ -265,7 +265,7 @@ class TestProviderSAML(SeleniumTestCase): ) consent_stage.find_element( By.CSS_SELECTOR, - ("[type=submit]"), + "[type=submit]", ).click() self.wait_for_url("http://localhost:9009/") diff --git a/tests/e2e/test_source_oauth.py b/tests/e2e/test_source_oauth.py index 00acbee20..18c50a7b2 100644 --- a/tests/e2e/test_source_oauth.py +++ b/tests/e2e/test_source_oauth.py @@ -262,11 +262,9 @@ class TestSourceOAuth1(SeleniumTestCase): "environment": { "OAUTH1_CLIENT_ID": self.client_id, "OAUTH1_CLIENT_SECRET": self.client_secret, - "OAUTH1_REDIRECT_URI": ( - self.url( - "authentik_sources_oauth:oauth-client-callback", - source_slug=self.source_slug, - ) + "OAUTH1_REDIRECT_URI": self.url( + "authentik_sources_oauth:oauth-client-callback", + source_slug=self.source_slug, ), }, } diff --git a/tests/e2e/test_source_saml.py b/tests/e2e/test_source_saml.py index ca3e0fa4d..2d5a7efa9 100644 --- a/tests/e2e/test_source_saml.py +++ b/tests/e2e/test_source_saml.py @@ -226,7 +226,7 @@ class TestSourceSAML(SeleniumTestCase): ) consent_stage.find_element( By.CSS_SELECTOR, - ("[type=submit]"), + "[type=submit]", ).click() # Now we should be at the IDP, wait for the username field