From 6c7952ee85a5f7860d086f6e6ac02562acef4a07 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Sat, 22 Jul 2023 10:42:39 +0200 Subject: [PATCH] auth-backend: move CookieConfigurer to auth-node Signed-off-by: Patrik Oldsberg --- plugins/auth-backend/src/providers/types.ts | 19 +++---------------- plugins/auth-node/src/index.ts | 1 + plugins/auth-node/src/types.ts | 20 ++++++++++++++++++++ 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/plugins/auth-backend/src/providers/types.ts b/plugins/auth-backend/src/providers/types.ts index e382148b5d..89c7e92c35 100644 --- a/plugins/auth-backend/src/providers/types.ts +++ b/plugins/auth-backend/src/providers/types.ts @@ -24,6 +24,7 @@ import { LoggerService } from '@backstage/backend-plugin-api'; import { AuthResolverCatalogUserQuery as _AuthResolverCatalogUserQuery, AuthResolverContext as _AuthResolverContext, + CookieConfigurer as _CookieConfigurer, ProfileInfo as _ProfileInfo, } from '@backstage/plugin-auth-node'; import { OAuthStartRequest } from '../lib/oauth/types'; @@ -41,24 +42,10 @@ export type AuthResolverCatalogUserQuery = _AuthResolverCatalogUserQuery; export type AuthResolverContext = _AuthResolverContext; /** - * The callback used to resolve the cookie configuration for auth providers that use cookies. * @public + * @deprecated import from `@backstage/plugin-auth-node` instead */ -export type CookieConfigurer = (ctx: { - /** ID of the auth provider that this configuration applies to */ - providerId: string; - /** The externally reachable base URL of the auth-backend plugin */ - baseUrl: string; - /** The configured callback URL of the auth provider */ - callbackUrl: string; - /** The origin URL of the app */ - appOrigin: string; -}) => { - domain: string; - path: string; - secure: boolean; - sameSite?: 'none' | 'lax' | 'strict'; -}; +export type CookieConfigurer = _CookieConfigurer; /** @public */ export type AuthProviderConfig = { diff --git a/plugins/auth-node/src/index.ts b/plugins/auth-node/src/index.ts index 7a18040abc..e5ef84e02c 100644 --- a/plugins/auth-node/src/index.ts +++ b/plugins/auth-node/src/index.ts @@ -31,6 +31,7 @@ export type { BackstageIdentityResponse, BackstageSignInResult, BackstageUserIdentity, + CookieConfigurer, IdentityApiGetIdentityRequest, ProfileInfo, TokenParams, diff --git a/plugins/auth-node/src/types.ts b/plugins/auth-node/src/types.ts index 823f06320f..383fe50a74 100644 --- a/plugins/auth-node/src/types.ts +++ b/plugins/auth-node/src/types.ts @@ -189,3 +189,23 @@ export type ProfileInfo = { */ picture?: string; }; + +/** + * The callback used to resolve the cookie configuration for auth providers that use cookies. + * @public + */ +export type CookieConfigurer = (ctx: { + /** ID of the auth provider that this configuration applies to */ + providerId: string; + /** The externally reachable base URL of the auth-backend plugin */ + baseUrl: string; + /** The configured callback URL of the auth provider */ + callbackUrl: string; + /** The origin URL of the app */ + appOrigin: string; +}) => { + domain: string; + path: string; + secure: boolean; + sameSite?: 'none' | 'lax' | 'strict'; +};