From 127ebed5c61aadccca09e9d94d863028764099f5 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 24 May 2021 21:09:18 +0200 Subject: [PATCH] flows: fix mismatched names Signed-off-by: Jens Langhammer --- authentik/flows/views.py | 4 +- outpost/pkg/ldap/instance_bind.go | 6 +- schema.yml | 82 +++++++++---------- web/src/flows/FlowExecutor.ts | 8 +- .../identification/IdentificationStage.ts | 5 +- 5 files changed, 53 insertions(+), 52 deletions(-) diff --git a/authentik/flows/views.py b/authentik/flows/views.py index 9035cb88e..33490ae89 100644 --- a/authentik/flows/views.py +++ b/authentik/flows/views.py @@ -171,7 +171,7 @@ class FlowExecutorView(APIView): @extend_schema( responses={ 200: PolymorphicProxySerializer( - component_name="Challenge", + component_name="FlowChallengeRequest", serializers=challenge_types(), resource_type_field_name="component", ), @@ -209,7 +209,7 @@ class FlowExecutorView(APIView): @extend_schema( responses={ 200: PolymorphicProxySerializer( - component_name="Challenge", + component_name="FlowChallengeRequest", serializers=challenge_types(), resource_type_field_name="component", ), diff --git a/outpost/pkg/ldap/instance_bind.go b/outpost/pkg/ldap/instance_bind.go index f09b8dc30..aaa8909ef 100644 --- a/outpost/pkg/ldap/instance_bind.go +++ b/outpost/pkg/ldap/instance_bind.go @@ -150,9 +150,9 @@ func (pi *ProviderInstance) solveFlowChallenge(bindDN string, password string, c responseReq := client.FlowsApi.FlowsExecutorSolve(context.Background(), pi.flowSlug).Query(urlParams) switch ch.GetComponent() { case "ak-stage-identification": - responseReq = responseReq.ChallengeResponseRequest(api.IdentificationChallengeResponseRequestAsChallengeResponseRequest(api.NewIdentificationChallengeResponseRequest(bindDN))) + responseReq = responseReq.FlowChallengeResponseRequest(api.IdentificationChallengeResponseRequestAsFlowChallengeResponseRequest(api.NewIdentificationChallengeResponseRequest(bindDN))) case "ak-stage-password": - responseReq = responseReq.ChallengeResponseRequest(api.PasswordChallengeResponseRequestAsChallengeResponseRequest(api.NewPasswordChallengeResponseRequest(password))) + responseReq = responseReq.FlowChallengeResponseRequest(api.PasswordChallengeResponseRequestAsFlowChallengeResponseRequest(api.NewPasswordChallengeResponseRequest(password))) case "ak-stage-authenticator-validate": // We only support duo as authenticator, check if that's allowed var deviceChallenge *api.DeviceChallenge @@ -171,7 +171,7 @@ func (pi *ProviderInstance) solveFlowChallenge(bindDN string, password string, c devId32 := int32(devId) inner := api.NewAuthenticatorValidationChallengeResponseRequest() inner.Duo = &devId32 - responseReq = responseReq.ChallengeResponseRequest(api.AuthenticatorValidationChallengeResponseRequestAsChallengeResponseRequest(inner)) + responseReq = responseReq.FlowChallengeResponseRequest(api.AuthenticatorValidationChallengeResponseRequestAsFlowChallengeResponseRequest(inner)) case "ak-stage-access-denied": return false, errors.New("got ak-stage-access-denied") default: diff --git a/schema.yml b/schema.yml index 5b73f2570..b5c1abaae 100644 --- a/schema.yml +++ b/schema.yml @@ -3520,7 +3520,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Challenge' + $ref: '#/components/schemas/FlowChallengeRequest' description: '' '404': description: No Token found @@ -3566,7 +3566,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Challenge' + $ref: '#/components/schemas/FlowChallengeRequest' description: '' '400': $ref: '#/components/schemas/ValidationError' @@ -15865,45 +15865,6 @@ components: required: - certificate_data - name - Challenge: - oneOf: - - $ref: '#/components/schemas/AccessDeniedChallenge' - - $ref: '#/components/schemas/AuthenticatorDuoChallenge' - - $ref: '#/components/schemas/AuthenticatorStaticChallenge' - - $ref: '#/components/schemas/AuthenticatorTOTPChallenge' - - $ref: '#/components/schemas/AuthenticatorValidationChallenge' - - $ref: '#/components/schemas/AuthenticatorWebAuthnChallenge' - - $ref: '#/components/schemas/AutosubmitChallenge' - - $ref: '#/components/schemas/CaptchaChallenge' - - $ref: '#/components/schemas/ConsentChallenge' - - $ref: '#/components/schemas/DummyChallenge' - - $ref: '#/components/schemas/EmailChallenge' - - $ref: '#/components/schemas/IdentificationChallenge' - - $ref: '#/components/schemas/PasswordChallenge' - - $ref: '#/components/schemas/PlexAuthenticationChallenge' - - $ref: '#/components/schemas/PromptChallenge' - - $ref: '#/components/schemas/RedirectChallenge' - - $ref: '#/components/schemas/ShellChallenge' - discriminator: - propertyName: component - mapping: - ak-stage-access-denied: '#/components/schemas/AccessDeniedChallenge' - ak-stage-authenticator-duo: '#/components/schemas/AuthenticatorDuoChallenge' - ak-stage-authenticator-static: '#/components/schemas/AuthenticatorStaticChallenge' - ak-stage-authenticator-totp: '#/components/schemas/AuthenticatorTOTPChallenge' - ak-stage-authenticator-validate: '#/components/schemas/AuthenticatorValidationChallenge' - ak-stage-authenticator-webauthn: '#/components/schemas/AuthenticatorWebAuthnChallenge' - ak-stage-autosubmit: '#/components/schemas/AutosubmitChallenge' - ak-stage-captcha: '#/components/schemas/CaptchaChallenge' - ak-stage-consent: '#/components/schemas/ConsentChallenge' - ak-stage-dummy: '#/components/schemas/DummyChallenge' - ak-stage-email: '#/components/schemas/EmailChallenge' - ak-stage-identification: '#/components/schemas/IdentificationChallenge' - ak-stage-password: '#/components/schemas/PasswordChallenge' - ak-flow-sources-plex: '#/components/schemas/PlexAuthenticationChallenge' - ak-stage-prompt: '#/components/schemas/PromptChallenge' - xak-flow-redirect: '#/components/schemas/RedirectChallenge' - xak-flow-shell: '#/components/schemas/ShellChallenge' ChallengeChoices: enum: - native @@ -16792,6 +16753,45 @@ components: - slug - stages - title + FlowChallengeRequest: + oneOf: + - $ref: '#/components/schemas/AccessDeniedChallenge' + - $ref: '#/components/schemas/AuthenticatorDuoChallenge' + - $ref: '#/components/schemas/AuthenticatorStaticChallenge' + - $ref: '#/components/schemas/AuthenticatorTOTPChallenge' + - $ref: '#/components/schemas/AuthenticatorValidationChallenge' + - $ref: '#/components/schemas/AuthenticatorWebAuthnChallenge' + - $ref: '#/components/schemas/AutosubmitChallenge' + - $ref: '#/components/schemas/CaptchaChallenge' + - $ref: '#/components/schemas/ConsentChallenge' + - $ref: '#/components/schemas/DummyChallenge' + - $ref: '#/components/schemas/EmailChallenge' + - $ref: '#/components/schemas/IdentificationChallenge' + - $ref: '#/components/schemas/PasswordChallenge' + - $ref: '#/components/schemas/PlexAuthenticationChallenge' + - $ref: '#/components/schemas/PromptChallenge' + - $ref: '#/components/schemas/RedirectChallenge' + - $ref: '#/components/schemas/ShellChallenge' + discriminator: + propertyName: component + mapping: + ak-stage-access-denied: '#/components/schemas/AccessDeniedChallenge' + ak-stage-authenticator-duo: '#/components/schemas/AuthenticatorDuoChallenge' + ak-stage-authenticator-static: '#/components/schemas/AuthenticatorStaticChallenge' + ak-stage-authenticator-totp: '#/components/schemas/AuthenticatorTOTPChallenge' + ak-stage-authenticator-validate: '#/components/schemas/AuthenticatorValidationChallenge' + ak-stage-authenticator-webauthn: '#/components/schemas/AuthenticatorWebAuthnChallenge' + ak-stage-autosubmit: '#/components/schemas/AutosubmitChallenge' + ak-stage-captcha: '#/components/schemas/CaptchaChallenge' + ak-stage-consent: '#/components/schemas/ConsentChallenge' + ak-stage-dummy: '#/components/schemas/DummyChallenge' + ak-stage-email: '#/components/schemas/EmailChallenge' + ak-stage-identification: '#/components/schemas/IdentificationChallenge' + ak-stage-password: '#/components/schemas/PasswordChallenge' + ak-flow-sources-plex: '#/components/schemas/PlexAuthenticationChallenge' + ak-stage-prompt: '#/components/schemas/PromptChallenge' + xak-flow-redirect: '#/components/schemas/RedirectChallenge' + xak-flow-shell: '#/components/schemas/ShellChallenge' FlowChallengeResponseRequest: oneOf: - $ref: '#/components/schemas/AuthenticatorDuoChallengeResponseRequest' diff --git a/web/src/flows/FlowExecutor.ts b/web/src/flows/FlowExecutor.ts index 4688b833b..29c437121 100644 --- a/web/src/flows/FlowExecutor.ts +++ b/web/src/flows/FlowExecutor.ts @@ -26,14 +26,14 @@ import "./stages/password/PasswordStage"; import "./stages/prompt/PromptStage"; import "./sources/plex/PlexLoginInit"; import { StageHost } from "./stages/base"; -import { Challenge, ChallengeChoices, Config, FlowsApi, RedirectChallenge, ShellChallenge } from "authentik-api"; +import { ChallengeChoices, ChallengeResponseRequest, Config, FlowsApi, RedirectChallenge, ShellChallenge } from "authentik-api"; import { config, DEFAULT_CONFIG } from "../api/Config"; import { ifDefined } from "lit-html/directives/if-defined"; import { until } from "lit-html/directives/until"; import { PFSize } from "../elements/Spinner"; import { TITLE_DEFAULT } from "../constants"; import { configureSentry } from "../api/Sentry"; -import { ChallengeResponseRequest } from "authentik-api/dist/models/ChallengeResponseRequest"; +import { FlowChallengeRequest } from "authentik-api/src/models/FlowChallengeRequest"; import { FlowChallengeResponseRequest } from "authentik-api/src"; @@ -43,7 +43,7 @@ export class FlowExecutor extends LitElement implements StageHost { flowSlug: string; @property({attribute: false}) - challenge?: Challenge; + challenge?: FlowChallengeRequest; @property({type: Boolean}) loading = false; @@ -162,7 +162,7 @@ export class FlowExecutor extends LitElement implements StageHost { ` - } as Challenge; + } as FlowChallengeRequest; } renderLoading(): TemplateResult { diff --git a/web/src/flows/stages/identification/IdentificationStage.ts b/web/src/flows/stages/identification/IdentificationStage.ts index 4a340afbd..641fce3d6 100644 --- a/web/src/flows/stages/identification/IdentificationStage.ts +++ b/web/src/flows/stages/identification/IdentificationStage.ts @@ -10,7 +10,8 @@ import PFBase from "@patternfly/patternfly/patternfly-base.css"; import AKGlobal from "../../../authentik.css"; import "../../../elements/forms/FormElement"; import "../../../elements/EmptyState"; -import { Challenge, IdentificationChallenge, IdentificationChallengeResponseRequest, UILoginButton } from "authentik-api"; +import { IdentificationChallenge, IdentificationChallengeResponseRequest, UILoginButton } from "authentik-api"; +import { FlowChallengeRequest } from "authentik-api/src/models/FlowChallengeRequest"; export const PasswordManagerPrefill: { password: string | undefined; @@ -116,7 +117,7 @@ export class IdentificationStage extends BaseStage