keycloak-scim/src/clients/utils.ts
Erik Jan de Wit 109c255d90
Added the policy screens (#1884)
* initial policies tab

* added initial edit create screen

* removed switch in favour of mapping list

* added pickers

* added groups

* added regex

* added role select component

* added time

* added js type

* fixed create route

* fixed details

* added tests

* changed table header to required

* added user type

* added missing validation message
2022-01-21 15:10:36 +01:00

69 lines
1.4 KiB
TypeScript

import type ClientRepresentation from "@keycloak/keycloak-admin-client/lib/defs/clientRepresentation";
import type { TFunction } from "react-i18next";
/**
* Checks if a client is intended to be used for authenticating a to a realm.
*/
export const isRealmClient = (client: ClientRepresentation) => !client.protocol;
/**
* 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:protocolTypes.openIdConnect");
case "saml":
return t("clients:protocolTypes.saml");
default:
return protocol;
}
return protocol;
};
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",
},
];