providers/saml: add title attribute to autosubmit stage and render correctly
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
8ba45a5f6a
commit
ddd785898b
|
@ -4,6 +4,7 @@ from django.http import HttpRequest, HttpResponse
|
||||||
from django.http.response import HttpResponseBadRequest
|
from django.http.response import HttpResponseBadRequest
|
||||||
from django.shortcuts import get_object_or_404, redirect
|
from django.shortcuts import get_object_or_404, redirect
|
||||||
from django.utils.http import urlencode
|
from django.utils.http import urlencode
|
||||||
|
from django.utils.translation import gettext as _
|
||||||
from rest_framework.fields import CharField, DictField
|
from rest_framework.fields import CharField, DictField
|
||||||
from structlog.stdlib import get_logger
|
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.processors.request_parser import AuthNRequest
|
||||||
from authentik.providers.saml.utils.encoding import deflate_and_base64_encode, nice64
|
from authentik.providers.saml.utils.encoding import deflate_and_base64_encode, nice64
|
||||||
from authentik.sources.saml.exceptions import SAMLException
|
from authentik.sources.saml.exceptions import SAMLException
|
||||||
|
from authentik.sources.saml.views import PLAN_CONTEXT_TITLE
|
||||||
|
|
||||||
LOGGER = get_logger()
|
LOGGER = get_logger()
|
||||||
URL_VALIDATOR = URLValidator(schemes=("http", "https"))
|
URL_VALIDATOR = URLValidator(schemes=("http", "https"))
|
||||||
|
@ -35,6 +37,7 @@ class AutosubmitChallenge(Challenge):
|
||||||
|
|
||||||
url = CharField()
|
url = CharField()
|
||||||
attrs = DictField(child=CharField())
|
attrs = DictField(child=CharField())
|
||||||
|
title = CharField(required=False)
|
||||||
component = CharField(default="ak-stage-autosubmit")
|
component = CharField(default="ak-stage-autosubmit")
|
||||||
|
|
||||||
|
|
||||||
|
@ -88,7 +91,12 @@ class SAMLFlowFinalView(ChallengeStageView):
|
||||||
**{
|
**{
|
||||||
"type": ChallengeTypes.NATIVE.value,
|
"type": ChallengeTypes.NATIVE.value,
|
||||||
"component": "ak-stage-autosubmit",
|
"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,
|
"url": provider.acs_url,
|
||||||
"attrs": form_attrs,
|
"attrs": form_attrs,
|
||||||
},
|
},
|
||||||
|
|
|
@ -19342,10 +19342,10 @@ components:
|
||||||
type: string
|
type: string
|
||||||
lat:
|
lat:
|
||||||
type: number
|
type: number
|
||||||
format: float
|
format: double
|
||||||
long:
|
long:
|
||||||
type: number
|
type: number
|
||||||
format: float
|
format: double
|
||||||
city:
|
city:
|
||||||
type: string
|
type: string
|
||||||
required:
|
required:
|
||||||
|
@ -20067,6 +20067,8 @@ components:
|
||||||
type: object
|
type: object
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
type: string
|
type: string
|
||||||
|
title:
|
||||||
|
type: string
|
||||||
required:
|
required:
|
||||||
- attrs
|
- attrs
|
||||||
- type
|
- type
|
||||||
|
@ -29234,7 +29236,7 @@ components:
|
||||||
type: string
|
type: string
|
||||||
token_validity:
|
token_validity:
|
||||||
type: number
|
type: number
|
||||||
format: float
|
format: double
|
||||||
nullable: true
|
nullable: true
|
||||||
readOnly: true
|
readOnly: true
|
||||||
scopes_to_request:
|
scopes_to_request:
|
||||||
|
|
|
@ -35,8 +35,12 @@ export class AutosubmitStage extends BaseStage<
|
||||||
if (!this.challenge) {
|
if (!this.challenge) {
|
||||||
return html`<ak-empty-state ?loading="${true}" header=${t`Loading`}> </ak-empty-state>`;
|
return html`<ak-empty-state ?loading="${true}" header=${t`Loading`}> </ak-empty-state>`;
|
||||||
}
|
}
|
||||||
|
let title = this.challenge.flowInfo?.title;
|
||||||
|
if (this.challenge.title && this.challenge.title !== "") {
|
||||||
|
title = this.challenge.title;
|
||||||
|
}
|
||||||
return html`<header class="pf-c-login__main-header">
|
return html`<header class="pf-c-login__main-header">
|
||||||
<h1 class="pf-c-title pf-m-3xl">${this.challenge.flowInfo?.title}</h1>
|
<h1 class="pf-c-title pf-m-3xl">${title}</h1>
|
||||||
</header>
|
</header>
|
||||||
<div class="pf-c-login__main-body">
|
<div class="pf-c-login__main-body">
|
||||||
<form class="pf-c-form" action="${this.challenge.url}" method="POST">
|
<form class="pf-c-form" action="${this.challenge.url}" method="POST">
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue