From 5979101b0bd518779ffbd2405af6c73d388fbeef Mon Sep 17 00:00:00 2001 From: Jon Koops Date: Fri, 10 Sep 2021 15:25:18 +0200 Subject: [PATCH] Process UXD feedback for client revocation (#1139) --- cypress/integration/clients_test.spec.ts | 12 ----- src/clients/AdvancedTab.tsx | 68 +++++++++++++++--------- src/clients/help.ts | 4 +- 3 files changed, 46 insertions(+), 38 deletions(-) diff --git a/cypress/integration/clients_test.spec.ts b/cypress/integration/clients_test.spec.ts index 0844406fe4..e6a355634b 100644 --- a/cypress/integration/clients_test.spec.ts +++ b/cypress/integration/clients_test.spec.ts @@ -120,18 +120,6 @@ describe("Clients test", function () { new AdminClient().deleteClient(client); }); - it("Revocation", () => { - advancedTab.checkNone(); - - advancedTab.clickSetToNow().checkSetToNow(); - advancedTab.clickClear().checkNone(); - - advancedTab.clickPush(); - masthead.checkNotificationMessage( - "No push sent. No admin URI configured or no registered cluster nodes available" - ); - }); - it("Clustering", () => { advancedTab.expandClusterNode(); diff --git a/src/clients/AdvancedTab.tsx b/src/clients/AdvancedTab.tsx index 631f5b0417..d0c9795f2c 100644 --- a/src/clients/AdvancedTab.tsx +++ b/src/clients/AdvancedTab.tsx @@ -5,17 +5,19 @@ import { ButtonVariant, ExpandableSection, FormGroup, + InputGroup, PageSection, Split, SplitItem, Text, TextInput, ToolbarItem, + Tooltip, } from "@patternfly/react-core"; import type ClientRepresentation from "@keycloak/keycloak-admin-client/lib/defs/clientRepresentation"; import type GlobalRequestResult from "@keycloak/keycloak-admin-client/lib/defs/globalRequestResult"; import moment from "moment"; -import React, { useEffect, useState } from "react"; +import React, { useEffect, useRef, useState } from "react"; import { Controller, useFormContext } from "react-hook-form"; import { Trans, useTranslation } from "react-i18next"; import { Link } from "react-router-dom"; @@ -52,6 +54,7 @@ export const AdvancedTab = ({ attributes, protocol, authenticationFlowBindingOverrides, + adminUrl, }, }: AdvancedProps) => { const { t } = useTranslation("clients"); @@ -68,6 +71,7 @@ export const AdvancedTab = ({ const [key, setKey] = useState(0); const refresh = () => setKey(new Date().getTime()); const [nodes, setNodes] = useState(registeredNodes || {}); + const pushRevocationButtonRef = useRef(); const setNotBefore = (time: number, messageKey: string) => { setValue(revocationFieldName, time); @@ -199,34 +203,48 @@ export const AdvancedTab = ({ /> } > - + + + + + + {!adminUrl && ( + + )} - - diff --git a/src/clients/help.ts b/src/clients/help.ts index fa7650894f..509b5e907f 100644 --- a/src/clients/help.ts +++ b/src/clients/help.ts @@ -60,9 +60,11 @@ export default { scopeParameter: "You can copy/paste this value of scope parameter and use it in initial OpenID Connect Authentication Request sent from this client adapter. Default client scopes and selected optional client scopes will be used when generating token issued for this client", user: "Optionally select user, for whom the example access token will be generated. If you do not select a user, example access token will not be generated during evaluation", - notBefore: "Revoke any tokens issued before this date for this client.", + notBefore: + "Revoke any tokens issued before this time for this client. To push the policy, you should set an effective admin URL in the Settings tab first.", notBeforeIntro: "In order to successfully push a revocation policy to the client, you need to set an Admin URL under the <1>Settings tab for this client first", + notBeforeTooltip: "The admin URL should be set in the Settings tab first.", nodeReRegistrationTimeout: "Interval to specify max time for registered clients cluster nodes to re-register. If cluster node will not send re-registration request to Keycloak within this time, it will be unregistered from Keycloak", fineGrainOpenIdConnectConfiguration: