mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-07 16:11:30 +00:00
fix(ui): disable auto renew for react-okta (#12530)
* fix(ui): disable autorenew for react-okta * update okta token on renewal
This commit is contained in:
parent
977e13d00c
commit
536d1e9e19
@ -414,7 +414,11 @@ const ExploreV1: React.FC<ExploreProps> = ({
|
|||||||
handleSummaryPanelDisplay={handleSummaryPanelDisplay}
|
handleSummaryPanelDisplay={handleSummaryPanelDisplay}
|
||||||
isSummaryPanelVisible={showSummaryPanel}
|
isSummaryPanelVisible={showSummaryPanel}
|
||||||
selectedEntityId={entityDetails?.id || ''}
|
selectedEntityId={entityDetails?.id || ''}
|
||||||
totalValue={searchResults?.hits.total.value ?? 0}
|
totalValue={
|
||||||
|
tabCounts?.[searchIndex] ??
|
||||||
|
searchResults?.hits.total.value ??
|
||||||
|
0
|
||||||
|
}
|
||||||
onPaginationChange={onChangePage}
|
onPaginationChange={onChangePage}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
|
@ -299,7 +299,14 @@ export const AuthProvider = ({
|
|||||||
const { isExpired, timeoutExpiry } = extractDetailsFromToken();
|
const { isExpired, timeoutExpiry } = extractDetailsFromToken();
|
||||||
const refreshToken = localState.getRefreshToken();
|
const refreshToken = localState.getRefreshToken();
|
||||||
|
|
||||||
if (!isExpired && isNumber(timeoutExpiry) && refreshToken) {
|
// Basic & LDAP renewToken depends on RefreshToken hence adding a check here for the same
|
||||||
|
const shouldStartExpiry =
|
||||||
|
refreshToken ||
|
||||||
|
[AuthTypes.BASIC, AuthTypes.LDAP].indexOf(
|
||||||
|
authConfig?.provider as AuthTypes
|
||||||
|
) === -1;
|
||||||
|
|
||||||
|
if (!isExpired && isNumber(timeoutExpiry) && shouldStartExpiry) {
|
||||||
// Have 5m buffer before start trying for silent signIn
|
// Have 5m buffer before start trying for silent signIn
|
||||||
// If token is about to expire then start silentSignIn
|
// If token is about to expire then start silentSignIn
|
||||||
// else just set timer to try for silentSignIn before token expires
|
// else just set timer to try for silentSignIn before token expires
|
||||||
|
@ -35,6 +35,9 @@ export const OktaAuthProvider: FunctionComponent<Props> = ({
|
|||||||
redirectUri,
|
redirectUri,
|
||||||
scopes,
|
scopes,
|
||||||
pkce,
|
pkce,
|
||||||
|
tokenManager: {
|
||||||
|
autoRenew: false,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const triggerLogin = async () => {
|
const triggerLogin = async () => {
|
||||||
|
@ -64,11 +64,13 @@ const OktaAuthenticator = forwardRef<AuthenticatorRef, Props>(
|
|||||||
logout();
|
logout();
|
||||||
},
|
},
|
||||||
async renewIdToken() {
|
async renewIdToken() {
|
||||||
await oktaAuth.token.renewTokens();
|
const renewToken = await oktaAuth.token.renewTokens();
|
||||||
const idToken = oktaAuth.getIdToken() || '';
|
oktaAuth.tokenManager.setTokens(renewToken);
|
||||||
localState.setOidcToken(idToken);
|
const newToken =
|
||||||
|
renewToken?.idToken?.idToken ?? oktaAuth.getIdToken() ?? '';
|
||||||
|
localState.setOidcToken(newToken);
|
||||||
|
|
||||||
return Promise.resolve(idToken);
|
return Promise.resolve(newToken);
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ const SearchedData: React.FC<SearchedDataProps> = ({
|
|||||||
{searchResultCards}
|
{searchResultCards}
|
||||||
<Pagination
|
<Pagination
|
||||||
hideOnSinglePage
|
hideOnSinglePage
|
||||||
className="text-center"
|
className="text-center m-b-sm"
|
||||||
current={isNumber(Number(page)) ? Number(page) : 1}
|
current={isNumber(Number(page)) ? Number(page) : 1}
|
||||||
pageSize={
|
pageSize={
|
||||||
size && isNumber(Number(size))
|
size && isNumber(Number(size))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user