Added service account user link (#2322)

This commit is contained in:
Erik Jan de Wit 2022-03-28 22:56:18 +02:00 committed by GitHub
parent 86b3fb93a9
commit 8b8f564c61
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 44 additions and 11 deletions

View file

@ -6,6 +6,8 @@ export default {
"'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.",
manageServiceAccountUser:
"To manage detail and group mappings, click on the username <1>{{link}}</1>",
authentication:
"This defines the type of the OIDC client. When it's ON, the OIDC type is set to confidential access type. When it's OFF, it is set to public access type",
authorization:

View file

@ -1,6 +1,8 @@
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import { AlertVariant } from "@patternfly/react-core";
import { Link } from "react-router-dom";
import { Trans, useTranslation } from "react-i18next";
import { AlertVariant, PageSection } from "@patternfly/react-core";
import { InfoCircleIcon } from "@patternfly/react-icons";
import type UserRepresentation from "@keycloak/keycloak-admin-client/lib/defs/userRepresentation";
import type { RoleMappingPayload } from "@keycloak/keycloak-admin-client/lib/defs/roleRepresentation";
@ -12,6 +14,11 @@ import {
RoleMapping,
Row,
} from "../../components/role-mapping/RoleMapping";
import { KeycloakSpinner } from "../../components/keycloak-spinner/KeycloakSpinner";
import { toUser } from "../../user/routes/User";
import { useRealm } from "../../context/realm-context/RealmContext";
import "./service-account.css";
type ServiceAccountProps = {
client: ClientRepresentation;
@ -21,6 +28,7 @@ export const ServiceAccount = ({ client }: ServiceAccountProps) => {
const { t } = useTranslation("clients");
const adminClient = useAdminClient();
const { addAlert, addError } = useAlerts();
const { realm } = useRealm();
const [hide, setHide] = useState(false);
const [serviceAccount, setServiceAccount] = useState<UserRepresentation>();
@ -98,6 +106,20 @@ export const ServiceAccount = ({ client }: ServiceAccountProps) => {
}
};
return serviceAccount ? (
<>
<PageSection className="pf-u-pb-0">
<InfoCircleIcon className="pf-c-alert__icon keycloak--service-account--info-text" />
<span className="pf-u-pl-sm">
<Trans i18nKey="clients-help:manageServiceAccountUser">
{""}
<Link
to={toUser({ realm, id: serviceAccount.id!, tab: "settings" })}
>
{{ link: serviceAccount.username }}
</Link>
</Trans>
</span>
</PageSection>
<RoleMapping
name={client.clientId!}
id={serviceAccount.id!}
@ -106,5 +128,8 @@ export const ServiceAccount = ({ client }: ServiceAccountProps) => {
save={assignRoles}
onHideRolesToggle={() => setHide(!hide)}
/>
) : null;
</>
) : (
<KeycloakSpinner />
);
};

View file

@ -0,0 +1,6 @@
.keycloak--service-account--info-text {
color: var(--pf-global--info-color--100);
display: inline;
font-size: var(--pf-global--FontSize--lg);
}