authentik.enterprise.stages.source.models
Source stage models
1"""Source stage models""" 2 3from django.contrib.postgres.fields import ArrayField 4from django.db import models 5from django.utils.translation import gettext_lazy as _ 6from django.views import View 7from rest_framework.serializers import BaseSerializer 8 9from authentik.core.sources.matcher import MatchFailureReason 10from authentik.flows.models import Stage 11from authentik.lib.utils.time import timedelta_string_validator 12 13 14class SourceStage(Stage): 15 """Suspend the current flow execution and send the user to a federated source, 16 after which this flow execution is resumed.""" 17 18 source = models.ForeignKey("authentik_core.Source", on_delete=models.CASCADE) 19 20 resume_timeout = models.TextField( 21 default="minutes=10", 22 validators=[timedelta_string_validator], 23 help_text=_( 24 "Amount of time a user can take to return from the source to continue the flow " 25 "(Format: hours=-1;minutes=-2;seconds=-3)" 26 ), 27 ) 28 29 resume_on_match_failures = ArrayField( 30 models.TextField(choices=MatchFailureReason.choices), 31 default=list, 32 blank=True, 33 help_text=_("Source matching failure reasons for which the flow should resume."), 34 ) 35 36 @property 37 def serializer(self) -> type[BaseSerializer]: 38 from authentik.enterprise.stages.source.api import SourceStageSerializer 39 40 return SourceStageSerializer 41 42 @property 43 def view(self) -> type[View]: 44 from authentik.enterprise.stages.source.stage import SourceStageView 45 46 return SourceStageView 47 48 @property 49 def component(self) -> str: 50 return "ak-stage-source-form" 51 52 class Meta: 53 verbose_name = _("Source Stage") 54 verbose_name_plural = _("Source Stages")
15class SourceStage(Stage): 16 """Suspend the current flow execution and send the user to a federated source, 17 after which this flow execution is resumed.""" 18 19 source = models.ForeignKey("authentik_core.Source", on_delete=models.CASCADE) 20 21 resume_timeout = models.TextField( 22 default="minutes=10", 23 validators=[timedelta_string_validator], 24 help_text=_( 25 "Amount of time a user can take to return from the source to continue the flow " 26 "(Format: hours=-1;minutes=-2;seconds=-3)" 27 ), 28 ) 29 30 resume_on_match_failures = ArrayField( 31 models.TextField(choices=MatchFailureReason.choices), 32 default=list, 33 blank=True, 34 help_text=_("Source matching failure reasons for which the flow should resume."), 35 ) 36 37 @property 38 def serializer(self) -> type[BaseSerializer]: 39 from authentik.enterprise.stages.source.api import SourceStageSerializer 40 41 return SourceStageSerializer 42 43 @property 44 def view(self) -> type[View]: 45 from authentik.enterprise.stages.source.stage import SourceStageView 46 47 return SourceStageView 48 49 @property 50 def component(self) -> str: 51 return "ak-stage-source-form" 52 53 class Meta: 54 verbose_name = _("Source Stage") 55 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.
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.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
37 @property 38 def serializer(self) -> type[BaseSerializer]: 39 from authentik.enterprise.stages.source.api import SourceStageSerializer 40 41 return SourceStageSerializer
Get serializer for this model
43 @property 44 def view(self) -> type[View]: 45 from authentik.enterprise.stages.source.stage import SourceStageView 46 47 return SourceStageView
Return StageView class that implements logic for this stage
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.
Inherited Members
- authentik.flows.models.Stage
- stage_uuid
- name
- objects
- ui_user_settings
- is_in_memory
- flow_set
- flowstagebinding_set
- emailstage
- passwordstage
- endpointstage
- invitationstage
- promptstage
- authenticatorstaticstage
- authenticatorduostage
- authenticatoremailstage
- authenticatorsmsstage
- authenticatorwebauthnstage
- authenticatorvalidatestage
- authenticator_validate_stage_m2m_objects
- captchastage
- identificationstage
- authenticatortotpstage
- consentstage
- denystage
- dummystage
- redirectstage
- userdeletestage
- userloginstage
- userlogoutstage
- userwritestage
- accountlockdownstage
- authenticatorendpointgdtcstage
- mutualtlsstage
- sourcestage
The requested object does not exist
The query returned multiple objects when only one was expected.