From 820543164030b506dacec633c459c21801d678ef Mon Sep 17 00:00:00 2001 From: Benny Joo Date: Tue, 28 Jan 2025 21:49:06 +0000 Subject: [PATCH] migrate /auth/sso pages (#18951) --- .../auth/sso/[provider]/page.tsx | 20 +++++++++++++++++++ .../auth/sso/direct/page.tsx | 20 +++++++++++++++++++ .../app/future/auth/sso/[provider]/page.tsx | 13 ------------ apps/web/app/future/auth/sso/direct/page.tsx | 13 ------------ apps/web/middleware.ts | 12 +---------- apps/web/pages/auth/sso/[provider].tsx | 12 ----------- apps/web/pages/auth/sso/direct.tsx | 12 ----------- 7 files changed, 41 insertions(+), 61 deletions(-) create mode 100644 apps/web/app/(use-page-wrapper)/auth/sso/[provider]/page.tsx create mode 100644 apps/web/app/(use-page-wrapper)/auth/sso/direct/page.tsx delete mode 100644 apps/web/app/future/auth/sso/[provider]/page.tsx delete mode 100644 apps/web/app/future/auth/sso/direct/page.tsx delete mode 100644 apps/web/pages/auth/sso/[provider].tsx delete mode 100644 apps/web/pages/auth/sso/direct.tsx diff --git a/apps/web/app/(use-page-wrapper)/auth/sso/[provider]/page.tsx b/apps/web/app/(use-page-wrapper)/auth/sso/[provider]/page.tsx new file mode 100644 index 0000000000..cb3572e78f --- /dev/null +++ b/apps/web/app/(use-page-wrapper)/auth/sso/[provider]/page.tsx @@ -0,0 +1,20 @@ +import { withAppDirSsr } from "app/WithAppDirSsr"; +import type { PageProps } from "app/_types"; +import { cookies, headers } from "next/headers"; + +import { buildLegacyCtx } from "@lib/buildLegacyCtx"; + +import { getServerSideProps } from "@server/lib/auth/sso/[provider]/getServerSideProps"; + +import type { SSOProviderPageProps } from "~/auth/sso/provider-view"; +import SSOProviderView from "~/auth/sso/provider-view"; + +const getData = withAppDirSsr(getServerSideProps); +const ServerPage = async ({ params, searchParams }: PageProps) => { + const context = buildLegacyCtx(headers(), cookies(), params, searchParams); + const props = await getData(context); + + return ; +}; + +export default ServerPage; diff --git a/apps/web/app/(use-page-wrapper)/auth/sso/direct/page.tsx b/apps/web/app/(use-page-wrapper)/auth/sso/direct/page.tsx new file mode 100644 index 0000000000..a80dac7d74 --- /dev/null +++ b/apps/web/app/(use-page-wrapper)/auth/sso/direct/page.tsx @@ -0,0 +1,20 @@ +import { withAppDirSsr } from "app/WithAppDirSsr"; +import type { PageProps } from "app/_types"; +import { cookies, headers } from "next/headers"; + +import { buildLegacyCtx } from "@lib/buildLegacyCtx"; + +import { getServerSideProps } from "@server/lib/auth/sso/direct/getServerSideProps"; + +import type { SSODirectPageProps } from "~/auth/sso/direct-view"; +import SSODirectView from "~/auth/sso/direct-view"; + +const getData = withAppDirSsr(getServerSideProps); +const ServerPage = async ({ params, searchParams }: PageProps) => { + const context = buildLegacyCtx(headers(), cookies(), params, searchParams); + const props = await getData(context); + + return ; +}; + +export default ServerPage; diff --git a/apps/web/app/future/auth/sso/[provider]/page.tsx b/apps/web/app/future/auth/sso/[provider]/page.tsx deleted file mode 100644 index efac8c1f18..0000000000 --- a/apps/web/app/future/auth/sso/[provider]/page.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { withAppDirSsr } from "app/WithAppDirSsr"; -import { WithLayout } from "app/layoutHOC"; - -import { getServerSideProps } from "@server/lib/auth/sso/[provider]/getServerSideProps"; - -import type { SSOProviderPageProps } from "~/auth/sso/provider-view"; -import SSOProviderView from "~/auth/sso/provider-view"; - -export default WithLayout({ - getLayout: null, - Page: SSOProviderView, - getData: withAppDirSsr(getServerSideProps), -})<"P">; diff --git a/apps/web/app/future/auth/sso/direct/page.tsx b/apps/web/app/future/auth/sso/direct/page.tsx deleted file mode 100644 index a920c02ba3..0000000000 --- a/apps/web/app/future/auth/sso/direct/page.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { withAppDirSsr } from "app/WithAppDirSsr"; -import { WithLayout } from "app/layoutHOC"; - -import { getServerSideProps } from "@server/lib/auth/sso/direct/getServerSideProps"; - -import type { SSODirectPageProps } from "~/auth/sso/direct-view"; -import SSODirectView from "~/auth/sso/direct-view"; - -export default WithLayout({ - getLayout: null, - Page: SSODirectView, - getData: withAppDirSsr(getServerSideProps), -})<"P">; diff --git a/apps/web/middleware.ts b/apps/web/middleware.ts index 5c7dd13201..9aa6a85da1 100644 --- a/apps/web/middleware.ts +++ b/apps/web/middleware.ts @@ -155,17 +155,7 @@ export const config = { "/api/auth/signup", "/api/trpc/:path*", "/login", - "/auth/login", - "/auth/logout", - "/auth/error", - "/auth/signin", - "/auth/oauth2/authorize", - "/auth/platform/authorize", - "/auth/verify-email-change", - "/auth/verify-email", - "/auth/verify", - "/auth/saml-idp", - "/auth/setup", + "/auth/:path*", /** * Paths required by routingForms.handle */ diff --git a/apps/web/pages/auth/sso/[provider].tsx b/apps/web/pages/auth/sso/[provider].tsx deleted file mode 100644 index 8671d02292..0000000000 --- a/apps/web/pages/auth/sso/[provider].tsx +++ /dev/null @@ -1,12 +0,0 @@ -import PageWrapper from "@components/PageWrapper"; - -import { getServerSideProps } from "@server/lib/auth/sso/[provider]/getServerSideProps"; - -import type { SSOProviderPageProps } from "~/auth/sso/provider-view"; -import SSOProviderView from "~/auth/sso/provider-view"; - -const Page = (props: SSOProviderPageProps) => ; - -Page.PageWrapper = PageWrapper; -export default Page; -export { getServerSideProps }; diff --git a/apps/web/pages/auth/sso/direct.tsx b/apps/web/pages/auth/sso/direct.tsx deleted file mode 100644 index c5b0f1aeec..0000000000 --- a/apps/web/pages/auth/sso/direct.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import PageWrapper from "@components/PageWrapper"; - -import { getServerSideProps } from "@server/lib/auth/sso/direct/getServerSideProps"; - -import type { SSODirectPageProps } from "~/auth/sso/direct-view"; -import SSODirectView from "~/auth/sso/direct-view"; - -const Page = (props: SSODirectPageProps) => ; - -Page.PageWrapper = PageWrapper; -export default Page; -export { getServerSideProps };