2021-10-01 10:52:24 +00:00
|
|
|
import type ClientRepresentation from "@keycloak/keycloak-admin-client/lib/defs/clientRepresentation";
|
2021-10-01 14:36:36 +00:00
|
|
|
import type { TFunction } from "react-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":
|
|
|
|
return t("clients:protocol:openIdConnect");
|
|
|
|
case "saml":
|
|
|
|
return t("clients:protocol:saml");
|
|
|
|
}
|
|
|
|
|
|
|
|
return protocol;
|
|
|
|
};
|