2021-10-01 10:52:24 +00:00
|
|
|
import type ClientRepresentation from "@keycloak/keycloak-admin-client/lib/defs/clientRepresentation";
|
2022-10-25 22:08:51 +00:00
|
|
|
import type { TFunction } from "i18next";
|
2021-10-01 10:52:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks if a client is intended to be used for authenticating a to a realm.
|
|
|
|
*/
|
|
|
|
export const isRealmClient = (client: ClientRepresentation) => !client.protocol;
|
2021-10-01 14:36:36 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets a human readable name for the specified protocol.
|
|
|
|
*/
|
|
|
|
export const getProtocolName = (t: TFunction<"clients">, protocol: string) => {
|
|
|
|
switch (protocol) {
|
|
|
|
case "openid-connect":
|
2022-01-21 14:10:36 +00:00
|
|
|
return t("clients:protocolTypes.openIdConnect");
|
2021-10-01 14:36:36 +00:00
|
|
|
case "saml":
|
2022-01-21 14:10:36 +00:00
|
|
|
return t("clients:protocolTypes.saml");
|
|
|
|
default:
|
|
|
|
return protocol;
|
2021-10-01 14:36:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return protocol;
|
|
|
|
};
|
2022-01-17 19:26:42 +00:00
|
|
|
|
|
|
|
export const defaultContextAttributes = [
|
|
|
|
{
|
|
|
|
key: "custom",
|
|
|
|
name: "Custom Attribute...",
|
|
|
|
custom: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "kc.identity.authc.method",
|
|
|
|
name: "Authentication Method",
|
|
|
|
values: [
|
|
|
|
{
|
|
|
|
key: "pwd",
|
|
|
|
name: "Password",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "otp",
|
|
|
|
name: "One-Time Password",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "kbr",
|
|
|
|
name: "Kerberos",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "kc.realm.name",
|
|
|
|
name: "Realm",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "kc.time.date_time",
|
|
|
|
name: "Date/Time (MM/dd/yyyy hh:mm:ss)",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "kc.client.network.ip_address",
|
|
|
|
name: "Client IPv4 Address",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "kc.client.network.host",
|
|
|
|
name: "Client Host",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "kc.client.user_agent",
|
|
|
|
name: "Client/User Agent",
|
|
|
|
},
|
|
|
|
];
|