From 7b17bbf93a3bb0694f1508d6a5f8fc4ac5ab9355 Mon Sep 17 00:00:00 2001 From: Ryan Date: Thu, 13 Aug 2026 16:48:39 -0600 Subject: [PATCH] feat(access): build the basic SSO types --- packages/types/src/lib/context/context.ts | 7 +++++++ packages/types/src/lib/context/netlify-user.ts | 8 ++++++++ packages/types/src/main.ts | 1 + 3 files changed, 16 insertions(+) create mode 100644 packages/types/src/lib/context/netlify-user.ts diff --git a/packages/types/src/lib/context/context.ts b/packages/types/src/lib/context/context.ts index efa9b077e..3cea2e66b 100644 --- a/packages/types/src/lib/context/context.ts +++ b/packages/types/src/lib/context/context.ts @@ -1,5 +1,6 @@ import { Cookies } from './cookies.js' import { Geo } from './geo.js' +import { NetlifyUser } from './netlify-user.js' import { Server } from './server.js' import { Site } from './site.js' @@ -43,5 +44,11 @@ export interface Context { server: Server site: Site url: URL + + /** + * The Netlify user who passed SSO site protection for this request. + */ + user?: NetlifyUser + waitUntil: (promise: Promise) => void } diff --git a/packages/types/src/lib/context/netlify-user.ts b/packages/types/src/lib/context/netlify-user.ts new file mode 100644 index 000000000..a8b49a51d --- /dev/null +++ b/packages/types/src/lib/context/netlify-user.ts @@ -0,0 +1,8 @@ +export interface NetlifyUser { + /** Netlify user ID of the signed-in visitor. */ + id: string + /** Email address on the visitor's Netlify account. */ + email?: string + /** When the visitor's access to this site expires. */ + expiresAt: Date +} diff --git a/packages/types/src/main.ts b/packages/types/src/main.ts index f41015809..45436d685 100644 --- a/packages/types/src/main.ts +++ b/packages/types/src/main.ts @@ -34,4 +34,5 @@ export type { FormSubmittedEvent, FormSubmittedHandler } from './lib/events/subm export type { EnvironmentVariables } from './lib/environment-variables.js' export type { FunctionRegion } from './lib/function-regions.js' export type { NetlifyGlobal } from './lib/globals.js' +export type { NetlifyUser } from './lib/context/netlify-user.js' export type { Site } from './lib/context/site.js'