diff --git a/.changeset/shaggy-emus-look.md b/.changeset/shaggy-emus-look.md new file mode 100644 index 0000000000..df8a1fe6fe --- /dev/null +++ b/.changeset/shaggy-emus-look.md @@ -0,0 +1,7 @@ +--- +'@backstage/core-app-api': patch +--- + +Fixed an issue where valid SAML and GitHub sessions would be considered invalid and not be stored. + +Deprecated the `SamlSession` and `GithubSession` types. diff --git a/packages/core-app-api/api-report.md b/packages/core-app-api/api-report.md index f94979f975..9b04f4077c 100644 --- a/packages/core-app-api/api-report.md +++ b/packages/core-app-api/api-report.md @@ -410,7 +410,7 @@ export class GithubAuth implements OAuthApi, SessionApi { signOut(): Promise; } -// @public +// @public @deprecated export type GithubSession = { providerInfo: { accessToken: string; @@ -562,7 +562,7 @@ export class SamlAuth signOut(): Promise; } -// @public +// @public @deprecated export type SamlSession = { userId: string; profile: ProfileInfo; diff --git a/packages/core-app-api/src/apis/implementations/auth/github/types.ts b/packages/core-app-api/src/apis/implementations/auth/github/types.ts index fc289635ed..50b3ed871d 100644 --- a/packages/core-app-api/src/apis/implementations/auth/github/types.ts +++ b/packages/core-app-api/src/apis/implementations/auth/github/types.ts @@ -17,10 +17,13 @@ import { ProfileInfo, BackstageIdentity } from '@backstage/core-plugin-api'; import { z } from 'zod'; +// TODO(Rugvip): Make GithubSession internal + /** * Session information for GitHub auth. * * @public + * @deprecated This type is internal and will be removed */ export type GithubSession = { providerInfo: { @@ -29,6 +32,7 @@ export type GithubSession = { expiresAt?: Date; }; profile: ProfileInfo; + // TODO(Rugvip): This should be made optional once the type is no longer public backstageIdentity: BackstageIdentity; }; diff --git a/packages/core-app-api/src/apis/implementations/auth/saml/index.ts b/packages/core-app-api/src/apis/implementations/auth/saml/index.ts index f9dc2895af..2e749a0648 100644 --- a/packages/core-app-api/src/apis/implementations/auth/saml/index.ts +++ b/packages/core-app-api/src/apis/implementations/auth/saml/index.ts @@ -14,4 +14,4 @@ * limitations under the License. */ export { default as SamlAuth } from './SamlAuth'; -export type { SamlSession } from './types'; +export type { ExportedSamlSession as SamlSession } from './types'; diff --git a/packages/core-app-api/src/apis/implementations/auth/saml/types.ts b/packages/core-app-api/src/apis/implementations/auth/saml/types.ts index 2e7c67553e..3920e3ac86 100644 --- a/packages/core-app-api/src/apis/implementations/auth/saml/types.ts +++ b/packages/core-app-api/src/apis/implementations/auth/saml/types.ts @@ -21,15 +21,22 @@ import { z } from 'zod'; * Session information for SAML auth. * * @public + * @deprecated This type is internal and will be removed */ -export type SamlSession = { +export type ExportedSamlSession = { userId: string; profile: ProfileInfo; backstageIdentity: BackstageIdentity; }; +/** @internal */ +export type SamlSession = { + profile: ProfileInfo; + backstageIdentity: BackstageIdentity; +}; + +/** @internal */ export const samlSessionSchema: z.ZodSchema = z.object({ - userId: z.string(), profile: z.object({ email: z.string().optional(), displayName: z.string().optional(),