From 8a4c15c449afc3c3d66e7b1ce9f124fd99c9b225 Mon Sep 17 00:00:00 2001 From: Prateek Shourya Date: Fri, 31 Oct 2025 16:20:47 +0530 Subject: [PATCH 1/4] refactor: add Unified OAuth Configuration and Missing Gitea Options - Replaced the AuthenticationModes component with a more streamlined implementation using AuthenticationMethodCard. - Removed obsolete authentication modes files from the codebase. - Enhanced the AuthRoot component to utilize the new OAuth configuration hook for better management of authentication options. - Updated type definitions for instance authentication modes to reflect the new structure. --- .../(all)/(dashboard)/authentication/page.tsx | 23 ++++- .../ce/components/authentication/index.ts | 1 - .../ce/components/common/upgrade-button.tsx | 6 +- .../hooks/oauth/core.tsx} | 71 +++++---------- apps/admin/core/hooks/oauth/index.ts | 22 +++++ apps/admin/core/hooks/oauth/types.ts | 7 ++ .../authentication/authentication-modes.tsx | 1 - .../ee/components/authentication/index.ts | 1 - apps/admin/public/logos/ldap.webp | Bin 0 -> 362 bytes .../account/auth-forms/auth-root.tsx | 71 +-------------- apps/space/core/hooks/oauth/core.tsx | 84 ++++++++++++++++++ apps/space/core/hooks/oauth/extended.tsx | 7 ++ apps/space/core/hooks/oauth/index.ts | 13 +++ apps/space/core/hooks/oauth/types.ts | 12 +++ .../account/auth-forms/auth-root.tsx | 61 +------------ apps/web/core/hooks/oauth/core.tsx | 84 ++++++++++++++++++ apps/web/core/hooks/oauth/extended.tsx | 9 ++ apps/web/core/hooks/oauth/index.ts | 13 +++ apps/web/core/hooks/oauth/types.ts | 12 +++ packages/types/src/instance/auth.ts | 2 +- 20 files changed, 320 insertions(+), 180 deletions(-) delete mode 100644 apps/admin/ce/components/authentication/index.ts rename apps/admin/{ce/components/authentication/authentication-modes.tsx => core/hooks/oauth/core.tsx} (74%) create mode 100644 apps/admin/core/hooks/oauth/index.ts create mode 100644 apps/admin/core/hooks/oauth/types.ts delete mode 100644 apps/admin/ee/components/authentication/authentication-modes.tsx delete mode 100644 apps/admin/ee/components/authentication/index.ts create mode 100644 apps/admin/public/logos/ldap.webp create mode 100644 apps/space/core/hooks/oauth/core.tsx create mode 100644 apps/space/core/hooks/oauth/extended.tsx create mode 100644 apps/space/core/hooks/oauth/index.ts create mode 100644 apps/space/core/hooks/oauth/types.ts create mode 100644 apps/web/core/hooks/oauth/core.tsx create mode 100644 apps/web/core/hooks/oauth/extended.tsx create mode 100644 apps/web/core/hooks/oauth/index.ts create mode 100644 apps/web/core/hooks/oauth/types.ts diff --git a/apps/admin/app/(all)/(dashboard)/authentication/page.tsx b/apps/admin/app/(all)/(dashboard)/authentication/page.tsx index 16be71e5862..32f10f5e26e 100644 --- a/apps/admin/app/(all)/(dashboard)/authentication/page.tsx +++ b/apps/admin/app/(all)/(dashboard)/authentication/page.tsx @@ -2,18 +2,21 @@ import { useState } from "react"; import { observer } from "mobx-react"; +import { useTheme } from "next-themes"; import useSWR from "swr"; // plane internal packages import { setPromiseToast } from "@plane/propel/toast"; import type { TInstanceConfigurationKeys } from "@plane/types"; import { Loader, ToggleSwitch } from "@plane/ui"; -import { cn } from "@plane/utils"; +import { cn, resolveGeneralTheme } from "@plane/utils"; // hooks +import { AuthenticationMethodCard } from "@/components/authentication/authentication-method-card"; +import { useAuthenticationModes } from "@/hooks/oauth"; import { useInstance } from "@/hooks/store"; -// plane admin components -import { AuthenticationModes } from "@/plane-admin/components/authentication"; const InstanceAuthenticationPage = observer(() => { + // theme + const { resolvedTheme: resolvedThemeAdmin } = useTheme(); // store const { fetchInstanceConfigurations, formattedConfig, updateInstanceConfigurations } = useInstance(); @@ -23,6 +26,7 @@ const InstanceAuthenticationPage = observer(() => { const [isSubmitting, setIsSubmitting] = useState(false); // derived values const enableSignUpConfig = formattedConfig?.ENABLE_SIGNUP ?? ""; + const resolvedTheme = resolveGeneralTheme(resolvedThemeAdmin); const updateConfig = async (key: TInstanceConfigurationKeys, value: string) => { setIsSubmitting(true); @@ -55,6 +59,7 @@ const InstanceAuthenticationPage = observer(() => { }); }; + const authenticationModes = useAuthenticationModes({ disabled: isSubmitting, updateConfig, resolvedTheme }); return ( <>
@@ -94,7 +99,17 @@ const InstanceAuthenticationPage = observer(() => {
Available authentication modes
- + {authenticationModes.map((method) => ( + + ))} ) : ( diff --git a/apps/admin/ce/components/authentication/index.ts b/apps/admin/ce/components/authentication/index.ts deleted file mode 100644 index d2aa7485574..00000000000 --- a/apps/admin/ce/components/authentication/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./authentication-modes"; diff --git a/apps/admin/ce/components/common/upgrade-button.tsx b/apps/admin/ce/components/common/upgrade-button.tsx index 14a955f217f..f7ad3e4de43 100644 --- a/apps/admin/ce/components/common/upgrade-button.tsx +++ b/apps/admin/ce/components/common/upgrade-button.tsx @@ -7,7 +7,11 @@ import { SquareArrowOutUpRight } from "lucide-react"; import { getButtonStyling } from "@plane/propel/button"; import { cn } from "@plane/utils"; -export const UpgradeButton: React.FC = () => ( +export type TAuthUpgradeButtonProps = { + level: "workspace" | "instance"; +}; + +export const UpgradeButton: React.FC = () => ( Upgrade diff --git a/apps/admin/ce/components/authentication/authentication-modes.tsx b/apps/admin/core/hooks/oauth/core.tsx similarity index 74% rename from apps/admin/ce/components/authentication/authentication-modes.tsx rename to apps/admin/core/hooks/oauth/core.tsx index 0936105f9be..0a84de9f881 100644 --- a/apps/admin/ce/components/authentication/authentication-modes.tsx +++ b/apps/admin/core/hooks/oauth/core.tsx @@ -1,16 +1,9 @@ -import { observer } from "mobx-react"; import Image from "next/image"; -import { useTheme } from "next-themes"; import { KeyRound, Mails } from "lucide-react"; // types -import type { - TGetBaseAuthenticationModeProps, - TInstanceAuthenticationMethodKeys, - TInstanceAuthenticationModes, -} from "@plane/types"; +import type { TGetBaseAuthenticationModeProps, TInstanceAuthenticationModes } from "@plane/types"; import { resolveGeneralTheme } from "@plane/utils"; // components -import { AuthenticationMethodCard } from "@/components/authentication/authentication-method-card"; import { EmailCodesConfiguration } from "@/components/authentication/email-config-switch"; import { GiteaConfiguration } from "@/components/authentication/gitea-config"; import { GithubConfiguration } from "@/components/authentication/github-config"; @@ -25,21 +18,19 @@ import githubLightModeImage from "@/public/logos/github-black.png"; import githubDarkModeImage from "@/public/logos/github-white.png"; import GitlabLogo from "@/public/logos/gitlab-logo.svg"; import GoogleLogo from "@/public/logos/google-logo.svg"; +import LDAPLogo from "@/public/logos/ldap.webp"; import OIDCLogo from "@/public/logos/oidc-logo.svg"; import SAMLLogo from "@/public/logos/saml-logo.svg"; -export type TAuthenticationModeProps = { - disabled: boolean; - updateConfig: (key: TInstanceAuthenticationMethodKeys, value: string) => void; -}; - // Authentication methods -export const getAuthenticationModes: (props: TGetBaseAuthenticationModeProps) => TInstanceAuthenticationModes[] = ({ +export const getCoreAuthenticationModesMap: ( + props: TGetBaseAuthenticationModeProps +) => Record = ({ disabled, updateConfig, resolvedTheme, -}) => [ - { +}) => ({ + "unique-codes": { key: "unique-codes", name: "Unique codes", description: @@ -47,21 +38,21 @@ export const getAuthenticationModes: (props: TGetBaseAuthenticationModeProps) => icon: , config: , }, - { + "passwords-login": { key: "passwords-login", name: "Passwords", description: "Allow members to create accounts with passwords and use it with their email addresses to sign in.", icon: , config: , }, - { + google: { key: "google", name: "Google", description: "Allow members to log in or sign up for Plane with their Google accounts.", icon: Google Logo, config: , }, - { + github: { key: "github", name: "GitHub", description: "Allow members to log in or sign up for Plane with their GitHub accounts.", @@ -75,56 +66,42 @@ export const getAuthenticationModes: (props: TGetBaseAuthenticationModeProps) => ), config: , }, - { + gitlab: { key: "gitlab", name: "GitLab", description: "Allow members to log in or sign up to plane with their GitLab accounts.", icon: GitLab Logo, config: , }, - { + gitea: { key: "gitea", name: "Gitea", description: "Allow members to log in or sign up to plane with their Gitea accounts.", icon: Gitea Logo, config: , }, - { + oidc: { key: "oidc", name: "OIDC", description: "Authenticate your users via the OpenID Connect protocol.", icon: OIDC Logo, - config: , + config: , unavailable: true, }, - { + saml: { key: "saml", name: "SAML", description: "Authenticate your users via the Security Assertion Markup Language protocol.", icon: SAML Logo, - config: , + config: , + unavailable: true, + }, + ldap: { + key: "ldap", + name: "LDAP", + description: "Authenticate your users via LDAP directory services.", + icon: LDAP Logo, + config: , unavailable: true, }, -]; - -export const AuthenticationModes: React.FC = observer((props) => { - const { disabled, updateConfig } = props; - // next-themes - const { resolvedTheme } = useTheme(); - - return ( - <> - {getAuthenticationModes({ disabled, updateConfig, resolvedTheme }).map((method) => ( - - ))} - - ); }); diff --git a/apps/admin/core/hooks/oauth/index.ts b/apps/admin/core/hooks/oauth/index.ts new file mode 100644 index 00000000000..59b224ed136 --- /dev/null +++ b/apps/admin/core/hooks/oauth/index.ts @@ -0,0 +1,22 @@ +import type { TInstanceAuthenticationModes } from "@plane/types"; +import { getCoreAuthenticationModesMap } from "./core"; +import type { TGetAuthenticationModeProps } from "./types"; + +export const useAuthenticationModes = (props: TGetAuthenticationModeProps): TInstanceAuthenticationModes[] => { + // derived values + const authenticationModes = getCoreAuthenticationModesMap(props); + + const availableAuthenticationModes: TInstanceAuthenticationModes[] = [ + authenticationModes["unique-codes"], + authenticationModes["passwords-login"], + authenticationModes["google"], + authenticationModes["github"], + authenticationModes["gitlab"], + authenticationModes["gitea"], + authenticationModes["oidc"], + authenticationModes["saml"], + authenticationModes["ldap"], + ]; + + return availableAuthenticationModes; +}; diff --git a/apps/admin/core/hooks/oauth/types.ts b/apps/admin/core/hooks/oauth/types.ts new file mode 100644 index 00000000000..cf265152ac5 --- /dev/null +++ b/apps/admin/core/hooks/oauth/types.ts @@ -0,0 +1,7 @@ +import type { TInstanceAuthenticationMethodKeys } from "@plane/types"; + +export type TGetAuthenticationModeProps = { + disabled: boolean; + updateConfig: (key: TInstanceAuthenticationMethodKeys, value: string) => void; + resolvedTheme: string | undefined; +}; diff --git a/apps/admin/ee/components/authentication/authentication-modes.tsx b/apps/admin/ee/components/authentication/authentication-modes.tsx deleted file mode 100644 index 4e3b05a5228..00000000000 --- a/apps/admin/ee/components/authentication/authentication-modes.tsx +++ /dev/null @@ -1 +0,0 @@ -export * from "ce/components/authentication/authentication-modes"; diff --git a/apps/admin/ee/components/authentication/index.ts b/apps/admin/ee/components/authentication/index.ts deleted file mode 100644 index d2aa7485574..00000000000 --- a/apps/admin/ee/components/authentication/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./authentication-modes"; diff --git a/apps/admin/public/logos/ldap.webp b/apps/admin/public/logos/ldap.webp new file mode 100644 index 0000000000000000000000000000000000000000..c94a7d83ddbef3697c77fbd4339c1c7799b34f46 GIT binary patch literal 362 zcmV-w0hRtzNk&Fu0RRA3MM6+kP&iCh0RR9mFTe{BBB-%#%TiL=`KS5rzyJT1t*)a; zp$kn2^W>0SNHhvNZjYV^Ia?Ayb`%`~X;9VWnm`c%fPizhZQnK9R=w!iwwcW2C)nN^ zKVYld+XU29FuqBng!c&p%D=Qv4CICh6?_Wn7%UO1La54Y1}DcOpz)!K!$!0T9wj^+ zXG$k%L(Z${z}!%*JPk&w>JdYMM8L{bRRLC|WhlOy=i(R}->WNHv-#;?V-E{Y@7|D8xwL$J{ynV1y!sp0ua#OVOo?LI7)*{O$!?cyVlWIyf_ zG6);do1MSJBR+dkU>Yt&yLqUyz||grOdl4D2`NGmd7fi9cZ1$^{X}f0;F&%yE^~~6 zjKq;)FL%3Q&v)9QMFIj1REAWvWE9_h*ez;jvl(UIR6TX|Wx(EqYTUn#`TTkL+%8!N I*G8Ip1!q8~LjV8( literal 0 HcmV?d00001 diff --git a/apps/space/core/components/account/auth-forms/auth-root.tsx b/apps/space/core/components/account/auth-forms/auth-root.tsx index 5a54b190614..3f67bf76136 100644 --- a/apps/space/core/components/account/auth-forms/auth-root.tsx +++ b/apps/space/core/components/account/auth-forms/auth-root.tsx @@ -3,11 +3,8 @@ import type { FC } from "react"; import React, { useEffect, useState } from "react"; import { observer } from "mobx-react"; -import Image from "next/image"; import { useSearchParams } from "next/navigation"; -import { useTheme } from "next-themes"; // plane imports -import { API_BASE_URL } from "@plane/constants"; import { SitesAuthService } from "@plane/services"; import type { IEmailCheckData } from "@plane/types"; import { OAuthOptions } from "@plane/ui"; @@ -16,15 +13,10 @@ import { OAuthOptions } from "@plane/ui"; import type { TAuthErrorInfo } from "@/helpers/authentication.helper"; import { EErrorAlertType, authErrorHandler, EAuthenticationErrorCodes } from "@/helpers/authentication.helper"; // hooks +import { useOAuthConfig } from "@/hooks/oauth"; import { useInstance } from "@/hooks/store/use-instance"; // types import { EAuthModes, EAuthSteps } from "@/types/auth"; -// assets -import GithubLightLogo from "/public/logos/github-black.png"; -import GithubDarkLogo from "/public/logos/github-dark.svg"; -import GitlabLogo from "/public/logos/gitlab-logo.svg"; -import GoogleLogo from "/public/logos/google-logo.svg"; -import GiteaLogo from "/public/logos/gitea-logo.svg"; // local imports import { TermsAndConditions } from "../terms-and-conditions"; import { AuthBanner } from "./auth-banner"; @@ -41,7 +33,6 @@ export const AuthRoot: FC = observer(() => { const emailParam = searchParams.get("email") || undefined; const error_code = searchParams.get("error_code") || undefined; const nextPath = searchParams.get("next_path") || undefined; - const next_path = searchParams.get("next_path"); // states const [authMode, setAuthMode] = useState(EAuthModes.SIGN_UP); const [authStep, setAuthStep] = useState(EAuthSteps.EMAIL); @@ -49,7 +40,6 @@ export const AuthRoot: FC = observer(() => { const [errorInfo, setErrorInfo] = useState(undefined); const [isPasswordAutoset, setIsPasswordAutoset] = useState(true); // hooks - const { resolvedTheme } = useTheme(); const { config } = useInstance(); useEffect(() => { @@ -92,13 +82,8 @@ export const AuthRoot: FC = observer(() => { const isSMTPConfigured = config?.is_smtp_configured || false; const isMagicLoginEnabled = config?.is_magic_login_enabled || false; const isEmailPasswordEnabled = config?.is_email_password_enabled || false; - const isOAuthEnabled = - (config && - (config?.is_google_enabled || - config?.is_github_enabled || - config?.is_gitlab_enabled || - config?.is_gitea_enabled)) || - false; + const oAuthActionText = authMode === EAuthModes.SIGN_UP ? "Sign up" : "Sign in"; + const { isOAuthEnabled, oAuthOptions } = useOAuthConfig(oAuthActionText); // submit handler- email verification const handleEmailVerification = async (data: IEmailCheckData) => { @@ -158,54 +143,6 @@ export const AuthRoot: FC = observer(() => { }); }; - const content = authMode === EAuthModes.SIGN_UP ? "Sign up" : "Sign in"; - - const OAuthConfig = [ - { - id: "google", - text: `${content} with Google`, - icon: Google Logo, - onClick: () => { - window.location.assign(`${API_BASE_URL}/auth/google/${next_path ? `?next_path=${next_path}` : ``}`); - }, - enabled: config?.is_google_enabled, - }, - { - id: "github", - text: `${content} with GitHub`, - icon: ( - GitHub Logo - ), - onClick: () => { - window.location.assign(`${API_BASE_URL}/auth/github/${next_path ? `?next_path=${next_path}` : ``}`); - }, - enabled: config?.is_github_enabled, - }, - { - id: "gitlab", - text: `${content} with GitLab`, - icon: GitLab Logo, - onClick: () => { - window.location.assign(`${API_BASE_URL}/auth/gitlab/${next_path ? `?next_path=${next_path}` : ``}`); - }, - enabled: config?.is_gitlab_enabled, - }, - { - id: "gitea", - text: `${content} with Gitea`, - icon: Gitea Logo, - onClick: () => { - window.location.assign(`${API_BASE_URL}/auth/gitea/${next_path ? `?next_path=${next_path}` : ``}`); - }, - enabled: config?.is_gitea_enabled, - }, - ]; - return (
@@ -213,7 +150,7 @@ export const AuthRoot: FC = observer(() => { setErrorInfo(value)} /> )} - {isOAuthEnabled && } + {isOAuthEnabled && } {authStep === EAuthSteps.EMAIL && } {authStep === EAuthSteps.UNIQUE_CODE && ( diff --git a/apps/space/core/hooks/oauth/core.tsx b/apps/space/core/hooks/oauth/core.tsx new file mode 100644 index 00000000000..c9dde344ad9 --- /dev/null +++ b/apps/space/core/hooks/oauth/core.tsx @@ -0,0 +1,84 @@ +import Image from "next/image"; +// plane imports +import { useSearchParams } from "next/navigation"; +import { useTheme } from "next-themes"; +import { API_BASE_URL } from "@plane/constants"; +// assets +import GithubLightLogo from "/public/logos/github-black.png"; +import GithubDarkLogo from "/public/logos/github-dark.svg"; +import GitlabLogo from "/public/logos/gitlab-logo.svg"; +import GoogleLogo from "/public/logos/google-logo.svg"; +import GiteaLogo from "/public/logos/gitea-logo.svg"; +// hooks +import { useInstance } from "@/hooks/store/use-instance"; +// local imports +import type { TOAuthConfigs } from "./types"; + +export const useCoreOAuthConfig = (oauthActionText: string): TOAuthConfigs => { + //router + const searchParams = useSearchParams(); + // query params + const next_path = searchParams.get("next_path"); + // theme + const { resolvedTheme } = useTheme(); + // store hooks + const { config } = useInstance(); + // derived values + const isOAuthEnabled = + (config && + (config?.is_google_enabled || + config?.is_github_enabled || + config?.is_gitlab_enabled || + config?.is_gitea_enabled)) || + false; + const oAuthOptions = [ + { + id: "google", + text: `${oauthActionText} with Google`, + icon: Google Logo, + onClick: () => { + window.location.assign(`${API_BASE_URL}/auth/google/${next_path ? `?next_path=${next_path}` : ``}`); + }, + enabled: config?.is_google_enabled, + }, + { + id: "github", + text: `${oauthActionText} with GitHub`, + icon: ( + GitHub Logo + ), + onClick: () => { + window.location.assign(`${API_BASE_URL}/auth/github/${next_path ? `?next_path=${next_path}` : ``}`); + }, + enabled: config?.is_github_enabled, + }, + { + id: "gitlab", + text: `${oauthActionText} with GitLab`, + icon: GitLab Logo, + onClick: () => { + window.location.assign(`${API_BASE_URL}/auth/gitlab/${next_path ? `?next_path=${next_path}` : ``}`); + }, + enabled: config?.is_gitlab_enabled, + }, + { + id: "gitea", + text: `${oauthActionText} with Gitea`, + icon: Gitea Logo, + onClick: () => { + window.location.assign(`${API_BASE_URL}/auth/gitea/${next_path ? `?next_path=${next_path}` : ``}`); + }, + enabled: config?.is_gitea_enabled, + }, + ]; + + return { + isOAuthEnabled, + oAuthOptions, + }; +}; diff --git a/apps/space/core/hooks/oauth/extended.tsx b/apps/space/core/hooks/oauth/extended.tsx new file mode 100644 index 00000000000..c9349fe6665 --- /dev/null +++ b/apps/space/core/hooks/oauth/extended.tsx @@ -0,0 +1,7 @@ +// local imports +import type { TOAuthConfigs } from "./types"; + +export const useExtendedOAuthConfig = (_oauthActionText: string): TOAuthConfigs => ({ + isOAuthEnabled: false, + oAuthOptions: [], +}); diff --git a/apps/space/core/hooks/oauth/index.ts b/apps/space/core/hooks/oauth/index.ts new file mode 100644 index 00000000000..0d9e0148018 --- /dev/null +++ b/apps/space/core/hooks/oauth/index.ts @@ -0,0 +1,13 @@ +// local imports +import { useCoreOAuthConfig } from "./core"; +import { useExtendedOAuthConfig } from "./extended"; +import type { TOAuthConfigs } from "./types"; + +export const useOAuthConfig = (oauthActionText: string = "Continue"): TOAuthConfigs => { + const coreOAuthConfig = useCoreOAuthConfig(oauthActionText); + const extendedOAuthConfig = useExtendedOAuthConfig(oauthActionText); + return { + isOAuthEnabled: coreOAuthConfig.isOAuthEnabled || extendedOAuthConfig.isOAuthEnabled, + oAuthOptions: [...coreOAuthConfig.oAuthOptions, ...extendedOAuthConfig.oAuthOptions], + }; +}; diff --git a/apps/space/core/hooks/oauth/types.ts b/apps/space/core/hooks/oauth/types.ts new file mode 100644 index 00000000000..1d7d1316291 --- /dev/null +++ b/apps/space/core/hooks/oauth/types.ts @@ -0,0 +1,12 @@ +type TOAuthOption = { + id: string; + text: string; + icon: React.ReactNode; + onClick: () => void; + enabled?: boolean; +}; + +export type TOAuthConfigs = { + isOAuthEnabled: boolean; + oAuthOptions: TOAuthOption[]; +}; diff --git a/apps/web/core/components/account/auth-forms/auth-root.tsx b/apps/web/core/components/account/auth-forms/auth-root.tsx index 9d01a2d3c33..ed4d00d8049 100644 --- a/apps/web/core/components/account/auth-forms/auth-root.tsx +++ b/apps/web/core/components/account/auth-forms/auth-root.tsx @@ -1,17 +1,9 @@ import type { FC } from "react"; import React, { useEffect, useState } from "react"; import { observer } from "mobx-react"; -import Image from "next/image"; import { useSearchParams } from "next/navigation"; -import { useTheme } from "next-themes"; // plane imports -import { API_BASE_URL } from "@plane/constants"; import { OAuthOptions } from "@plane/ui"; -// assets -import GithubLightLogo from "/public/logos/github-black.png"; -import GithubDarkLogo from "/public/logos/github-dark.svg"; -import GitlabLogo from "/public/logos/gitlab-logo.svg"; -import GoogleLogo from "/public/logos/google-logo.svg"; // helpers import type { TAuthErrorInfo } from "@/helpers/authentication.helper"; import { @@ -22,7 +14,7 @@ import { authErrorHandler, } from "@/helpers/authentication.helper"; // hooks -import { useInstance } from "@/hooks/store/use-instance"; +import { useOAuthConfig } from "@/hooks/oauth"; // local imports import { TermsAndConditions } from "../terms-and-conditions"; import { AuthBanner } from "./auth-banner"; @@ -41,8 +33,6 @@ export const AuthRoot: FC = observer((props) => { const invitation_id = searchParams.get("invitation_id"); const workspaceSlug = searchParams.get("slug"); const error_code = searchParams.get("error_code"); - const next_path = searchParams.get("next_path"); - const { resolvedTheme } = useTheme(); // props const { authMode: currentAuthMode } = props; // states @@ -50,13 +40,9 @@ export const AuthRoot: FC = observer((props) => { const [authStep, setAuthStep] = useState(EAuthSteps.EMAIL); const [email, setEmail] = useState(emailParam ? emailParam.toString() : ""); const [errorInfo, setErrorInfo] = useState(undefined); - - // hooks - const { config } = useInstance(); - // derived values - const isOAuthEnabled = - (config && (config?.is_google_enabled || config?.is_github_enabled || config?.is_gitlab_enabled)) || false; + const oAuthActionText = authMode === EAuthModes.SIGN_UP ? "Sign up" : "Sign in"; + const { isOAuthEnabled, oAuthOptions } = useOAuthConfig(oAuthActionText); useEffect(() => { if (!authMode && currentAuthMode) setAuthMode(currentAuthMode); @@ -106,45 +92,6 @@ export const AuthRoot: FC = observer((props) => { if (!authMode) return <>; - const OauthButtonContent = authMode === EAuthModes.SIGN_UP ? "Sign up" : "Sign in"; - - const OAuthConfig = [ - { - id: "google", - text: `${OauthButtonContent} with Google`, - icon: Google Logo, - onClick: () => { - window.location.assign(`${API_BASE_URL}/auth/google/${next_path ? `?next_path=${next_path}` : ``}`); - }, - enabled: config?.is_google_enabled, - }, - { - id: "github", - text: `${OauthButtonContent} with GitHub`, - icon: ( - GitHub Logo - ), - onClick: () => { - window.location.assign(`${API_BASE_URL}/auth/github/${next_path ? `?next_path=${next_path}` : ``}`); - }, - enabled: config?.is_github_enabled, - }, - { - id: "gitlab", - text: `${OauthButtonContent} with GitLab`, - icon: GitLab Logo, - onClick: () => { - window.location.assign(`${API_BASE_URL}/auth/gitlab/${next_path ? `?next_path=${next_path}` : ``}`); - }, - enabled: config?.is_gitlab_enabled, - }, - ]; - return (
@@ -159,7 +106,7 @@ export const AuthRoot: FC = observer((props) => { currentAuthStep={authStep} /> - {isOAuthEnabled && } + {isOAuthEnabled && } { + //router + const searchParams = useSearchParams(); + // query params + const next_path = searchParams.get("next_path"); + // theme + const { resolvedTheme } = useTheme(); + // store hooks + const { config } = useInstance(); + // derived values + const isOAuthEnabled = + (config && + (config?.is_google_enabled || + config?.is_github_enabled || + config?.is_gitlab_enabled || + config?.is_gitea_enabled)) || + false; + const oAuthOptions = [ + { + id: "google", + text: `${oauthActionText} with Google`, + icon: Google Logo, + onClick: () => { + window.location.assign(`${API_BASE_URL}/auth/google/${next_path ? `?next_path=${next_path}` : ``}`); + }, + enabled: config?.is_google_enabled, + }, + { + id: "github", + text: `${oauthActionText} with GitHub`, + icon: ( + GitHub Logo + ), + onClick: () => { + window.location.assign(`${API_BASE_URL}/auth/github/${next_path ? `?next_path=${next_path}` : ``}`); + }, + enabled: config?.is_github_enabled, + }, + { + id: "gitlab", + text: `${oauthActionText} with GitLab`, + icon: GitLab Logo, + onClick: () => { + window.location.assign(`${API_BASE_URL}/auth/gitlab/${next_path ? `?next_path=${next_path}` : ``}`); + }, + enabled: config?.is_gitlab_enabled, + }, + { + id: "gitea", + text: `${oauthActionText} with Gitea`, + icon: Gitea Logo, + onClick: () => { + window.location.assign(`${API_BASE_URL}/auth/gitea/${next_path ? `?next_path=${next_path}` : ``}`); + }, + enabled: config?.is_gitea_enabled, + }, + ]; + + return { + isOAuthEnabled, + oAuthOptions, + }; +}; diff --git a/apps/web/core/hooks/oauth/extended.tsx b/apps/web/core/hooks/oauth/extended.tsx new file mode 100644 index 00000000000..e6ff8602c18 --- /dev/null +++ b/apps/web/core/hooks/oauth/extended.tsx @@ -0,0 +1,9 @@ +// local imports +import type { TOAuthConfigs } from "./types"; + +export const useExtendedOAuthConfig = (_oauthActionText: string): TOAuthConfigs => { + return { + isOAuthEnabled: false, + oAuthOptions: [], + }; +}; diff --git a/apps/web/core/hooks/oauth/index.ts b/apps/web/core/hooks/oauth/index.ts new file mode 100644 index 00000000000..0d9e0148018 --- /dev/null +++ b/apps/web/core/hooks/oauth/index.ts @@ -0,0 +1,13 @@ +// local imports +import { useCoreOAuthConfig } from "./core"; +import { useExtendedOAuthConfig } from "./extended"; +import type { TOAuthConfigs } from "./types"; + +export const useOAuthConfig = (oauthActionText: string = "Continue"): TOAuthConfigs => { + const coreOAuthConfig = useCoreOAuthConfig(oauthActionText); + const extendedOAuthConfig = useExtendedOAuthConfig(oauthActionText); + return { + isOAuthEnabled: coreOAuthConfig.isOAuthEnabled || extendedOAuthConfig.isOAuthEnabled, + oAuthOptions: [...coreOAuthConfig.oAuthOptions, ...extendedOAuthConfig.oAuthOptions], + }; +}; diff --git a/apps/web/core/hooks/oauth/types.ts b/apps/web/core/hooks/oauth/types.ts new file mode 100644 index 00000000000..1d7d1316291 --- /dev/null +++ b/apps/web/core/hooks/oauth/types.ts @@ -0,0 +1,12 @@ +type TOAuthOption = { + id: string; + text: string; + icon: React.ReactNode; + onClick: () => void; + enabled?: boolean; +}; + +export type TOAuthConfigs = { + isOAuthEnabled: boolean; + oAuthOptions: TOAuthOption[]; +}; diff --git a/packages/types/src/instance/auth.ts b/packages/types/src/instance/auth.ts index c65f9ebb8b8..63b78b858ec 100644 --- a/packages/types/src/instance/auth.ts +++ b/packages/types/src/instance/auth.ts @@ -1,5 +1,5 @@ export type TInstanceAuthenticationModes = { - key: string; + key: "unique-codes" | "passwords-login" | "google" | "github" | "gitlab" | "gitea" | "oidc" | "saml" | "ldap"; name: string; description: string; icon: React.ReactNode; From f5f0b3fda487ac0b5ef4b03c0532eabaf76da374 Mon Sep 17 00:00:00 2001 From: Prateek Shourya Date: Fri, 31 Oct 2025 16:40:33 +0530 Subject: [PATCH 2/4] refactor: update OAuth type imports and remove obsolete types - Replaced local type imports with centralized imports from @plane/types in core, extended, and index OAuth hooks. - Removed the now redundant types.ts file as its definitions have been migrated. - Enhanced type definitions for OAuth options to improve consistency across the application. --- apps/space/core/hooks/oauth/core.tsx | 5 ++--- apps/space/core/hooks/oauth/extended.tsx | 4 ++-- apps/space/core/hooks/oauth/index.ts | 3 ++- apps/space/core/hooks/oauth/types.ts | 12 ------------ apps/web/core/hooks/oauth/core.tsx | 5 ++--- apps/web/core/hooks/oauth/extended.tsx | 14 ++++++-------- apps/web/core/hooks/oauth/index.ts | 3 ++- apps/web/core/hooks/oauth/types.ts | 12 ------------ packages/types/src/instance/auth.ts | 13 +++++++++++++ 9 files changed, 29 insertions(+), 42 deletions(-) delete mode 100644 apps/space/core/hooks/oauth/types.ts delete mode 100644 apps/web/core/hooks/oauth/types.ts diff --git a/apps/space/core/hooks/oauth/core.tsx b/apps/space/core/hooks/oauth/core.tsx index c9dde344ad9..0f33fe08ab7 100644 --- a/apps/space/core/hooks/oauth/core.tsx +++ b/apps/space/core/hooks/oauth/core.tsx @@ -3,6 +3,7 @@ import Image from "next/image"; import { useSearchParams } from "next/navigation"; import { useTheme } from "next-themes"; import { API_BASE_URL } from "@plane/constants"; +import type { TOAuthConfigs, TOAuthOption } from "@plane/types"; // assets import GithubLightLogo from "/public/logos/github-black.png"; import GithubDarkLogo from "/public/logos/github-dark.svg"; @@ -11,8 +12,6 @@ import GoogleLogo from "/public/logos/google-logo.svg"; import GiteaLogo from "/public/logos/gitea-logo.svg"; // hooks import { useInstance } from "@/hooks/store/use-instance"; -// local imports -import type { TOAuthConfigs } from "./types"; export const useCoreOAuthConfig = (oauthActionText: string): TOAuthConfigs => { //router @@ -31,7 +30,7 @@ export const useCoreOAuthConfig = (oauthActionText: string): TOAuthConfigs => { config?.is_gitlab_enabled || config?.is_gitea_enabled)) || false; - const oAuthOptions = [ + const oAuthOptions: TOAuthOption[] = [ { id: "google", text: `${oauthActionText} with Google`, diff --git a/apps/space/core/hooks/oauth/extended.tsx b/apps/space/core/hooks/oauth/extended.tsx index c9349fe6665..d6793f9de68 100644 --- a/apps/space/core/hooks/oauth/extended.tsx +++ b/apps/space/core/hooks/oauth/extended.tsx @@ -1,5 +1,5 @@ -// local imports -import type { TOAuthConfigs } from "./types"; +// plane imports +import type { TOAuthConfigs } from "@plane/types"; export const useExtendedOAuthConfig = (_oauthActionText: string): TOAuthConfigs => ({ isOAuthEnabled: false, diff --git a/apps/space/core/hooks/oauth/index.ts b/apps/space/core/hooks/oauth/index.ts index 0d9e0148018..2b156487373 100644 --- a/apps/space/core/hooks/oauth/index.ts +++ b/apps/space/core/hooks/oauth/index.ts @@ -1,7 +1,8 @@ +// plane imports +import type { TOAuthConfigs } from "@plane/types"; // local imports import { useCoreOAuthConfig } from "./core"; import { useExtendedOAuthConfig } from "./extended"; -import type { TOAuthConfigs } from "./types"; export const useOAuthConfig = (oauthActionText: string = "Continue"): TOAuthConfigs => { const coreOAuthConfig = useCoreOAuthConfig(oauthActionText); diff --git a/apps/space/core/hooks/oauth/types.ts b/apps/space/core/hooks/oauth/types.ts deleted file mode 100644 index 1d7d1316291..00000000000 --- a/apps/space/core/hooks/oauth/types.ts +++ /dev/null @@ -1,12 +0,0 @@ -type TOAuthOption = { - id: string; - text: string; - icon: React.ReactNode; - onClick: () => void; - enabled?: boolean; -}; - -export type TOAuthConfigs = { - isOAuthEnabled: boolean; - oAuthOptions: TOAuthOption[]; -}; diff --git a/apps/web/core/hooks/oauth/core.tsx b/apps/web/core/hooks/oauth/core.tsx index bd703366476..b0a56669c8c 100644 --- a/apps/web/core/hooks/oauth/core.tsx +++ b/apps/web/core/hooks/oauth/core.tsx @@ -3,6 +3,7 @@ import Image from "next/image"; import { useSearchParams } from "next/navigation"; import { useTheme } from "next-themes"; import { API_BASE_URL } from "@plane/constants"; +import type { TOAuthConfigs, TOAuthOption } from "@plane/types"; // assets import GithubLightLogo from "/public/logos/github-black.png"; import GithubDarkLogo from "/public/logos/github-dark.svg"; @@ -11,8 +12,6 @@ import GoogleLogo from "/public/logos/google-logo.svg"; import GiteaLogo from "/public/logos/gitea-logo.svg"; // hooks import { useInstance } from "@/hooks/store/use-instance"; -// local imports -import type { TOAuthConfigs } from "./types"; export const useCoreOAuthConfig = (oauthActionText: string): TOAuthConfigs => { //router @@ -31,7 +30,7 @@ export const useCoreOAuthConfig = (oauthActionText: string): TOAuthConfigs => { config?.is_gitlab_enabled || config?.is_gitea_enabled)) || false; - const oAuthOptions = [ + const oAuthOptions: TOAuthOption[] = [ { id: "google", text: `${oauthActionText} with Google`, diff --git a/apps/web/core/hooks/oauth/extended.tsx b/apps/web/core/hooks/oauth/extended.tsx index e6ff8602c18..d6793f9de68 100644 --- a/apps/web/core/hooks/oauth/extended.tsx +++ b/apps/web/core/hooks/oauth/extended.tsx @@ -1,9 +1,7 @@ -// local imports -import type { TOAuthConfigs } from "./types"; +// plane imports +import type { TOAuthConfigs } from "@plane/types"; -export const useExtendedOAuthConfig = (_oauthActionText: string): TOAuthConfigs => { - return { - isOAuthEnabled: false, - oAuthOptions: [], - }; -}; +export const useExtendedOAuthConfig = (_oauthActionText: string): TOAuthConfigs => ({ + isOAuthEnabled: false, + oAuthOptions: [], +}); diff --git a/apps/web/core/hooks/oauth/index.ts b/apps/web/core/hooks/oauth/index.ts index 0d9e0148018..2b156487373 100644 --- a/apps/web/core/hooks/oauth/index.ts +++ b/apps/web/core/hooks/oauth/index.ts @@ -1,7 +1,8 @@ +// plane imports +import type { TOAuthConfigs } from "@plane/types"; // local imports import { useCoreOAuthConfig } from "./core"; import { useExtendedOAuthConfig } from "./extended"; -import type { TOAuthConfigs } from "./types"; export const useOAuthConfig = (oauthActionText: string = "Continue"): TOAuthConfigs => { const coreOAuthConfig = useCoreOAuthConfig(oauthActionText); diff --git a/apps/web/core/hooks/oauth/types.ts b/apps/web/core/hooks/oauth/types.ts deleted file mode 100644 index 1d7d1316291..00000000000 --- a/apps/web/core/hooks/oauth/types.ts +++ /dev/null @@ -1,12 +0,0 @@ -type TOAuthOption = { - id: string; - text: string; - icon: React.ReactNode; - onClick: () => void; - enabled?: boolean; -}; - -export type TOAuthConfigs = { - isOAuthEnabled: boolean; - oAuthOptions: TOAuthOption[]; -}; diff --git a/packages/types/src/instance/auth.ts b/packages/types/src/instance/auth.ts index 63b78b858ec..5aa1ac7b120 100644 --- a/packages/types/src/instance/auth.ts +++ b/packages/types/src/instance/auth.ts @@ -43,3 +43,16 @@ export type TGetBaseAuthenticationModeProps = { updateConfig: (key: TInstanceAuthenticationMethodKeys, value: string) => void; resolvedTheme: string | undefined; }; + +export type TOAuthOption = { + id: string; + text: string; + icon: React.ReactNode; + onClick: () => void; + enabled?: boolean; +}; + +export type TOAuthConfigs = { + isOAuthEnabled: boolean; + oAuthOptions: TOAuthOption[]; +}; From 68a37683b2e2a4166e54160a1c4520c6926c37f6 Mon Sep 17 00:00:00 2001 From: Prateek Shourya Date: Fri, 14 Nov 2025 19:32:53 +0530 Subject: [PATCH 3/4] feat: add new Gitea logo and update OAuth icon imports to use standard HTML img tags --- .../{public => app/assets}/logos/ldap.webp | Bin apps/space/core/hooks/oauth/core.tsx | 21 +++++++++--------- apps/web/core/hooks/oauth/core.tsx | 19 ++++++++-------- 3 files changed, 19 insertions(+), 21 deletions(-) rename apps/admin/{public => app/assets}/logos/ldap.webp (100%) diff --git a/apps/admin/public/logos/ldap.webp b/apps/admin/app/assets/logos/ldap.webp similarity index 100% rename from apps/admin/public/logos/ldap.webp rename to apps/admin/app/assets/logos/ldap.webp diff --git a/apps/space/core/hooks/oauth/core.tsx b/apps/space/core/hooks/oauth/core.tsx index 0f33fe08ab7..54fce85e056 100644 --- a/apps/space/core/hooks/oauth/core.tsx +++ b/apps/space/core/hooks/oauth/core.tsx @@ -1,15 +1,14 @@ -import Image from "next/image"; // plane imports import { useSearchParams } from "next/navigation"; import { useTheme } from "next-themes"; import { API_BASE_URL } from "@plane/constants"; import type { TOAuthConfigs, TOAuthOption } from "@plane/types"; // assets -import GithubLightLogo from "/public/logos/github-black.png"; -import GithubDarkLogo from "/public/logos/github-dark.svg"; -import GitlabLogo from "/public/logos/gitlab-logo.svg"; -import GoogleLogo from "/public/logos/google-logo.svg"; -import GiteaLogo from "/public/logos/gitea-logo.svg"; +import giteaLogo from "@/app/assets/logos/gitea-logo.svg?url"; +import githubLightLogo from "@/app/assets/logos/github-black.png?url"; +import githubDarkLogo from "@/app/assets/logos/github-dark.svg?url"; +import gitlabLogo from "@/app/assets/logos/gitlab-logo.svg?url"; +import googleLogo from "@/app/assets/logos/google-logo.svg?url"; // hooks import { useInstance } from "@/hooks/store/use-instance"; @@ -34,7 +33,7 @@ export const useCoreOAuthConfig = (oauthActionText: string): TOAuthConfigs => { { id: "google", text: `${oauthActionText} with Google`, - icon: Google Logo, + icon: Google Logo, onClick: () => { window.location.assign(`${API_BASE_URL}/auth/google/${next_path ? `?next_path=${next_path}` : ``}`); }, @@ -44,8 +43,8 @@ export const useCoreOAuthConfig = (oauthActionText: string): TOAuthConfigs => { id: "github", text: `${oauthActionText} with GitHub`, icon: ( - GitHub Logo { { id: "gitlab", text: `${oauthActionText} with GitLab`, - icon: GitLab Logo, + icon: GitLab Logo, onClick: () => { window.location.assign(`${API_BASE_URL}/auth/gitlab/${next_path ? `?next_path=${next_path}` : ``}`); }, @@ -68,7 +67,7 @@ export const useCoreOAuthConfig = (oauthActionText: string): TOAuthConfigs => { { id: "gitea", text: `${oauthActionText} with Gitea`, - icon: Gitea Logo, + icon: Gitea Logo, onClick: () => { window.location.assign(`${API_BASE_URL}/auth/gitea/${next_path ? `?next_path=${next_path}` : ``}`); }, diff --git a/apps/web/core/hooks/oauth/core.tsx b/apps/web/core/hooks/oauth/core.tsx index b0a56669c8c..ab084eefb1a 100644 --- a/apps/web/core/hooks/oauth/core.tsx +++ b/apps/web/core/hooks/oauth/core.tsx @@ -1,15 +1,14 @@ -import Image from "next/image"; // plane imports import { useSearchParams } from "next/navigation"; import { useTheme } from "next-themes"; import { API_BASE_URL } from "@plane/constants"; import type { TOAuthConfigs, TOAuthOption } from "@plane/types"; // assets -import GithubLightLogo from "/public/logos/github-black.png"; -import GithubDarkLogo from "/public/logos/github-dark.svg"; -import GitlabLogo from "/public/logos/gitlab-logo.svg"; -import GoogleLogo from "/public/logos/google-logo.svg"; -import GiteaLogo from "/public/logos/gitea-logo.svg"; +import giteaLogo from "@/app/assets/logos/gitea-logo.svg?url"; +import GithubLightLogo from "@/app/assets/logos/github-black.png?url"; +import GithubDarkLogo from "@/app/assets/logos/github-dark.svg?url"; +import gitlabLogo from "@/app/assets/logos/gitlab-logo.svg?url"; +import googleLogo from "@/app/assets/logos/google-logo.svg?url"; // hooks import { useInstance } from "@/hooks/store/use-instance"; @@ -34,7 +33,7 @@ export const useCoreOAuthConfig = (oauthActionText: string): TOAuthConfigs => { { id: "google", text: `${oauthActionText} with Google`, - icon: Google Logo, + icon: Google Logo, onClick: () => { window.location.assign(`${API_BASE_URL}/auth/google/${next_path ? `?next_path=${next_path}` : ``}`); }, @@ -44,7 +43,7 @@ export const useCoreOAuthConfig = (oauthActionText: string): TOAuthConfigs => { id: "github", text: `${oauthActionText} with GitHub`, icon: ( - { { id: "gitlab", text: `${oauthActionText} with GitLab`, - icon: GitLab Logo, + icon: GitLab Logo, onClick: () => { window.location.assign(`${API_BASE_URL}/auth/gitlab/${next_path ? `?next_path=${next_path}` : ``}`); }, @@ -68,7 +67,7 @@ export const useCoreOAuthConfig = (oauthActionText: string): TOAuthConfigs => { { id: "gitea", text: `${oauthActionText} with Gitea`, - icon: Gitea Logo, + icon: Gitea Logo, onClick: () => { window.location.assign(`${API_BASE_URL}/auth/gitea/${next_path ? `?next_path=${next_path}` : ``}`); }, From cee747a4198ca559a75eedaed956ff915af2ff5b Mon Sep 17 00:00:00 2001 From: Prateek Shourya Date: Thu, 20 Nov 2025 14:42:34 +0530 Subject: [PATCH 4/4] chore: remove unused authentication logos and upgrade button component --- apps/admin/app/assets/logos/ldap.webp | Bin 362 -> 0 bytes apps/admin/app/assets/logos/oidc-logo.svg | 11 ------- apps/admin/app/assets/logos/saml-logo.svg | 17 ---------- apps/admin/ce/components/common/index.ts | 1 - .../ce/components/common/upgrade-button.tsx | 19 ------------ apps/admin/core/hooks/oauth/core.tsx | 29 ------------------ apps/admin/core/hooks/oauth/index.ts | 3 -- packages/types/src/instance/auth-ee.ts | 1 + packages/types/src/instance/auth.ts | 16 +++++++++- 9 files changed, 16 insertions(+), 81 deletions(-) delete mode 100644 apps/admin/app/assets/logos/ldap.webp delete mode 100644 apps/admin/app/assets/logos/oidc-logo.svg delete mode 100644 apps/admin/app/assets/logos/saml-logo.svg delete mode 100644 apps/admin/ce/components/common/index.ts delete mode 100644 apps/admin/ce/components/common/upgrade-button.tsx create mode 100644 packages/types/src/instance/auth-ee.ts diff --git a/apps/admin/app/assets/logos/ldap.webp b/apps/admin/app/assets/logos/ldap.webp deleted file mode 100644 index c94a7d83ddbef3697c77fbd4339c1c7799b34f46..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 362 zcmV-w0hRtzNk&Fu0RRA3MM6+kP&iCh0RR9mFTe{BBB-%#%TiL=`KS5rzyJT1t*)a; zp$kn2^W>0SNHhvNZjYV^Ia?Ayb`%`~X;9VWnm`c%fPizhZQnK9R=w!iwwcW2C)nN^ zKVYld+XU29FuqBng!c&p%D=Qv4CICh6?_Wn7%UO1La54Y1}DcOpz)!K!$!0T9wj^+ zXG$k%L(Z${z}!%*JPk&w>JdYMM8L{bRRLC|WhlOy=i(R}->WNHv-#;?V-E{Y@7|D8xwL$J{ynV1y!sp0ua#OVOo?LI7)*{O$!?cyVlWIyf_ zG6);do1MSJBR+dkU>Yt&yLqUyz||grOdl4D2`NGmd7fi9cZ1$^{X}f0;F&%yE^~~6 zjKq;)FL%3Q&v)9QMFIj1REAWvWE9_h*ez;jvl(UIR6TX|Wx(EqYTUn#`TTkL+%8!N I*G8Ip1!q8~LjV8( diff --git a/apps/admin/app/assets/logos/oidc-logo.svg b/apps/admin/app/assets/logos/oidc-logo.svg deleted file mode 100644 index 68bc72d01fa..00000000000 --- a/apps/admin/app/assets/logos/oidc-logo.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/apps/admin/app/assets/logos/saml-logo.svg b/apps/admin/app/assets/logos/saml-logo.svg deleted file mode 100644 index 4cbb4f81d3e..00000000000 --- a/apps/admin/app/assets/logos/saml-logo.svg +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/apps/admin/ce/components/common/index.ts b/apps/admin/ce/components/common/index.ts deleted file mode 100644 index c6a1da8b627..00000000000 --- a/apps/admin/ce/components/common/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./upgrade-button"; diff --git a/apps/admin/ce/components/common/upgrade-button.tsx b/apps/admin/ce/components/common/upgrade-button.tsx deleted file mode 100644 index f7ad3e4de43..00000000000 --- a/apps/admin/ce/components/common/upgrade-button.tsx +++ /dev/null @@ -1,19 +0,0 @@ -"use client"; - -import React from "react"; -// icons -import { SquareArrowOutUpRight } from "lucide-react"; -// plane internal packages -import { getButtonStyling } from "@plane/propel/button"; -import { cn } from "@plane/utils"; - -export type TAuthUpgradeButtonProps = { - level: "workspace" | "instance"; -}; - -export const UpgradeButton: React.FC = () => ( - - Upgrade - - -); diff --git a/apps/admin/core/hooks/oauth/core.tsx b/apps/admin/core/hooks/oauth/core.tsx index b8a75f03a4b..5d9ae165a6a 100644 --- a/apps/admin/core/hooks/oauth/core.tsx +++ b/apps/admin/core/hooks/oauth/core.tsx @@ -8,9 +8,6 @@ import githubLightModeImage from "@/app/assets/logos/github-black.png?url"; import githubDarkModeImage from "@/app/assets/logos/github-white.png?url"; import gitlabLogo from "@/app/assets/logos/gitlab-logo.svg?url"; import googleLogo from "@/app/assets/logos/google-logo.svg?url"; -import ldapLogo from "@/app/assets/logos/ldap.webp?url"; -import oidcLogo from "@/app/assets/logos/oidc-logo.svg?url"; -import samlLogo from "@/app/assets/logos/saml-logo.svg?url"; // components import { EmailCodesConfiguration } from "@/components/authentication/email-config-switch"; import { GiteaConfiguration } from "@/components/authentication/gitea-config"; @@ -18,8 +15,6 @@ import { GithubConfiguration } from "@/components/authentication/github-config"; import { GitlabConfiguration } from "@/components/authentication/gitlab-config"; import { GoogleConfiguration } from "@/components/authentication/google-config"; import { PasswordLoginConfiguration } from "@/components/authentication/password-config-switch"; -// plane admin components -import { UpgradeButton } from "@/plane-admin/components/common"; // Authentication methods export const getCoreAuthenticationModesMap: ( @@ -79,28 +74,4 @@ export const getCoreAuthenticationModesMap: ( icon: Gitea Logo, config: , }, - oidc: { - key: "oidc", - name: "OIDC", - description: "Authenticate your users via the OpenID Connect protocol.", - icon: OIDC Logo, - config: , - unavailable: true, - }, - saml: { - key: "saml", - name: "SAML", - description: "Authenticate your users via the Security Assertion Markup Language protocol.", - icon: SAML Logo, - config: , - unavailable: true, - }, - ldap: { - key: "ldap", - name: "LDAP", - description: "Authenticate your users via LDAP directory services.", - icon: LDAP Logo, - config: , - unavailable: true, - }, }); diff --git a/apps/admin/core/hooks/oauth/index.ts b/apps/admin/core/hooks/oauth/index.ts index 59b224ed136..2982814e5b0 100644 --- a/apps/admin/core/hooks/oauth/index.ts +++ b/apps/admin/core/hooks/oauth/index.ts @@ -13,9 +13,6 @@ export const useAuthenticationModes = (props: TGetAuthenticationModeProps): TIns authenticationModes["github"], authenticationModes["gitlab"], authenticationModes["gitea"], - authenticationModes["oidc"], - authenticationModes["saml"], - authenticationModes["ldap"], ]; return availableAuthenticationModes; diff --git a/packages/types/src/instance/auth-ee.ts b/packages/types/src/instance/auth-ee.ts new file mode 100644 index 00000000000..0ffe5501ccf --- /dev/null +++ b/packages/types/src/instance/auth-ee.ts @@ -0,0 +1 @@ +export type TExtendedInstanceAuthenticationModeKeys = never; \ No newline at end of file diff --git a/packages/types/src/instance/auth.ts b/packages/types/src/instance/auth.ts index 5aa1ac7b120..93b287d2da1 100644 --- a/packages/types/src/instance/auth.ts +++ b/packages/types/src/instance/auth.ts @@ -1,5 +1,19 @@ +import type { TExtendedInstanceAuthenticationModeKeys } from "./auth-ee"; + +export type TCoreInstanceAuthenticationModeKeys = + | "unique-codes" + | "passwords-login" + | "google" + | "github" + | "gitlab" + | "gitea"; + +export type TInstanceAuthenticationModeKeys = + | TCoreInstanceAuthenticationModeKeys + | TExtendedInstanceAuthenticationModeKeys; + export type TInstanceAuthenticationModes = { - key: "unique-codes" | "passwords-login" | "google" | "github" | "gitlab" | "gitea" | "oidc" | "saml" | "ldap"; + key: TInstanceAuthenticationModeKeys; name: string; description: string; icon: React.ReactNode;