From 94c02b424695907f28822efbca86ac2a72023d31 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Tue, 4 Jan 2022 23:11:24 +0100 Subject: [PATCH] core: removed BackstageIdentity type Signed-off-by: Patrik Oldsberg --- .changeset/silver-crews-compare.md | 5 +++++ packages/core-app-api/api-report.md | 16 ++++++++-------- .../auth/bitbucket/BitbucketAuth.ts | 4 ++-- .../apis/implementations/auth/bitbucket/types.ts | 7 +++++-- .../implementations/auth/github/GithubAuth.ts | 6 +++--- .../apis/implementations/auth/github/types.ts | 7 +++++-- .../apis/implementations/auth/oauth2/OAuth2.ts | 6 +++--- .../apis/implementations/auth/oauth2/types.ts | 7 +++++-- .../apis/implementations/auth/saml/SamlAuth.ts | 6 +++--- .../src/apis/implementations/auth/saml/types.ts | 9 ++++++--- packages/core-plugin-api/api-report.md | 3 --- .../core-plugin-api/src/apis/definitions/auth.ts | 8 -------- 12 files changed, 45 insertions(+), 39 deletions(-) create mode 100644 .changeset/silver-crews-compare.md diff --git a/.changeset/silver-crews-compare.md b/.changeset/silver-crews-compare.md new file mode 100644 index 0000000000..b211737e8a --- /dev/null +++ b/.changeset/silver-crews-compare.md @@ -0,0 +1,5 @@ +--- +'@backstage/core-plugin-api': minor +--- + +Removed deprecated `BackstageIdentity` type, which was replaced by `BackstageIdentityResponse`. diff --git a/packages/core-app-api/api-report.md b/packages/core-app-api/api-report.md index cc38618a00..b813d1a9a5 100644 --- a/packages/core-app-api/api-report.md +++ b/packages/core-app-api/api-report.md @@ -19,8 +19,8 @@ import { atlassianAuthApiRef } from '@backstage/core-plugin-api'; import { auth0AuthApiRef } from '@backstage/core-plugin-api'; import { AuthProviderInfo } from '@backstage/core-plugin-api'; import { AuthRequestOptions } from '@backstage/core-plugin-api'; -import { BackstageIdentity } from '@backstage/core-plugin-api'; import { BackstageIdentityApi } from '@backstage/core-plugin-api'; +import { BackstageIdentityResponse } from '@backstage/core-plugin-api'; import { BackstagePlugin } from '@backstage/core-plugin-api'; import { bitbucketAuthApiRef } from '@backstage/core-plugin-api'; import { ComponentType } from 'react'; @@ -280,7 +280,7 @@ export type BitbucketSession = { expiresAt?: Date; }; profile: ProfileInfo; - backstageIdentity: BackstageIdentity; + backstageIdentity: BackstageIdentityResponse; }; // @public @@ -386,7 +386,7 @@ export class GithubAuth implements OAuthApi, SessionApi { // (undocumented) getBackstageIdentity( options?: AuthRequestOptions, - ): Promise; + ): Promise; // (undocumented) getProfile(options?: AuthRequestOptions): Promise; // (undocumented) @@ -407,7 +407,7 @@ export type GithubSession = { expiresAt?: Date; }; profile: ProfileInfo; - backstageIdentity: BackstageIdentity; + backstageIdentity: BackstageIdentityResponse; }; // @public @@ -465,7 +465,7 @@ export class OAuth2 // (undocumented) getBackstageIdentity( options?: AuthRequestOptions, - ): Promise; + ): Promise; // (undocumented) getIdToken(options?: AuthRequestOptions): Promise; // (undocumented) @@ -492,7 +492,7 @@ export type OAuth2Session = { expiresAt: Date; }; profile: ProfileInfo; - backstageIdentity: BackstageIdentity; + backstageIdentity: BackstageIdentityResponse; }; // @public @@ -540,7 +540,7 @@ export class SamlAuth // (undocumented) getBackstageIdentity( options?: AuthRequestOptions, - ): Promise; + ): Promise; // (undocumented) getProfile(options?: AuthRequestOptions): Promise; // (undocumented) @@ -555,7 +555,7 @@ export class SamlAuth export type SamlSession = { userId: string; profile: ProfileInfo; - backstageIdentity: BackstageIdentity; + backstageIdentity: BackstageIdentityResponse; }; // @public diff --git a/packages/core-app-api/src/apis/implementations/auth/bitbucket/BitbucketAuth.ts b/packages/core-app-api/src/apis/implementations/auth/bitbucket/BitbucketAuth.ts index c97cccc6ed..7c5d4f3fc0 100644 --- a/packages/core-app-api/src/apis/implementations/auth/bitbucket/BitbucketAuth.ts +++ b/packages/core-app-api/src/apis/implementations/auth/bitbucket/BitbucketAuth.ts @@ -15,7 +15,7 @@ */ import { - BackstageIdentity, + BackstageIdentityResponse, bitbucketAuthApiRef, ProfileInfo, } from '@backstage/core-plugin-api'; @@ -30,7 +30,7 @@ export type BitbucketAuthResponse = { expiresInSeconds: number; }; profile: ProfileInfo; - backstageIdentity: BackstageIdentity; + backstageIdentity: BackstageIdentityResponse; }; const DEFAULT_PROVIDER = { diff --git a/packages/core-app-api/src/apis/implementations/auth/bitbucket/types.ts b/packages/core-app-api/src/apis/implementations/auth/bitbucket/types.ts index 5309fffcd8..6e62603408 100644 --- a/packages/core-app-api/src/apis/implementations/auth/bitbucket/types.ts +++ b/packages/core-app-api/src/apis/implementations/auth/bitbucket/types.ts @@ -14,7 +14,10 @@ * limitations under the License. */ -import { ProfileInfo, BackstageIdentity } from '@backstage/core-plugin-api'; +import { + ProfileInfo, + BackstageIdentityResponse, +} from '@backstage/core-plugin-api'; /** * Session information for Bitbucket auth. @@ -28,5 +31,5 @@ export type BitbucketSession = { expiresAt?: Date; }; profile: ProfileInfo; - backstageIdentity: BackstageIdentity; + backstageIdentity: BackstageIdentityResponse; }; diff --git a/packages/core-app-api/src/apis/implementations/auth/github/GithubAuth.ts b/packages/core-app-api/src/apis/implementations/auth/github/GithubAuth.ts index cb0f792524..dc2c15bc16 100644 --- a/packages/core-app-api/src/apis/implementations/auth/github/GithubAuth.ts +++ b/packages/core-app-api/src/apis/implementations/auth/github/GithubAuth.ts @@ -16,7 +16,7 @@ import { AuthRequestOptions, - BackstageIdentity, + BackstageIdentityResponse, OAuthApi, ProfileInfo, SessionApi, @@ -41,7 +41,7 @@ export type GithubAuthResponse = { expiresInSeconds?: number; }; profile: ProfileInfo; - backstageIdentity: BackstageIdentity; + backstageIdentity: BackstageIdentityResponse; }; const DEFAULT_PROVIDER = { @@ -145,7 +145,7 @@ export default class GithubAuth implements OAuthApi, SessionApi { async getBackstageIdentity( options: AuthRequestOptions = {}, - ): Promise { + ): Promise { const session = await this.sessionManager.getSession(options); return session?.backstageIdentity; } 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 50b3ed871d..0ef662905f 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 @@ -14,7 +14,10 @@ * limitations under the License. */ -import { ProfileInfo, BackstageIdentity } from '@backstage/core-plugin-api'; +import { + ProfileInfo, + BackstageIdentityResponse, +} from '@backstage/core-plugin-api'; import { z } from 'zod'; // TODO(Rugvip): Make GithubSession internal @@ -33,7 +36,7 @@ export type GithubSession = { }; profile: ProfileInfo; // TODO(Rugvip): This should be made optional once the type is no longer public - backstageIdentity: BackstageIdentity; + backstageIdentity: BackstageIdentityResponse; }; export const githubSessionSchema: z.ZodSchema = z.object({ diff --git a/packages/core-app-api/src/apis/implementations/auth/oauth2/OAuth2.ts b/packages/core-app-api/src/apis/implementations/auth/oauth2/OAuth2.ts index 18644a037f..ad2d04cb56 100644 --- a/packages/core-app-api/src/apis/implementations/auth/oauth2/OAuth2.ts +++ b/packages/core-app-api/src/apis/implementations/auth/oauth2/OAuth2.ts @@ -19,7 +19,7 @@ import { RefreshingAuthSessionManager } from '../../../../lib/AuthSessionManager import { SessionManager } from '../../../../lib/AuthSessionManager/types'; import { AuthRequestOptions, - BackstageIdentity, + BackstageIdentityResponse, OAuthApi, OpenIdConnectApi, ProfileInfo, @@ -48,7 +48,7 @@ export type OAuth2Response = { expiresInSeconds: number; }; profile: ProfileInfo; - backstageIdentity: BackstageIdentity; + backstageIdentity: BackstageIdentityResponse; }; const DEFAULT_PROVIDER = { @@ -159,7 +159,7 @@ export default class OAuth2 async getBackstageIdentity( options: AuthRequestOptions = {}, - ): Promise { + ): Promise { const session = await this.sessionManager.getSession(options); return session?.backstageIdentity; } diff --git a/packages/core-app-api/src/apis/implementations/auth/oauth2/types.ts b/packages/core-app-api/src/apis/implementations/auth/oauth2/types.ts index fb8b0e6c64..242cd94154 100644 --- a/packages/core-app-api/src/apis/implementations/auth/oauth2/types.ts +++ b/packages/core-app-api/src/apis/implementations/auth/oauth2/types.ts @@ -14,7 +14,10 @@ * limitations under the License. */ -import { ProfileInfo, BackstageIdentity } from '@backstage/core-plugin-api'; +import { + ProfileInfo, + BackstageIdentityResponse, +} from '@backstage/core-plugin-api'; export type { OAuth2CreateOptions } from './OAuth2'; /** @@ -30,5 +33,5 @@ export type OAuth2Session = { expiresAt: Date; }; profile: ProfileInfo; - backstageIdentity: BackstageIdentity; + backstageIdentity: BackstageIdentityResponse; }; diff --git a/packages/core-app-api/src/apis/implementations/auth/saml/SamlAuth.ts b/packages/core-app-api/src/apis/implementations/auth/saml/SamlAuth.ts index 98038b2f41..dad62f1d06 100644 --- a/packages/core-app-api/src/apis/implementations/auth/saml/SamlAuth.ts +++ b/packages/core-app-api/src/apis/implementations/auth/saml/SamlAuth.ts @@ -16,12 +16,12 @@ import { AuthRequestOptions, - BackstageIdentity, BackstageIdentityApi, ProfileInfo, ProfileInfoApi, SessionApi, SessionState, + BackstageIdentityResponse, } from '@backstage/core-plugin-api'; import { Observable } from '@backstage/types'; import { DirectAuthConnector } from '../../../../lib/AuthConnector'; @@ -35,7 +35,7 @@ import { SamlSession, samlSessionSchema } from './types'; export type SamlAuthResponse = { profile: ProfileInfo; - backstageIdentity: BackstageIdentity; + backstageIdentity: BackstageIdentityResponse; }; const DEFAULT_PROVIDER = { @@ -95,7 +95,7 @@ export default class SamlAuth async getBackstageIdentity( options: AuthRequestOptions = {}, - ): Promise { + ): Promise { const session = await this.sessionManager.getSession(options); return session?.backstageIdentity; } 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 3920e3ac86..f1345fd154 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 @@ -14,7 +14,10 @@ * limitations under the License. */ -import { BackstageIdentity, ProfileInfo } from '@backstage/core-plugin-api'; +import { + BackstageIdentityResponse, + ProfileInfo, +} from '@backstage/core-plugin-api'; import { z } from 'zod'; /** @@ -26,13 +29,13 @@ import { z } from 'zod'; export type ExportedSamlSession = { userId: string; profile: ProfileInfo; - backstageIdentity: BackstageIdentity; + backstageIdentity: BackstageIdentityResponse; }; /** @internal */ export type SamlSession = { profile: ProfileInfo; - backstageIdentity: BackstageIdentity; + backstageIdentity: BackstageIdentityResponse; }; /** @internal */ diff --git a/packages/core-plugin-api/api-report.md b/packages/core-plugin-api/api-report.md index 875c27dae9..ab9f6621b9 100644 --- a/packages/core-plugin-api/api-report.md +++ b/packages/core-plugin-api/api-report.md @@ -216,9 +216,6 @@ export type AuthRequestOptions = { instantPopup?: boolean; }; -// @public @deprecated -export type BackstageIdentity = BackstageIdentityResponse; - // @public export type BackstageIdentityApi = { getBackstageIdentity( diff --git a/packages/core-plugin-api/src/apis/definitions/auth.ts b/packages/core-plugin-api/src/apis/definitions/auth.ts index a362d16750..e5a41d8973 100644 --- a/packages/core-plugin-api/src/apis/definitions/auth.ts +++ b/packages/core-plugin-api/src/apis/definitions/auth.ts @@ -239,14 +239,6 @@ export type BackstageIdentityResponse = { identity: BackstageUserIdentity; }; -/** - * The old exported symbol for {@link BackstageIdentityResponse}. - * - * @public - * @deprecated use {@link BackstageIdentityResponse} instead. - */ -export type BackstageIdentity = BackstageIdentityResponse; - /** * Profile information of the user. *