authentik.flows.exceptions
flow exceptions
1"""flow exceptions""" 2 3from django.utils.translation import gettext_lazy as _ 4 5from authentik.lib.sentry import SentryIgnoredException 6from authentik.policies.types import PolicyResult 7 8 9class FlowNonApplicableException(SentryIgnoredException): 10 """Flow does not apply to current user (denied by policy, or otherwise).""" 11 12 policy_result: PolicyResult | None = None 13 14 @property 15 def messages(self) -> str: 16 """Get messages from policy result, fallback to generic reason""" 17 if not self.policy_result or len(self.policy_result.messages) < 1: 18 return _("Flow does not apply to current user.") 19 return "\n".join(self.policy_result.messages) 20 21 22class EmptyFlowException(SentryIgnoredException): 23 """Flow has no stages.""" 24 25 26class FlowSkipStageException(SentryIgnoredException): 27 """Exception to skip a stage""" 28 29 30class StageInvalidException(SentryIgnoredException): 31 """Exception can be thrown in a `Challenge` or `ChallengeResponse` serializer's 32 validation to trigger a `executor.stage_invalid()` response"""
10class FlowNonApplicableException(SentryIgnoredException): 11 """Flow does not apply to current user (denied by policy, or otherwise).""" 12 13 policy_result: PolicyResult | None = None 14 15 @property 16 def messages(self) -> str: 17 """Get messages from policy result, fallback to generic reason""" 18 if not self.policy_result or len(self.policy_result.messages) < 1: 19 return _("Flow does not apply to current user.") 20 return "\n".join(self.policy_result.messages)
Flow does not apply to current user (denied by policy, or otherwise).
messages: str
15 @property 16 def messages(self) -> str: 17 """Get messages from policy result, fallback to generic reason""" 18 if not self.policy_result or len(self.policy_result.messages) < 1: 19 return _("Flow does not apply to current user.") 20 return "\n".join(self.policy_result.messages)
Get messages from policy result, fallback to generic reason
Flow has no stages.
Exception to skip a stage
31class StageInvalidException(SentryIgnoredException): 32 """Exception can be thrown in a `Challenge` or `ChallengeResponse` serializer's 33 validation to trigger a `executor.stage_invalid()` response"""
Exception can be thrown in a Challenge or ChallengeResponse serializer's
validation to trigger a executor.stage_invalid() response