feat(sso): introduce authentication with SAML
This commit is contained in:
@@ -1,13 +1,20 @@
|
||||
import * as React from 'react';
|
||||
import Box from '@mui/material/Box';
|
||||
import Stack from '@mui/material/Stack';
|
||||
import Container from 'components/Container';
|
||||
import LoginForm from 'components/LoginForm';
|
||||
import SsoProviders from 'components/SsoProviders/index.ee';
|
||||
|
||||
|
||||
export default function Login(): React.ReactElement {
|
||||
return (
|
||||
<Box sx={{ display: 'flex', flex: 1, alignItems: 'center' }}>
|
||||
<Container maxWidth="sm">
|
||||
<LoginForm />
|
||||
<Stack direction="column" gap={2}>
|
||||
<LoginForm />
|
||||
|
||||
<SsoProviders />
|
||||
</Stack>
|
||||
</Container>
|
||||
</Box>
|
||||
);
|
||||
|
29
packages/web/src/pages/LoginCallback/index.tsx
Normal file
29
packages/web/src/pages/LoginCallback/index.tsx
Normal file
@@ -0,0 +1,29 @@
|
||||
import * as React from 'react';
|
||||
import { useNavigate, useSearchParams } from 'react-router-dom';
|
||||
|
||||
import useAuthentication from 'hooks/useAuthentication';
|
||||
import * as URLS from 'config/urls';
|
||||
|
||||
export default function LoginCallback(): React.ReactElement {
|
||||
const navigate = useNavigate();
|
||||
const authentication = useAuthentication();
|
||||
const [searchParams] = useSearchParams();
|
||||
|
||||
React.useEffect(() => {
|
||||
if (authentication.isAuthenticated) {
|
||||
navigate(URLS.DASHBOARD);
|
||||
}
|
||||
}, [authentication.isAuthenticated]);
|
||||
|
||||
React.useEffect(() => {
|
||||
const token = searchParams.get('token');
|
||||
|
||||
if (token) {
|
||||
authentication.updateToken(token);
|
||||
}
|
||||
|
||||
// TODO: handle non-existing token scenario
|
||||
}, []);
|
||||
|
||||
return (<></>);
|
||||
}
|
Reference in New Issue
Block a user