authentik.enterprise.stages.mtls.migrations.0001_initial

 1# Generated by Django 5.1.9 on 2025-05-19 18:29
 2
 3import django.db.models.deletion
 4from django.db import migrations, models
 5
 6
 7class Migration(migrations.Migration):
 8
 9    initial = True
10
11    dependencies = [
12        ("authentik_crypto", "0004_alter_certificatekeypair_name"),
13        ("authentik_flows", "0027_auto_20231028_1424"),
14    ]
15
16    operations = [
17        migrations.CreateModel(
18            name="MutualTLSStage",
19            fields=[
20                (
21                    "stage_ptr",
22                    models.OneToOneField(
23                        auto_created=True,
24                        on_delete=django.db.models.deletion.CASCADE,
25                        parent_link=True,
26                        primary_key=True,
27                        serialize=False,
28                        to="authentik_flows.stage",
29                    ),
30                ),
31                (
32                    "mode",
33                    models.TextField(choices=[("optional", "Optional"), ("required", "Required")]),
34                ),
35                (
36                    "cert_attribute",
37                    models.TextField(
38                        choices=[
39                            ("subject", "Subject"),
40                            ("common_name", "Common Name"),
41                            ("email", "Email"),
42                        ]
43                    ),
44                ),
45                (
46                    "user_attribute",
47                    models.TextField(choices=[("username", "Username"), ("email", "Email")]),
48                ),
49                (
50                    "certificate_authorities",
51                    models.ManyToManyField(
52                        blank=True,
53                        default=None,
54                        help_text="Configure certificate authorities to validate the certificate against. This option has a higher priority than the `client_certificate` option on `Brand`.",
55                        to="authentik_crypto.certificatekeypair",
56                    ),
57                ),
58            ],
59            options={
60                "verbose_name": "Mutual TLS Stage",
61                "verbose_name_plural": "Mutual TLS Stages",
62                "permissions": [
63                    ("pass_outpost_certificate", "Permissions to pass Certificates for outposts.")
64                ],
65            },
66            bases=("authentik_flows.stage",),
67        ),
68    ]
class Migration(django.db.migrations.migration.Migration):
 8class Migration(migrations.Migration):
 9
10    initial = True
11
12    dependencies = [
13        ("authentik_crypto", "0004_alter_certificatekeypair_name"),
14        ("authentik_flows", "0027_auto_20231028_1424"),
15    ]
16
17    operations = [
18        migrations.CreateModel(
19            name="MutualTLSStage",
20            fields=[
21                (
22                    "stage_ptr",
23                    models.OneToOneField(
24                        auto_created=True,
25                        on_delete=django.db.models.deletion.CASCADE,
26                        parent_link=True,
27                        primary_key=True,
28                        serialize=False,
29                        to="authentik_flows.stage",
30                    ),
31                ),
32                (
33                    "mode",
34                    models.TextField(choices=[("optional", "Optional"), ("required", "Required")]),
35                ),
36                (
37                    "cert_attribute",
38                    models.TextField(
39                        choices=[
40                            ("subject", "Subject"),
41                            ("common_name", "Common Name"),
42                            ("email", "Email"),
43                        ]
44                    ),
45                ),
46                (
47                    "user_attribute",
48                    models.TextField(choices=[("username", "Username"), ("email", "Email")]),
49                ),
50                (
51                    "certificate_authorities",
52                    models.ManyToManyField(
53                        blank=True,
54                        default=None,
55                        help_text="Configure certificate authorities to validate the certificate against. This option has a higher priority than the `client_certificate` option on `Brand`.",
56                        to="authentik_crypto.certificatekeypair",
57                    ),
58                ),
59            ],
60            options={
61                "verbose_name": "Mutual TLS Stage",
62                "verbose_name_plural": "Mutual TLS Stages",
63                "permissions": [
64                    ("pass_outpost_certificate", "Permissions to pass Certificates for outposts.")
65                ],
66            },
67            bases=("authentik_flows.stage",),
68        ),
69    ]

The base class for all migrations.

Migration files will import this from django.db.migrations.Migration and subclass it as a class called Migration. It will have one or more of the following attributes:

  • operations: A list of Operation instances, probably from django.db.migrations.operations
  • dependencies: A list of tuples of (app_path, migration_name)
  • run_before: A list of tuples of (app_path, migration_name)
  • replaces: A list of migration_names

Note that all migrations come out of migrations and into the Loader or Graph as instances, having been initialized with their app label and name.

initial = True
dependencies = [('authentik_crypto', '0004_alter_certificatekeypair_name'), ('authentik_flows', '0027_auto_20231028_1424')]
operations = [<CreateModel name='MutualTLSStage', fields=[('stage_ptr', <django.db.models.fields.related.OneToOneField>), ('mode', <django.db.models.fields.TextField>), ('cert_attribute', <django.db.models.fields.TextField>), ('user_attribute', <django.db.models.fields.TextField>), ('certificate_authorities', <django.db.models.fields.related.ManyToManyField>)], options={'verbose_name': 'Mutual TLS Stage', 'verbose_name_plural': 'Mutual TLS Stages', 'permissions': [('pass_outpost_certificate', 'Permissions to pass Certificates for outposts.')]}, bases=('authentik_flows.stage',)>]