stages/prompt: annotate PromptChallengeResponse's additionalProperties

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-05-24 22:52:06 +02:00
parent af504e13a2
commit 8ecac59eca
4 changed files with 19 additions and 11 deletions

View file

@ -67,4 +67,11 @@ def postprocess_schema_responses(result, generator, **kwargs): # noqa: W0613
spectacular_settings.APPEND_COMPONENTS spectacular_settings.APPEND_COMPONENTS
) )
# This is a workaround for authentik/stages/prompt/stage.py
# since the serializer PromptChallengeResponse
# accepts dynamic keys
for component in result["components"]["schemas"]:
if component == "PromptChallengeResponseRequest":
comp = result["components"]["schemas"][component]
comp["additionalProperties"] = {}
return result return result

View file

@ -23321,6 +23321,7 @@ components:
component: component:
type: string type: string
default: ak-stage-prompt default: ak-stage-prompt
additionalProperties: {}
PromptRequest: PromptRequest:
type: object type: object
description: Prompt Serializer description: Prompt Serializer

View file

@ -160,7 +160,7 @@ export class IdentificationStage extends BaseStage<IdentificationChallenge, Iden
label=${label} label=${label}
?required="${true}" ?required="${true}"
class="pf-c-form__group" class="pf-c-form__group"
.errors=${(this.challenge?.responseErrors || {})["uidField"]}> .errors=${(this.challenge?.responseErrors || {})["uid_field"]}>
<!-- @ts-ignore --> <!-- @ts-ignore -->
<input type=${type} <input type=${type}
name="uidField" name="uidField"

View file

@ -108,16 +108,16 @@ export class PromptStage extends BaseStage<PromptChallenge, PromptChallengeRespo
return html``; return html``;
} }
return html`<div class="pf-c-form__alert"> return html`<div class="pf-c-form__alert">
${errors.map(err => { ${errors.map(err => {
return html`<div class="pf-c-alert pf-m-inline pf-m-danger"> return html`<div class="pf-c-alert pf-m-inline pf-m-danger">
<div class="pf-c-alert__icon"> <div class="pf-c-alert__icon">
<i class="fas fa-exclamation-circle"></i> <i class="fas fa-exclamation-circle"></i>
</div> </div>
<h4 class="pf-c-alert__title"> <h4 class="pf-c-alert__title">
${err.string} ${err.string}
</h4> </h4>
</div>`; </div>`;
})} })}
</div>`; </div>`;
} }