core: removed BackstageIdentity type

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2022-01-04 23:11:24 +01:00
parent 51fbedc445
commit 94c02b4246
12 changed files with 45 additions and 39 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/core-plugin-api': minor
---
Removed deprecated `BackstageIdentity` type, which was replaced by `BackstageIdentityResponse`.
+8 -8
View File
@@ -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<BackstageIdentity | undefined>;
): Promise<BackstageIdentityResponse | undefined>;
// (undocumented)
getProfile(options?: AuthRequestOptions): Promise<ProfileInfo | undefined>;
// (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<BackstageIdentity | undefined>;
): Promise<BackstageIdentityResponse | undefined>;
// (undocumented)
getIdToken(options?: AuthRequestOptions): Promise<string>;
// (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<BackstageIdentity | undefined>;
): Promise<BackstageIdentityResponse | undefined>;
// (undocumented)
getProfile(options?: AuthRequestOptions): Promise<ProfileInfo | undefined>;
// (undocumented)
@@ -555,7 +555,7 @@ export class SamlAuth
export type SamlSession = {
userId: string;
profile: ProfileInfo;
backstageIdentity: BackstageIdentity;
backstageIdentity: BackstageIdentityResponse;
};
// @public
@@ -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 = {
@@ -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;
};
@@ -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<BackstageIdentity | undefined> {
): Promise<BackstageIdentityResponse | undefined> {
const session = await this.sessionManager.getSession(options);
return session?.backstageIdentity;
}
@@ -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<GithubSession> = z.object({
@@ -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<BackstageIdentity | undefined> {
): Promise<BackstageIdentityResponse | undefined> {
const session = await this.sessionManager.getSession(options);
return session?.backstageIdentity;
}
@@ -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;
};
@@ -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<BackstageIdentity | undefined> {
): Promise<BackstageIdentityResponse | undefined> {
const session = await this.sessionManager.getSession(options);
return session?.backstageIdentity;
}
@@ -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 */
-3
View File
@@ -216,9 +216,6 @@ export type AuthRequestOptions = {
instantPopup?: boolean;
};
// @public @deprecated
export type BackstageIdentity = BackstageIdentityResponse;
// @public
export type BackstageIdentityApi = {
getBackstageIdentity(
@@ -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.
*