authentik.enterprise.stages.source.models

Source stage models

 1"""Source stage models"""
 2
 3from django.db import models
 4from django.utils.translation import gettext_lazy as _
 5from django.views import View
 6from rest_framework.serializers import BaseSerializer
 7
 8from authentik.flows.models import Stage
 9from authentik.lib.utils.time import timedelta_string_validator
10
11
12class SourceStage(Stage):
13    """Suspend the current flow execution and send the user to a federated source,
14    after which this flow execution is resumed."""
15
16    source = models.ForeignKey("authentik_core.Source", on_delete=models.CASCADE)
17
18    resume_timeout = models.TextField(
19        default="minutes=10",
20        validators=[timedelta_string_validator],
21        help_text=_(
22            "Amount of time a user can take to return from the source to continue the flow "
23            "(Format: hours=-1;minutes=-2;seconds=-3)"
24        ),
25    )
26
27    @property
28    def serializer(self) -> type[BaseSerializer]:
29        from authentik.enterprise.stages.source.api import SourceStageSerializer
30
31        return SourceStageSerializer
32
33    @property
34    def view(self) -> type[View]:
35        from authentik.enterprise.stages.source.stage import SourceStageView
36
37        return SourceStageView
38
39    @property
40    def component(self) -> str:
41        return "ak-stage-source-form"
42
43    class Meta:
44        verbose_name = _("Source Stage")
45        verbose_name_plural = _("Source Stages")
class SourceStage(authentik.flows.models.Stage):
13class SourceStage(Stage):
14    """Suspend the current flow execution and send the user to a federated source,
15    after which this flow execution is resumed."""
16
17    source = models.ForeignKey("authentik_core.Source", on_delete=models.CASCADE)
18
19    resume_timeout = models.TextField(
20        default="minutes=10",
21        validators=[timedelta_string_validator],
22        help_text=_(
23            "Amount of time a user can take to return from the source to continue the flow "
24            "(Format: hours=-1;minutes=-2;seconds=-3)"
25        ),
26    )
27
28    @property
29    def serializer(self) -> type[BaseSerializer]:
30        from authentik.enterprise.stages.source.api import SourceStageSerializer
31
32        return SourceStageSerializer
33
34    @property
35    def view(self) -> type[View]:
36        from authentik.enterprise.stages.source.stage import SourceStageView
37
38        return SourceStageView
39
40    @property
41    def component(self) -> str:
42        return "ak-stage-source-form"
43
44    class Meta:
45        verbose_name = _("Source Stage")
46        verbose_name_plural = _("Source Stages")

Suspend the current flow execution and send the user to a federated source, after which this flow execution is resumed.

source

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example::

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

def resume_timeout(unknown):

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

serializer: type[rest_framework.serializers.BaseSerializer]
28    @property
29    def serializer(self) -> type[BaseSerializer]:
30        from authentik.enterprise.stages.source.api import SourceStageSerializer
31
32        return SourceStageSerializer

Get serializer for this model

view: type[django.views.generic.base.View]
34    @property
35    def view(self) -> type[View]:
36        from authentik.enterprise.stages.source.stage import SourceStageView
37
38        return SourceStageView

Return StageView class that implements logic for this stage

component: str
40    @property
41    def component(self) -> str:
42        return "ak-stage-source-form"

Return component used to edit this object

source_id
stage_ptr_id
stage_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example::

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

class SourceStage.DoesNotExist(authentik.flows.models.Stage.DoesNotExist):

The requested object does not exist

class SourceStage.MultipleObjectsReturned(authentik.flows.models.Stage.MultipleObjectsReturned):

The query returned multiple objects when only one was expected.