Skip to content

Commit f09d43b

Browse files
authored
Remove user validation from authentication (#117)
Signed-off-by: achour94 <[email protected]>
1 parent cf8d89a commit f09d43b

File tree

4 files changed

+6
-31
lines changed

4 files changed

+6
-31
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"dependencies": {
1717
"@emotion/react": "^11.14.0",
1818
"@emotion/styled": "^11.14.0",
19-
"@gridsuite/commons-ui": "0.100.0",
19+
"@gridsuite/commons-ui": "0.101.0",
2020
"@hookform/resolvers": "^4.0.0",
2121
"@mui/icons-material": "^5.16.14",
2222
"@mui/lab": "5.0.0-alpha.175",

src/routes/router.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
} from 'react-router';
1919
import { useDispatch, useSelector } from 'react-redux';
2020
import { AppState } from '../redux/reducer';
21-
import { AppsMetadataSrv, UserAdminSrv } from '../services';
21+
import { AppsMetadataSrv } from '../services';
2222
import type { App } from '../components/App';
2323
import { updateUserManagerDestructured } from '../redux/actions';
2424
import { getErrorMessage } from '../utils/error';
@@ -78,7 +78,6 @@ const AppAuthStateWithRouterLayer: FunctionComponent<PropsWithChildren<{ layout:
7878
dispatch,
7979
initialMatchSilentRenewCallbackUrl != null,
8080
AppsMetadataSrv.fetchIdpSettings,
81-
UserAdminSrv.fetchValidateUser,
8281
initialMatchSignInCallbackUrl != null
8382
)) ?? null,
8483
null

src/services/user-admin.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,11 @@
55
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
66
*/
77

8-
import { User } from 'oidc-client';
98
import { backendFetch, backendFetchJson, getRestBase } from '../utils/api-rest';
10-
import { extractUserSub, getToken } from '../utils/api';
119
import { UUID } from 'crypto';
1210

1311
const USER_ADMIN_URL = `${getRestBase()}/user-admin/v1`;
1412

15-
/*
16-
* fetchValidateUser is call from commons-ui AuthServices to validate user infos before setting state.user!
17-
*/
18-
export function fetchValidateUser(user: User): Promise<boolean> {
19-
return extractUserSub(user)
20-
.then((sub) => {
21-
console.debug(`Fetching access for user "${sub}"...`);
22-
return backendFetch(`${USER_ADMIN_URL}/users/${sub}`, { method: 'head' }, getToken(user) ?? undefined);
23-
})
24-
.then((response: Response) => {
25-
//if the response is ok, the responseCode will be either 200 or 204 otherwise it's an HTTP error and it will be caught
26-
return response.status === 200;
27-
})
28-
.catch((error) => {
29-
if (error.status === 403) {
30-
return false;
31-
} else {
32-
throw error;
33-
}
34-
});
35-
}
36-
3713
export type UserInfos = {
3814
sub: string;
3915
profileName?: string;

0 commit comments

Comments
 (0)