From 929041f668d75ab51b0848acdc91cd0d8e7bf01d Mon Sep 17 00:00:00 2001 From: Gaurav Joshi <68965367+joshigaurava@users.noreply.github.com> Date: Tue, 4 Jan 2022 19:07:59 -0800 Subject: [PATCH] Eliminate well-known-config OIDC call --- .../src/main/resources/app/App.tsx | 25 +++++++------------ 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/pinot-controller/src/main/resources/app/App.tsx b/pinot-controller/src/main/resources/app/App.tsx index 28735bb4dca8..2cb7dccdb4bd 100644 --- a/pinot-controller/src/main/resources/app/App.tsx +++ b/pinot-controller/src/main/resources/app/App.tsx @@ -49,7 +49,7 @@ const App = () => { const [redirectUri, setRedirectUri] = React.useState(null); const [clientId, setClientId] = React.useState(null); const [authWorkflow, setAuthWorkflow] = React.useState(null); - const [authorizationEndopoint, setAuthorizationEndopoint] = React.useState( + const [authorizationEndpoint, setAuthorizationEndpoint] = React.useState( null ); @@ -121,15 +121,8 @@ const App = () => { setIsAuthenticated(true); } else { - // Get authorization endpoint - const openIdConfigResponse = await PinotMethodUtils.getWellKnownOpenIdConfiguration( - issuer - ); - setAuthorizationEndopoint( - openIdConfigResponse && openIdConfigResponse.authorization_endpoint - ? openIdConfigResponse.authorization_endpoint - : '' - ); + // Set authorization endpoint + setAuthorizationEndpoint(`${issuer}/auth`); setLoading(false); } @@ -151,11 +144,11 @@ const App = () => { }, [authWorkflow]); React.useEffect(() => { - if (authorizationEndopoint && oidcSignInFormRef && oidcSignInFormRef.current) { - // Authorization endpoint available; submit signin form + if (authorizationEndpoint && oidcSignInFormRef && oidcSignInFormRef.current) { + // Authorization endpoint available; submit sign in form oidcSignInFormRef.current.submit(); } - }, [authorizationEndopoint]); + }, [authorizationEndpoint]); React.useEffect(() => { if (isAuthenticated) { @@ -189,12 +182,12 @@ const App = () => { {/* OIDC auth workflow */} - {authWorkflow && authWorkflow === AuthWorkflow.OIDC ? ( + {authWorkflow && authWorkflow === AuthWorkflow.OIDC && !isAuthenticated ? ( <> {/* OIDC sign in form */}