flows: always mark component field as required in Challenge and ChallengeResponses

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2022-09-11 23:01:59 +02:00
parent 0ff2ac7dc2
commit b35b225453
2 changed files with 51 additions and 0 deletions

View file

@ -68,6 +68,10 @@ class Challenge(PassiveSerializer):
child=ErrorDetailSerializer(many=True), allow_empty=True, required=False child=ErrorDetailSerializer(many=True), allow_empty=True, required=False
) )
def __init__(self, instance=None, data=..., **kwargs):
super().__init__(instance, data, **kwargs)
self.fields["component"].required = True
class RedirectChallenge(Challenge): class RedirectChallenge(Challenge):
"""Challenge type to redirect the client""" """Challenge type to redirect the client"""
@ -148,6 +152,7 @@ class ChallengeResponse(PassiveSerializer):
def __init__(self, instance=None, data=None, **kwargs): def __init__(self, instance=None, data=None, **kwargs):
self.stage = kwargs.pop("stage", None) self.stage = kwargs.pop("stage", None)
super().__init__(instance=instance, data=data, **kwargs) super().__init__(instance=instance, data=data, **kwargs)
self.fields["component"].required = True
class AutosubmitChallenge(Challenge): class AutosubmitChallenge(Challenge):

View file

@ -24512,6 +24512,7 @@ components:
error_message: error_message:
type: string type: string
required: required:
- component
- pending_user - pending_user
- pending_user_avatar - pending_user_avatar
- type - type
@ -24583,6 +24584,8 @@ components:
type: string type: string
minLength: 1 minLength: 1
default: ak-flow-sources-oauth-apple default: ak-flow-sources-oauth-apple
required:
- component
AppleLoginChallenge: AppleLoginChallenge:
type: object type: object
description: Special challenge for apple-native authentication flow, which happens description: Special challenge for apple-native authentication flow, which happens
@ -24611,6 +24614,7 @@ components:
type: string type: string
required: required:
- client_id - client_id
- component
- redirect_uri - redirect_uri
- scope - scope
- state - state
@ -24934,6 +24938,7 @@ components:
required: required:
- activation_barcode - activation_barcode
- activation_code - activation_code
- component
- pending_user - pending_user
- pending_user_avatar - pending_user_avatar
- stage_uuid - stage_uuid
@ -24946,6 +24951,8 @@ components:
type: string type: string
minLength: 1 minLength: 1
default: ak-stage-authenticator-duo default: ak-stage-authenticator-duo
required:
- component
AuthenticatorDuoStage: AuthenticatorDuoStage:
type: object type: object
description: AuthenticatorDuoStage Serializer description: AuthenticatorDuoStage Serializer
@ -25049,6 +25056,7 @@ components:
type: boolean type: boolean
default: true default: true
required: required:
- component
- pending_user - pending_user
- pending_user_avatar - pending_user_avatar
- type - type
@ -25065,6 +25073,8 @@ components:
phone_number: phone_number:
type: string type: string
minLength: 1 minLength: 1
required:
- component
AuthenticatorSMSStage: AuthenticatorSMSStage:
type: object type: object
description: AuthenticatorSMSStage Serializer description: AuthenticatorSMSStage Serializer
@ -25196,6 +25206,7 @@ components:
type: string type: string
required: required:
- codes - codes
- component
- pending_user - pending_user
- pending_user_avatar - pending_user_avatar
- type - type
@ -25207,6 +25218,8 @@ components:
type: string type: string
minLength: 1 minLength: 1
default: ak-stage-authenticator-static default: ak-stage-authenticator-static
required:
- component
AuthenticatorStaticStage: AuthenticatorStaticStage:
type: object type: object
description: AuthenticatorStaticStage Serializer description: AuthenticatorStaticStage Serializer
@ -25298,6 +25311,7 @@ components:
config_url: config_url:
type: string type: string
required: required:
- component
- config_url - config_url
- pending_user - pending_user
- pending_user_avatar - pending_user_avatar
@ -25314,6 +25328,7 @@ components:
type: integer type: integer
required: required:
- code - code
- component
AuthenticatorTOTPStage: AuthenticatorTOTPStage:
type: object type: object
description: AuthenticatorTOTPStage Serializer description: AuthenticatorTOTPStage Serializer
@ -25501,6 +25516,7 @@ components:
items: items:
$ref: '#/components/schemas/SelectableStage' $ref: '#/components/schemas/SelectableStage'
required: required:
- component
- configuration_stages - configuration_stages
- device_challenges - device_challenges
- pending_user - pending_user
@ -25527,6 +25543,8 @@ components:
additionalProperties: {} additionalProperties: {}
duo: duo:
type: integer type: integer
required:
- component
AuthenticatorWebAuthnChallenge: AuthenticatorWebAuthnChallenge:
type: object type: object
description: WebAuthn Challenge description: WebAuthn Challenge
@ -25552,6 +25570,7 @@ components:
type: object type: object
additionalProperties: {} additionalProperties: {}
required: required:
- component
- pending_user - pending_user
- pending_user_avatar - pending_user_avatar
- registration - registration
@ -25568,6 +25587,7 @@ components:
type: object type: object
additionalProperties: {} additionalProperties: {}
required: required:
- component
- response - response
AutoSubmitChallengeResponseRequest: AutoSubmitChallengeResponseRequest:
type: object type: object
@ -25577,6 +25597,8 @@ components:
type: string type: string
minLength: 1 minLength: 1
default: ak-stage-autosubmit default: ak-stage-autosubmit
required:
- component
AutosubmitChallenge: AutosubmitChallenge:
type: object type: object
description: Autosubmit challenge used to send and navigate a POST request description: Autosubmit challenge used to send and navigate a POST request
@ -25604,6 +25626,7 @@ components:
type: string type: string
required: required:
- attrs - attrs
- component
- type - type
- url - url
BackendsEnum: BackendsEnum:
@ -25749,6 +25772,7 @@ components:
site_key: site_key:
type: string type: string
required: required:
- component
- pending_user - pending_user
- pending_user_avatar - pending_user_avatar
- site_key - site_key
@ -25765,6 +25789,7 @@ components:
type: string type: string
minLength: 1 minLength: 1
required: required:
- component
- token - token
CaptchaStage: CaptchaStage:
type: object type: object
@ -26052,6 +26077,7 @@ components:
type: string type: string
required: required:
- additional_permissions - additional_permissions
- component
- pending_user - pending_user
- pending_user_avatar - pending_user_avatar
- permissions - permissions
@ -26069,6 +26095,7 @@ components:
type: string type: string
minLength: 1 minLength: 1
required: required:
- component
- token - token
ConsentStage: ConsentStage:
type: object type: object
@ -26439,6 +26466,7 @@ components:
items: items:
$ref: '#/components/schemas/ErrorDetail' $ref: '#/components/schemas/ErrorDetail'
required: required:
- component
- type - type
DummyChallengeResponseRequest: DummyChallengeResponseRequest:
type: object type: object
@ -26448,6 +26476,8 @@ components:
type: string type: string
minLength: 1 minLength: 1
default: ak-stage-dummy default: ak-stage-dummy
required:
- component
DummyPolicy: DummyPolicy:
type: object type: object
description: Dummy Policy Serializer description: Dummy Policy Serializer
@ -26621,6 +26651,7 @@ components:
items: items:
$ref: '#/components/schemas/ErrorDetail' $ref: '#/components/schemas/ErrorDetail'
required: required:
- component
- type - type
EmailChallengeResponseRequest: EmailChallengeResponseRequest:
type: object type: object
@ -26632,6 +26663,8 @@ components:
type: string type: string
minLength: 1 minLength: 1
default: ak-stage-email default: ak-stage-email
required:
- component
EmailStage: EmailStage:
type: object type: object
description: EmailStage Serializer description: EmailStage Serializer
@ -27242,6 +27275,7 @@ components:
traceback: traceback:
type: string type: string
required: required:
- component
- pending_user - pending_user
- pending_user_avatar - pending_user_avatar
- request_id - request_id
@ -27687,6 +27721,7 @@ components:
show_source_labels: show_source_labels:
type: boolean type: boolean
required: required:
- component
- password_fields - password_fields
- primary_action - primary_action
- show_source_labels - show_source_labels
@ -27707,6 +27742,7 @@ components:
type: string type: string
nullable: true nullable: true
required: required:
- component
- uid_field - uid_field
IdentificationStage: IdentificationStage:
type: object type: object
@ -32161,6 +32197,7 @@ components:
recovery_url: recovery_url:
type: string type: string
required: required:
- component
- pending_user - pending_user
- pending_user_avatar - pending_user_avatar
- type - type
@ -32176,6 +32213,7 @@ components:
type: string type: string
minLength: 1 minLength: 1
required: required:
- component
- password - password
PasswordExpiryPolicy: PasswordExpiryPolicy:
type: object type: object
@ -34323,6 +34361,7 @@ components:
type: string type: string
required: required:
- client_id - client_id
- component
- slug - slug
- type - type
PlexAuthenticationChallengeResponseRequest: PlexAuthenticationChallengeResponseRequest:
@ -34333,6 +34372,8 @@ components:
type: string type: string
minLength: 1 minLength: 1
default: ak-flow-sources-plex default: ak-flow-sources-plex
required:
- component
PlexSource: PlexSource:
type: object type: object
description: Plex Source Serializer description: Plex Source Serializer
@ -34758,6 +34799,7 @@ components:
items: items:
$ref: '#/components/schemas/StagePrompt' $ref: '#/components/schemas/StagePrompt'
required: required:
- component
- fields - fields
- type - type
PromptChallengeResponseRequest: PromptChallengeResponseRequest:
@ -34770,6 +34812,8 @@ components:
type: string type: string
minLength: 1 minLength: 1
default: ak-stage-prompt default: ak-stage-prompt
required:
- component
additionalProperties: {} additionalProperties: {}
PromptRequest: PromptRequest:
type: object type: object
@ -35313,6 +35357,7 @@ components:
to: to:
type: string type: string
required: required:
- component
- to - to
- type - type
RefreshTokenModel: RefreshTokenModel:
@ -36184,6 +36229,7 @@ components:
type: string type: string
required: required:
- body - body
- component
- type - type
SignatureAlgorithmEnum: SignatureAlgorithmEnum:
enum: enum: