mirror of
https://github.com/goauthentik/authentik.git
synced 2026-06-17 19:09:11 +03:00
providers/saml: Add sls to saml overview (#22183)
* providers/saml: clean up provider overview page * clean up logout option rendering
This commit is contained in:
@@ -15,6 +15,7 @@ import {
|
||||
availableHashes,
|
||||
DEFAULT_HASH_ALGORITHM,
|
||||
digestAlgorithmOptions,
|
||||
logoutMethodOptions,
|
||||
retrieveSignatureAlgorithm,
|
||||
SAMLSupportedKeyTypes,
|
||||
} from "./SAMLProviderOptions.js";
|
||||
@@ -29,7 +30,6 @@ import {
|
||||
PropertymappingsApi,
|
||||
PropertymappingsProviderSamlListRequest,
|
||||
SAMLBindingsEnum,
|
||||
SAMLLogoutMethods,
|
||||
SAMLNameIDPolicyEnum,
|
||||
SAMLPropertyMapping,
|
||||
SAMLProvider,
|
||||
@@ -90,23 +90,6 @@ function renderHasSlsUrl(
|
||||
logoutMethod: string,
|
||||
setLogoutMethod?: (ev: Event) => void,
|
||||
) {
|
||||
const logoutMethodOptions: RadioOption<string>[] = [
|
||||
{
|
||||
label: msg("Front-channel (Iframe)"),
|
||||
value: SAMLLogoutMethods.FrontchannelIframe,
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
label: msg("Front-channel (Native)"),
|
||||
value: SAMLLogoutMethods.FrontchannelNative,
|
||||
},
|
||||
{
|
||||
label: msg("Back-channel (POST)"),
|
||||
value: SAMLLogoutMethods.Backchannel,
|
||||
disabled: !hasPostBinding,
|
||||
},
|
||||
];
|
||||
|
||||
return html`<ak-radio-input
|
||||
label=${msg("SLS Binding")}
|
||||
name="slsBinding"
|
||||
@@ -121,7 +104,7 @@ function renderHasSlsUrl(
|
||||
<ak-radio-input
|
||||
label=${msg("Logout Method")}
|
||||
name="logoutMethod"
|
||||
.options=${logoutMethodOptions}
|
||||
.options=${logoutMethodOptions(hasPostBinding)}
|
||||
.value=${logoutMethod}
|
||||
help=${msg("Method to use for logout when SLS URL is configured.")}
|
||||
@change=${setLogoutMethod}
|
||||
|
||||
@@ -2,6 +2,7 @@ import {
|
||||
DigestAlgorithmEnum,
|
||||
KeyTypeEnum,
|
||||
SAMLBindingsEnum,
|
||||
SAMLLogoutMethods,
|
||||
SignatureAlgorithmEnum,
|
||||
} from "@goauthentik/api";
|
||||
|
||||
@@ -22,6 +23,38 @@ export const spBindingOptions = toOptions([
|
||||
[msg("Post"), SAMLBindingsEnum.Post],
|
||||
]);
|
||||
|
||||
export function logoutMethodLabel(method?: SAMLLogoutMethods | string): string {
|
||||
switch (method) {
|
||||
case SAMLLogoutMethods.FrontchannelIframe:
|
||||
return msg("Front-channel (Iframe)");
|
||||
case SAMLLogoutMethods.FrontchannelNative:
|
||||
return msg("Front-channel (Native)");
|
||||
case SAMLLogoutMethods.Backchannel:
|
||||
return msg("Back-channel (POST)");
|
||||
default:
|
||||
return method ?? "";
|
||||
}
|
||||
}
|
||||
|
||||
export function logoutMethodOptions(hasPostBinding: boolean) {
|
||||
return [
|
||||
{
|
||||
label: logoutMethodLabel(SAMLLogoutMethods.FrontchannelIframe),
|
||||
value: SAMLLogoutMethods.FrontchannelIframe,
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
label: logoutMethodLabel(SAMLLogoutMethods.FrontchannelNative),
|
||||
value: SAMLLogoutMethods.FrontchannelNative,
|
||||
},
|
||||
{
|
||||
label: logoutMethodLabel(SAMLLogoutMethods.Backchannel),
|
||||
value: SAMLLogoutMethods.Backchannel,
|
||||
disabled: !hasPostBinding,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
export const digestAlgorithmOptions = toOptions([
|
||||
["SHA1", DigestAlgorithmEnum.HttpWwwW3Org200009Xmldsigsha1],
|
||||
["SHA256", DigestAlgorithmEnum.HttpWwwW3Org200104Xmlencsha256, true],
|
||||
|
||||
@@ -9,6 +9,8 @@ import "#elements/buttons/ActionButton/index";
|
||||
import "#elements/buttons/ModalButton";
|
||||
import "#elements/buttons/SpinnerButton/index";
|
||||
|
||||
import { logoutMethodLabel } from "./SAMLProviderOptions.js";
|
||||
|
||||
import { DEFAULT_CONFIG } from "#common/api/config";
|
||||
import { EVENT_REFRESH } from "#common/constants";
|
||||
import { MessageLevel } from "#common/messages";
|
||||
@@ -152,6 +154,13 @@ export class SAMLProviderViewPage extends AKElement {
|
||||
}
|
||||
}
|
||||
|
||||
renderLogoutMethod(): string {
|
||||
if (!this.provider?.slsUrl) {
|
||||
return "-";
|
||||
}
|
||||
return logoutMethodLabel(this.provider.logoutMethod) || "-";
|
||||
}
|
||||
|
||||
renderRelatedObjects(): TemplateResult {
|
||||
const relatedObjects = [];
|
||||
if (this.provider?.assignedApplicationName) {
|
||||
@@ -318,18 +327,6 @@ export class SAMLProviderViewPage extends AKElement {
|
||||
</div>
|
||||
</dd>
|
||||
</div>
|
||||
<div class="pf-c-description-list__group">
|
||||
<dt class="pf-c-description-list__term">
|
||||
<span class="pf-c-description-list__text">${msg(
|
||||
"ACS URL",
|
||||
)}</span>
|
||||
</dt>
|
||||
<dd class="pf-c-description-list__description">
|
||||
<div class="pf-c-description-list__text">
|
||||
${this.provider.acsUrl}
|
||||
</div>
|
||||
</dd>
|
||||
</div>
|
||||
<div class="pf-c-description-list__group">
|
||||
<dt class="pf-c-description-list__term">
|
||||
<span class="pf-c-description-list__text">${msg(
|
||||
@@ -345,12 +342,36 @@ export class SAMLProviderViewPage extends AKElement {
|
||||
<div class="pf-c-description-list__group">
|
||||
<dt class="pf-c-description-list__term">
|
||||
<span class="pf-c-description-list__text">${msg(
|
||||
"Issuer",
|
||||
"ACS URL",
|
||||
)}</span>
|
||||
</dt>
|
||||
<dd class="pf-c-description-list__description">
|
||||
<div class="pf-c-description-list__text">
|
||||
${this.provider.issuerOverride}
|
||||
${this.provider.acsUrl}
|
||||
</div>
|
||||
</dd>
|
||||
</div>
|
||||
<div class="pf-c-description-list__group">
|
||||
<dt class="pf-c-description-list__term">
|
||||
<span class="pf-c-description-list__text">${msg(
|
||||
"SLS URL",
|
||||
)}</span>
|
||||
</dt>
|
||||
<dd class="pf-c-description-list__description">
|
||||
<div class="pf-c-description-list__text">
|
||||
${this.provider.slsUrl || "-"}
|
||||
</div>
|
||||
</dd>
|
||||
</div>
|
||||
<div class="pf-c-description-list__group">
|
||||
<dt class="pf-c-description-list__term">
|
||||
<span class="pf-c-description-list__text">${msg(
|
||||
"Logout Method",
|
||||
)}</span>
|
||||
</dt>
|
||||
<dd class="pf-c-description-list__description">
|
||||
<div class="pf-c-description-list__text">
|
||||
${this.renderLogoutMethod()}
|
||||
</div>
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user