Skip to content

Commit 929041f

Browse files
committed
Eliminate well-known-config OIDC call
1 parent f32bc20 commit 929041f

File tree

1 file changed

+9
-16
lines changed
  • pinot-controller/src/main/resources/app

1 file changed

+9
-16
lines changed

pinot-controller/src/main/resources/app/App.tsx

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const App = () => {
4949
const [redirectUri, setRedirectUri] = React.useState(null);
5050
const [clientId, setClientId] = React.useState(null);
5151
const [authWorkflow, setAuthWorkflow] = React.useState(null);
52-
const [authorizationEndopoint, setAuthorizationEndopoint] = React.useState(
52+
const [authorizationEndpoint, setAuthorizationEndpoint] = React.useState(
5353
null
5454
);
5555

@@ -121,15 +121,8 @@ const App = () => {
121121

122122
setIsAuthenticated(true);
123123
} else {
124-
// Get authorization endpoint
125-
const openIdConfigResponse = await PinotMethodUtils.getWellKnownOpenIdConfiguration(
126-
issuer
127-
);
128-
setAuthorizationEndopoint(
129-
openIdConfigResponse && openIdConfigResponse.authorization_endpoint
130-
? openIdConfigResponse.authorization_endpoint
131-
: ''
132-
);
124+
// Set authorization endpoint
125+
setAuthorizationEndpoint(`${issuer}/auth`);
133126

134127
setLoading(false);
135128
}
@@ -151,11 +144,11 @@ const App = () => {
151144
}, [authWorkflow]);
152145

153146
React.useEffect(() => {
154-
if (authorizationEndopoint && oidcSignInFormRef && oidcSignInFormRef.current) {
155-
// Authorization endpoint available; submit signin form
147+
if (authorizationEndpoint && oidcSignInFormRef && oidcSignInFormRef.current) {
148+
// Authorization endpoint available; submit sign in form
156149
oidcSignInFormRef.current.submit();
157150
}
158-
}, [authorizationEndopoint]);
151+
}, [authorizationEndpoint]);
159152

160153
React.useEffect(() => {
161154
if (isAuthenticated) {
@@ -189,12 +182,12 @@ const App = () => {
189182
<NotificationContextProvider>
190183
<CustomNotification />
191184
{/* OIDC auth workflow */}
192-
{authWorkflow && authWorkflow === AuthWorkflow.OIDC ? (
185+
{authWorkflow && authWorkflow === AuthWorkflow.OIDC && !isAuthenticated ? (
193186
<>
194187
{/* OIDC sign in form */}
195188
<form
196189
hidden
197-
action={authorizationEndopoint}
190+
action={authorizationEndpoint}
198191
method="post"
199192
ref={oidcSignInFormRef}
200193
>
@@ -209,7 +202,7 @@ const App = () => {
209202
</>
210203
) : (
211204
<>
212-
{/* Non-OIDC auth workflow */}
205+
{/* Non-OIDC/authenticated workflow */}
213206
{loading ? (
214207
<CircularProgress className={classes.loader} size={80} />
215208
) : (

0 commit comments

Comments
 (0)