changed to be progressive added help to type

and made `openid-connect` the default

fixes: #446
This commit is contained in:
Erik Jan de Wit 2021-03-29 12:00:56 +02:00
parent 50920b3df2
commit f0558d847b
4 changed files with 29 additions and 14 deletions

View file

@ -11,9 +11,10 @@ import { Controller, useFormContext } from "react-hook-form";
import { useLoginProviders } from "../../context/server-info/ServerInfoProvider"; import { useLoginProviders } from "../../context/server-info/ServerInfoProvider";
import { ClientDescription } from "../ClientDescription"; import { ClientDescription } from "../ClientDescription";
import { FormAccess } from "../../components/form-access/FormAccess"; import { FormAccess } from "../../components/form-access/FormAccess";
import { HelpItem } from "../../components/help-enabler/HelpItem";
export const GeneralSettings = () => { export const GeneralSettings = () => {
const { t } = useTranslation(); const { t } = useTranslation("clients");
const { errors, control } = useFormContext(); const { errors, control } = useFormContext();
const providers = useLoginProviders(); const providers = useLoginProviders();
@ -22,30 +23,32 @@ export const GeneralSettings = () => {
return ( return (
<FormAccess isHorizontal role="manage-clients"> <FormAccess isHorizontal role="manage-clients">
<FormGroup <FormGroup
label="Client Type" label={t("clientType")}
fieldId="kc-type" fieldId="kc-type"
isRequired
helperTextInvalid={t("common:required")}
validated={errors.protocol ? "error" : "default"} validated={errors.protocol ? "error" : "default"}
labelIcon={
<HelpItem
helpText="clients-help:clientType"
forLabel={t("clientType")}
forID="kc-type"
/>
}
> >
<Controller <Controller
name="protocol" name="protocol"
defaultValue="" defaultValue=""
control={control} control={control}
rules={{ required: true }}
render={({ onChange, value }) => ( render={({ onChange, value }) => (
<Select <Select
id="kc-type" id="kc-type"
required
onToggle={() => isOpen(!open)} onToggle={() => isOpen(!open)}
onSelect={(_, value, isPlaceholder) => { onSelect={(_, value) => {
onChange(isPlaceholder ? "" : (value as string)); onChange(value as string);
isOpen(false); isOpen(false);
}} }}
selections={value} selections={value}
variant={SelectVariant.single} variant={SelectVariant.single}
aria-label={t("selectEncryptionType")} aria-label={t("selectEncryptionType")}
placeholderText={t("common:selectOne")}
isOpen={open} isOpen={open}
> >
{providers.map((option) => ( {providers.map((option) => (

View file

@ -25,8 +25,9 @@ export const NewClientForm = () => {
const adminClient = useAdminClient(); const adminClient = useAdminClient();
const history = useHistory(); const history = useHistory();
const [showCapabilityConfig, setShowCapabilityConfig] = useState(false);
const [client, setClient] = useState<ClientRepresentation>({ const [client, setClient] = useState<ClientRepresentation>({
protocol: "", protocol: "openid-connect",
clientId: "", clientId: "",
name: "", name: "",
description: "", description: "",
@ -62,6 +63,7 @@ export const NewClientForm = () => {
onClick={async () => { onClick={async () => {
if (await methods.trigger()) { if (await methods.trigger()) {
setClient({ ...client, ...methods.getValues() }); setClient({ ...client, ...methods.getValues() });
setShowCapabilityConfig(true);
onNext(); onNext();
} }
}} }}
@ -106,13 +108,21 @@ export const NewClientForm = () => {
mainAriaLabel={`${title} content`} mainAriaLabel={`${title} content`}
steps={[ steps={[
{ {
id: "generalSettings",
name: t("generalSettings"), name: t("generalSettings"),
component: <GeneralSettings />, component: <GeneralSettings />,
}, },
...(showCapabilityConfig
? [
{ {
id: "capabilityConfig",
name: t("capabilityConfig"), name: t("capabilityConfig"),
component: <CapabilityConfig protocol={client.protocol} />, component: (
<CapabilityConfig protocol={client.protocol} />
),
}, },
]
: []),
]} ]}
footer={<Footer />} footer={<Footer />}
onSave={save} onSave={save}

View file

@ -1,5 +1,6 @@
{ {
"clients-help": { "clients-help": {
"clientType": "'OpenID connect' allows Clients to verify the identity of the End-User based on the authentication performed by an Authorization Server.'SAML' enables web-based authentication and authorization scenarios including cross-domain single sign-on (SSO) and uses security tokens containing assertions to pass information.",
"serviceAccount": "Allows you to authenticate this client to Keycloak and retrieve access token dedicated to this client. In terms of OAuth2 specification, this enables support of 'Client Credentials Grant' for this client.", "serviceAccount": "Allows you to authenticate this client to Keycloak and retrieve access token dedicated to this client. In terms of OAuth2 specification, this enables support of 'Client Credentials Grant' for this client.",
"directAccess": "This enables support for Direct Access Grants, which means that client has access to username/password of user and exchange it directly with Keycloak server for access token. In terms of OAuth2 specification, this enables support of 'Resource Owner Password Credentials Grant' for this client.", "directAccess": "This enables support for Direct Access Grants, which means that client has access to username/password of user and exchange it directly with Keycloak server for access token. In terms of OAuth2 specification, this enables support of 'Resource Owner Password Credentials Grant' for this client.",
"standardFlow": "This enables standard OpenID Connect redirect based authentication with authorization code. In terms of OpenID Connect or OAuth2 specifications, this enables support of 'Authorization Code Flow' for this client.", "standardFlow": "This enables standard OpenID Connect redirect based authentication with authorization code. In terms of OpenID Connect or OAuth2 specifications, this enables support of 'Authorization Code Flow' for this client.",

View file

@ -1,5 +1,6 @@
{ {
"clients": { "clients": {
"clientType": "Client type",
"clientAuthorization": "Client authorization", "clientAuthorization": "Client authorization",
"implicitFlow": "Implicit flow", "implicitFlow": "Implicit flow",
"createClient": "Create client", "createClient": "Create client",