diff --git a/frontend/src/components/App.tsx b/frontend/src/components/App.tsx
index 108be9191..413d397be 100644
--- a/frontend/src/components/App.tsx
+++ b/frontend/src/components/App.tsx
@@ -1,5 +1,5 @@
import React, { Suspense, useContext } from 'react';
-import { Routes, Route, Navigate, useLocation } from 'react-router-dom';
+import { Routes, Route, Navigate, useMatch } from 'react-router-dom';
import {
accessErrorPage,
clusterPath,
@@ -50,17 +50,16 @@ const queryClient = new QueryClient({
});
const App: React.FC = () => {
const { isDarkMode } = useContext(ThemeModeContext);
- const location = useLocation();
- const isAuthPage = location.pathname === '/auth';
+ const isAuthRoute = useMatch('/auth/*');
return (
-
-
- }>
- {isAuthPage ? (
-
- ) : (
+
+ {isAuthRoute ? (
+
+ ) : (
+
+ }>
@@ -100,10 +99,10 @@ const App: React.FC = () => {
- )}
-
-
-
+
+
+ )}
+
);
diff --git a/frontend/src/components/AuthPage/AuthPage.tsx b/frontend/src/components/AuthPage/AuthPage.tsx
index 9d40e6274..9adf7f783 100644
--- a/frontend/src/components/AuthPage/AuthPage.tsx
+++ b/frontend/src/components/AuthPage/AuthPage.tsx
@@ -1,4 +1,5 @@
import React from 'react';
+import { useAuthSettings } from 'lib/hooks/api/appConfig';
import Footer from './Footer/Footer';
import Header from './Header/Header';
@@ -6,10 +7,12 @@ import SignIn from './SignIn/SignIn';
import * as S from './AuthPage.styled';
function AuthPage() {
+ const { data } = useAuthSettings();
+
return (
-
+ {data && }
);
diff --git a/frontend/src/components/AuthPage/Footer/Footer.tsx b/frontend/src/components/AuthPage/Footer/Footer.tsx
index ad9a19085..484559e8d 100644
--- a/frontend/src/components/AuthPage/Footer/Footer.tsx
+++ b/frontend/src/components/AuthPage/Footer/Footer.tsx
@@ -5,16 +5,16 @@ import { useLatestVersion } from 'lib/hooks/api/latestVersion';
import * as S from './Footer.styled';
function Footer() {
- const { data: latestVersionInfo = {} } = useLatestVersion();
- const { versionTag } = latestVersionInfo.latestRelease;
- const { commitId } = latestVersionInfo.build;
+ // const { data: latestVersionInfo = {} } = useLatestVersion();
+ // const { versionTag } = latestVersionInfo.latestRelease;
+ // const { commitId } = latestVersionInfo.build;
return (
- {versionTag} ({commitId})
+ {/* {versionTag} ({commitId}) */}
diff --git a/frontend/src/components/AuthPage/SignIn/ServiceSignIn/AuthCard/AuthCard.styled.tsx b/frontend/src/components/AuthPage/SignIn/OAuthSignIn/AuthCard/AuthCard.styled.tsx
similarity index 85%
rename from frontend/src/components/AuthPage/SignIn/ServiceSignIn/AuthCard/AuthCard.styled.tsx
rename to frontend/src/components/AuthPage/SignIn/OAuthSignIn/AuthCard/AuthCard.styled.tsx
index 118e6b981..189e0b843 100644
--- a/frontend/src/components/AuthPage/SignIn/ServiceSignIn/AuthCard/AuthCard.styled.tsx
+++ b/frontend/src/components/AuthPage/SignIn/OAuthSignIn/AuthCard/AuthCard.styled.tsx
@@ -1,5 +1,7 @@
import styled, { css } from 'styled-components';
import GitHubIcon from 'components/common/Icons/GitHubIcon';
+import { Link } from 'react-router-dom';
+import { Button } from 'components/common/Button/Button';
export const AuthCardStyled = styled.div(
({ theme }) => css`
@@ -56,3 +58,10 @@ export const ServiceTextStyled = styled.span(
line-height: 16px;
`
);
+
+export const ServiceButton = styled(Button)`
+ width: 100%;
+ border-radius: 8px;
+ font-size: 14px;
+ text-decoration: none;
+`
diff --git a/frontend/src/components/AuthPage/SignIn/ServiceSignIn/AuthCard/AuthCard.tsx b/frontend/src/components/AuthPage/SignIn/OAuthSignIn/AuthCard/AuthCard.tsx
similarity index 73%
rename from frontend/src/components/AuthPage/SignIn/ServiceSignIn/AuthCard/AuthCard.tsx
rename to frontend/src/components/AuthPage/SignIn/OAuthSignIn/AuthCard/AuthCard.tsx
index 6dc2db526..fc1162039 100644
--- a/frontend/src/components/AuthPage/SignIn/ServiceSignIn/AuthCard/AuthCard.tsx
+++ b/frontend/src/components/AuthPage/SignIn/OAuthSignIn/AuthCard/AuthCard.tsx
@@ -1,15 +1,15 @@
import React, { ElementType } from 'react';
-import { Button } from 'components/common/Button/Button';
import ServiceImage from 'components/common/Icons/ServiceImage';
import * as S from './AuthCard.styled';
interface Props {
serviceName: string;
+ authPath: string | undefined;
Icon?: ElementType;
}
-function AuthCard({ serviceName, Icon = ServiceImage }: Props) {
+function AuthCard({ serviceName, authPath, Icon = ServiceImage }: Props) {
return (
@@ -21,14 +21,13 @@ function AuthCard({ serviceName, Icon = ServiceImage }: Props) {
-
+
);
}
diff --git a/frontend/src/components/AuthPage/SignIn/ServiceSignIn/ServiceSignIn.styled.tsx b/frontend/src/components/AuthPage/SignIn/OAuthSignIn/OAuthSignIn.styled.tsx
similarity index 67%
rename from frontend/src/components/AuthPage/SignIn/ServiceSignIn/ServiceSignIn.styled.tsx
rename to frontend/src/components/AuthPage/SignIn/OAuthSignIn/OAuthSignIn.styled.tsx
index 6f3d67bbd..26bf22207 100644
--- a/frontend/src/components/AuthPage/SignIn/ServiceSignIn/ServiceSignIn.styled.tsx
+++ b/frontend/src/components/AuthPage/SignIn/OAuthSignIn/OAuthSignIn.styled.tsx
@@ -1,6 +1,6 @@
import styled from 'styled-components';
-export const ServiceSignInStyled = styled.div`
+export const OAuthSignInStyled = styled.div`
display: flex;
flex-direction: column;
gap: 8px;
diff --git a/frontend/src/components/AuthPage/SignIn/OAuthSignIn/OAuthSignIn.tsx b/frontend/src/components/AuthPage/SignIn/OAuthSignIn/OAuthSignIn.tsx
new file mode 100644
index 000000000..e333f29ba
--- /dev/null
+++ b/frontend/src/components/AuthPage/SignIn/OAuthSignIn/OAuthSignIn.tsx
@@ -0,0 +1,35 @@
+import React, { ElementType } from 'react';
+import GitHubIcon from 'components/common/Icons/GitHubIcon';
+import GoogleIcon from 'components/common/Icons/GoogleIcon';
+import ServiceImage from 'components/common/Icons/ServiceImage';
+import { OAuthProvider } from 'generated-sources';
+
+import * as S from './OAuthSignIn.styled';
+import AuthCard from './AuthCard/AuthCard';
+
+interface Props {
+ oAuthProviders: OAuthProvider[] | undefined;
+}
+
+const ServiceIconMap: Record = {
+ github: GitHubIcon,
+ google: GoogleIcon,
+ unknownService: ServiceImage,
+};
+
+function OAuthSignIn({ oAuthProviders }: Props) {
+ return (
+
+ {oAuthProviders?.map((provider) => (
+
+ ))}
+
+ );
+}
+
+export default OAuthSignIn;
diff --git a/frontend/src/components/AuthPage/SignIn/ServiceSignIn/ServiceSignIn.tsx b/frontend/src/components/AuthPage/SignIn/ServiceSignIn/ServiceSignIn.tsx
deleted file mode 100644
index 2255a80e9..000000000
--- a/frontend/src/components/AuthPage/SignIn/ServiceSignIn/ServiceSignIn.tsx
+++ /dev/null
@@ -1,18 +0,0 @@
-import React from 'react';
-import GitHubIcon from 'components/common/Icons/GitHubIcon';
-import GoogleIcon from 'components/common/Icons/GoogleIcon';
-
-import * as S from './ServiceSignIn.styled';
-import AuthCard from './AuthCard/AuthCard';
-
-function ServiceSignIn() {
- return (
-
-
-
-
-
- );
-}
-
-export default ServiceSignIn;
diff --git a/frontend/src/components/AuthPage/SignIn/SignIn.tsx b/frontend/src/components/AuthPage/SignIn/SignIn.tsx
index 3f63cf623..fb93f9e89 100644
--- a/frontend/src/components/AuthPage/SignIn/SignIn.tsx
+++ b/frontend/src/components/AuthPage/SignIn/SignIn.tsx
@@ -1,19 +1,25 @@
import React from 'react';
+import { AppAuthenticationSettings, AuthType } from 'generated-sources';
import BasicSignIn from './BasicSignIn/BasicSignIn';
import * as S from './SignIn.styled';
-import ServiceSignIn from './ServiceSignIn/ServiceSignIn';
+import OAuthSignIn from './OAuthSignIn/OAuthSignIn';
interface Props {
- type: 'service' | 'basic';
+ appAuthenticationSettings: AppAuthenticationSettings;
}
-function SignInForm({ type }: Props) {
+function SignInForm({ appAuthenticationSettings }: Props) {
+ const { authType, oAuthProviders } = appAuthenticationSettings;
+
return (
Sign in
- {type === 'basic' && }
- {type === 'service' && }
+ {(authType === AuthType.LDAP ||
+ authType === AuthType.LOGIN_FORM) && }
+ {authType === AuthType.OAUTH2 && (
+
+ )}
);
}
diff --git a/frontend/src/components/common/Button/Button.tsx b/frontend/src/components/common/Button/Button.tsx
index 828b5d301..8964b6e17 100644
--- a/frontend/src/components/common/Button/Button.tsx
+++ b/frontend/src/components/common/Button/Button.tsx
@@ -9,6 +9,7 @@ export interface Props
ButtonProps {
to?: string | object;
inProgress?: boolean;
+ className?: string;
}
export const Button: FC = ({
@@ -20,7 +21,7 @@ export const Button: FC = ({
}) => {
if (to) {
return (
-
+
{children}
diff --git a/frontend/src/lib/hooks/api/appConfig.ts b/frontend/src/lib/hooks/api/appConfig.ts
index e3ee0fdcb..66d746c33 100644
--- a/frontend/src/lib/hooks/api/appConfig.ts
+++ b/frontend/src/lib/hooks/api/appConfig.ts
@@ -6,6 +6,14 @@ import {
} from 'generated-sources';
import { QUERY_REFETCH_OFF_OPTIONS } from 'lib/constants';
+export function useAuthSettings() {
+ return useQuery(
+ ['app', 'authSettings'],
+ () => api.getAuthenticationSettings(),
+ QUERY_REFETCH_OFF_OPTIONS
+ );
+}
+
export function useAppInfo() {
return useQuery(
['app', 'info'],