Skip to content

Commit 0ea74f8

Browse files
committed
Remove user validation from authentication
1 parent 02efc9c commit 0ea74f8

File tree

2 files changed

+0
-32
lines changed

2 files changed

+0
-32
lines changed

src/components/app.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import {
2626
fetchConfigParameter,
2727
fetchConfigParameters,
2828
fetchIdpSettings,
29-
fetchValidateUser,
3029
} from '../utils/rest-api';
3130
import { APP_NAME, COMMON_APP_NAME, PARAM_LANGUAGE, PARAM_THEME } from '../utils/config-params';
3231
import { getComputedLanguage } from '../utils/language';
@@ -117,13 +116,11 @@ const App: FunctionComponent = () => {
117116
dispatch,
118117
initialMatchSilentRenewCallbackUrl != null,
119118
fetchIdpSettings,
120-
fetchValidateUser,
121119
initialMatchSigninCallbackUrl != null
122120
)
123121
: initializeAuthenticationDev(
124122
dispatch,
125123
initialMatchSilentRenewCallbackUrl != null,
126-
validateUserDev,
127124
initialMatchSigninCallbackUrl != null
128125
);
129126
setUserManager({
@@ -211,7 +208,3 @@ const App: FunctionComponent = () => {
211208
);
212209
};
213210
export default App;
214-
215-
function validateUserDev(): Promise<boolean> {
216-
return new Promise((resolve) => window.setTimeout(() => resolve(true), 500));
217-
}

src/utils/rest-api.ts

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
*/
77

88
import { Env, GsLangUser, GsTheme } from '@gridsuite/commons-ui';
9-
import { User } from 'oidc-client';
109
import { APP_NAME, getAppName, PARAM_LANGUAGE, PARAM_THEME } from './config-params';
1110
import { store } from '../redux/store';
1211
import ReconnectingWebSocket, { Event } from 'reconnecting-websocket';
@@ -114,30 +113,6 @@ export function backendFetchJson(url: Url, init?: InitRequest, token?: Token): P
114113
return backendFetch(url, init, token).then((safeResponse: Response) => safeResponse.json());
115114
}
116115

117-
export function fetchValidateUser(user: User): Promise<boolean> {
118-
const sub = user?.profile?.sub;
119-
if (!sub) {
120-
return Promise.reject(new Error(`Error : Fetching access for missing user.profile.sub : ${user}`));
121-
}
122-
123-
console.info(`Fetching access for user...`);
124-
const CheckAccessUrl = `${PREFIX_USER_ADMIN_SERVER_QUERIES}/v1/users/${sub}`;
125-
console.debug(CheckAccessUrl);
126-
127-
return backendFetch(CheckAccessUrl, { method: 'head' }, user?.id_token)
128-
.then((response: Response) => {
129-
//if the response is ok, the responseCode will be either 200 or 204 otherwise it's a Http error and it will be caught
130-
return response.status === 200;
131-
})
132-
.catch((error) => {
133-
if (error.status === 403) {
134-
return false;
135-
} else {
136-
throw error;
137-
}
138-
});
139-
}
140-
141116
export type EnvJson = Env & typeof import('../../public/env.json');
142117

143118
function fetchEnv(): Promise<EnvJson> {

0 commit comments

Comments
 (0)