authentik.enterprise.stages.account_lockdown.models
Account lockdown stage models
1"""Account lockdown 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 9 10 11class AccountLockdownStage(Stage): 12 """Lock down a target user account.""" 13 14 deactivate_user = models.BooleanField( 15 default=True, 16 help_text=_("Deactivate the user account (set is_active to False)"), 17 ) 18 set_unusable_password = models.BooleanField( 19 default=True, 20 help_text=_("Set an unusable password for the user"), 21 ) 22 delete_sessions = models.BooleanField( 23 default=True, 24 help_text=_("Delete all active sessions for the user"), 25 ) 26 revoke_tokens = models.BooleanField( 27 default=True, 28 help_text=_( 29 "Revoke all tokens for the user (API, app password, recovery, verification, OAuth)" 30 ), 31 ) 32 self_service_completion_flow = models.ForeignKey( 33 "authentik_flows.Flow", 34 on_delete=models.SET_NULL, 35 null=True, 36 blank=True, 37 related_name="account_lockdown_stages", 38 help_text=_( 39 "Flow to redirect users to after self-service lockdown. " 40 "This flow should not require authentication since the user's session is deleted." 41 ), 42 ) 43 44 @property 45 def serializer(self) -> type[BaseSerializer]: 46 from authentik.enterprise.stages.account_lockdown.api import AccountLockdownStageSerializer 47 48 return AccountLockdownStageSerializer 49 50 @property 51 def view(self) -> type[View]: 52 from authentik.enterprise.stages.account_lockdown.stage import AccountLockdownStageView 53 54 return AccountLockdownStageView 55 56 @property 57 def component(self) -> str: 58 return "ak-stage-account-lockdown-form" 59 60 class Meta: 61 verbose_name = _("Account Lockdown Stage") 62 verbose_name_plural = _("Account Lockdown Stages")
12class AccountLockdownStage(Stage): 13 """Lock down a target user account.""" 14 15 deactivate_user = models.BooleanField( 16 default=True, 17 help_text=_("Deactivate the user account (set is_active to False)"), 18 ) 19 set_unusable_password = models.BooleanField( 20 default=True, 21 help_text=_("Set an unusable password for the user"), 22 ) 23 delete_sessions = models.BooleanField( 24 default=True, 25 help_text=_("Delete all active sessions for the user"), 26 ) 27 revoke_tokens = models.BooleanField( 28 default=True, 29 help_text=_( 30 "Revoke all tokens for the user (API, app password, recovery, verification, OAuth)" 31 ), 32 ) 33 self_service_completion_flow = models.ForeignKey( 34 "authentik_flows.Flow", 35 on_delete=models.SET_NULL, 36 null=True, 37 blank=True, 38 related_name="account_lockdown_stages", 39 help_text=_( 40 "Flow to redirect users to after self-service lockdown. " 41 "This flow should not require authentication since the user's session is deleted." 42 ), 43 ) 44 45 @property 46 def serializer(self) -> type[BaseSerializer]: 47 from authentik.enterprise.stages.account_lockdown.api import AccountLockdownStageSerializer 48 49 return AccountLockdownStageSerializer 50 51 @property 52 def view(self) -> type[View]: 53 from authentik.enterprise.stages.account_lockdown.stage import AccountLockdownStageView 54 55 return AccountLockdownStageView 56 57 @property 58 def component(self) -> str: 59 return "ak-stage-account-lockdown-form" 60 61 class Meta: 62 verbose_name = _("Account Lockdown Stage") 63 verbose_name_plural = _("Account Lockdown Stages")
Lock down a target user account.
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.
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.
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.
45 @property 46 def serializer(self) -> type[BaseSerializer]: 47 from authentik.enterprise.stages.account_lockdown.api import AccountLockdownStageSerializer 48 49 return AccountLockdownStageSerializer
Get serializer for this model
51 @property 52 def view(self) -> type[View]: 53 from authentik.enterprise.stages.account_lockdown.stage import AccountLockdownStageView 54 55 return AccountLockdownStageView
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
- endpointstage
- invitationstage
- passwordstage
- promptstage
- authenticatorstaticstage
- authenticatorduostage
- authenticatoremailstage
- authenticatorsmsstage
- authenticatorwebauthnstage
- authenticatorvalidatestage
- 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.