diff --git a/src/components/app.tsx b/src/components/app.tsx index 983e728..2e463e0 100644 --- a/src/components/app.tsx +++ b/src/components/app.tsx @@ -26,7 +26,6 @@ import { fetchConfigParameter, fetchConfigParameters, fetchIdpSettings, - fetchValidateUser, } from '../utils/rest-api'; import { APP_NAME, COMMON_APP_NAME, PARAM_LANGUAGE, PARAM_THEME } from '../utils/config-params'; import { getComputedLanguage } from '../utils/language'; @@ -117,13 +116,11 @@ const App: FunctionComponent = () => { dispatch, initialMatchSilentRenewCallbackUrl != null, fetchIdpSettings, - fetchValidateUser, initialMatchSigninCallbackUrl != null ) : initializeAuthenticationDev( dispatch, initialMatchSilentRenewCallbackUrl != null, - validateUserDev, initialMatchSigninCallbackUrl != null ); setUserManager({ @@ -211,7 +208,3 @@ const App: FunctionComponent = () => { ); }; export default App; - -function validateUserDev(): Promise { - return new Promise((resolve) => window.setTimeout(() => resolve(true), 500)); -} diff --git a/src/utils/rest-api.ts b/src/utils/rest-api.ts index 97c2ab6..ab5fa28 100644 --- a/src/utils/rest-api.ts +++ b/src/utils/rest-api.ts @@ -6,7 +6,6 @@ */ import { Env, GsLangUser, GsTheme } from '@gridsuite/commons-ui'; -import { User } from 'oidc-client'; import { APP_NAME, getAppName, PARAM_LANGUAGE, PARAM_THEME } from './config-params'; import { store } from '../redux/store'; import ReconnectingWebSocket, { Event } from 'reconnecting-websocket'; @@ -114,30 +113,6 @@ export function backendFetchJson(url: Url, init?: InitRequest, token?: Token): P return backendFetch(url, init, token).then((safeResponse: Response) => safeResponse.json()); } -export function fetchValidateUser(user: User): Promise { - const sub = user?.profile?.sub; - if (!sub) { - return Promise.reject(new Error(`Error : Fetching access for missing user.profile.sub : ${user}`)); - } - - console.info(`Fetching access for user...`); - const CheckAccessUrl = `${PREFIX_USER_ADMIN_SERVER_QUERIES}/v1/users/${sub}`; - console.debug(CheckAccessUrl); - - return backendFetch(CheckAccessUrl, { method: 'head' }, user?.id_token) - .then((response: Response) => { - //if the response is ok, the responseCode will be either 200 or 204 otherwise it's a Http error and it will be caught - return response.status === 200; - }) - .catch((error) => { - if (error.status === 403) { - return false; - } else { - throw error; - } - }); -} - export type EnvJson = Env & typeof import('../../public/env.json'); function fetchEnv(): Promise {