From ddd785898b6e6c41b085333cbe2980d339b7361c Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sat, 14 May 2022 00:08:14 +0200 Subject: [PATCH] providers/saml: add title attribute to autosubmit stage and render correctly Signed-off-by: Jens Langhammer --- authentik/providers/saml/views/flows.py | 10 +- schema.yml | 8 +- .../stages/autosubmit/AutosubmitStage.ts | 6 +- web/src/locales/en.po | 186 +-- web/src/locales/fr_FR.po | 68 +- web/src/locales/pseudo-LOCALE.po | 186 +-- web/src/locales/zh-Hans.po | 1430 ++++++++--------- 7 files changed, 875 insertions(+), 1019 deletions(-) diff --git a/authentik/providers/saml/views/flows.py b/authentik/providers/saml/views/flows.py index 1964d5c86..d0b3841fa 100644 --- a/authentik/providers/saml/views/flows.py +++ b/authentik/providers/saml/views/flows.py @@ -4,6 +4,7 @@ from django.http import HttpRequest, HttpResponse from django.http.response import HttpResponseBadRequest from django.shortcuts import get_object_or_404, redirect from django.utils.http import urlencode +from django.utils.translation import gettext as _ from rest_framework.fields import CharField, DictField from structlog.stdlib import get_logger @@ -18,6 +19,7 @@ from authentik.providers.saml.processors.assertion import AssertionProcessor from authentik.providers.saml.processors.request_parser import AuthNRequest from authentik.providers.saml.utils.encoding import deflate_and_base64_encode, nice64 from authentik.sources.saml.exceptions import SAMLException +from authentik.sources.saml.views import PLAN_CONTEXT_TITLE LOGGER = get_logger() URL_VALIDATOR = URLValidator(schemes=("http", "https")) @@ -35,6 +37,7 @@ class AutosubmitChallenge(Challenge): url = CharField() attrs = DictField(child=CharField()) + title = CharField(required=False) component = CharField(default="ak-stage-autosubmit") @@ -88,7 +91,12 @@ class SAMLFlowFinalView(ChallengeStageView): **{ "type": ChallengeTypes.NATIVE.value, "component": "ak-stage-autosubmit", - "title": "Redirecting to %(app)s..." % {"app": application.name}, + "title": ( + self.executor.plan.context.get( + PLAN_CONTEXT_TITLE, + _("Redirecting to %(app)s..." % {"app": application.name}), + ) + ), "url": provider.acs_url, "attrs": form_attrs, }, diff --git a/schema.yml b/schema.yml index 41ce3f6f8..b296ff830 100644 --- a/schema.yml +++ b/schema.yml @@ -19342,10 +19342,10 @@ components: type: string lat: type: number - format: float + format: double long: type: number - format: float + format: double city: type: string required: @@ -20067,6 +20067,8 @@ components: type: object additionalProperties: type: string + title: + type: string required: - attrs - type @@ -29234,7 +29236,7 @@ components: type: string token_validity: type: number - format: float + format: double nullable: true readOnly: true scopes_to_request: diff --git a/web/src/flows/stages/autosubmit/AutosubmitStage.ts b/web/src/flows/stages/autosubmit/AutosubmitStage.ts index 1af16b841..aa28b8a58 100644 --- a/web/src/flows/stages/autosubmit/AutosubmitStage.ts +++ b/web/src/flows/stages/autosubmit/AutosubmitStage.ts @@ -35,8 +35,12 @@ export class AutosubmitStage extends BaseStage< if (!this.challenge) { return html` `; } + let title = this.challenge.flowInfo?.title; + if (this.challenge.title && this.challenge.title !== "") { + title = this.challenge.title; + } return html`