mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-07 08:03:09 +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}
|
||||
isSummaryPanelVisible={showSummaryPanel}
|
||||
selectedEntityId={entityDetails?.id || ''}
|
||||
totalValue={searchResults?.hits.total.value ?? 0}
|
||||
totalValue={
|
||||
tabCounts?.[searchIndex] ??
|
||||
searchResults?.hits.total.value ??
|
||||
0
|
||||
}
|
||||
onPaginationChange={onChangePage}
|
||||
/>
|
||||
) : (
|
||||
|
@ -299,7 +299,14 @@ export const AuthProvider = ({
|
||||
const { isExpired, timeoutExpiry } = extractDetailsFromToken();
|
||||
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
|
||||
// If token is about to expire then start silentSignIn
|
||||
// else just set timer to try for silentSignIn before token expires
|
||||
|
@ -35,6 +35,9 @@ export const OktaAuthProvider: FunctionComponent<Props> = ({
|
||||
redirectUri,
|
||||
scopes,
|
||||
pkce,
|
||||
tokenManager: {
|
||||
autoRenew: false,
|
||||
},
|
||||
});
|
||||
|
||||
const triggerLogin = async () => {
|
||||
|
@ -64,11 +64,13 @@ const OktaAuthenticator = forwardRef<AuthenticatorRef, Props>(
|
||||
logout();
|
||||
},
|
||||
async renewIdToken() {
|
||||
await oktaAuth.token.renewTokens();
|
||||
const idToken = oktaAuth.getIdToken() || '';
|
||||
localState.setOidcToken(idToken);
|
||||
const renewToken = await oktaAuth.token.renewTokens();
|
||||
oktaAuth.tokenManager.setTokens(renewToken);
|
||||
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}
|
||||
<Pagination
|
||||
hideOnSinglePage
|
||||
className="text-center"
|
||||
className="text-center m-b-sm"
|
||||
current={isNumber(Number(page)) ? Number(page) : 1}
|
||||
pageSize={
|
||||
size && isNumber(Number(size))
|
||||
|
Loading…
x
Reference in New Issue
Block a user