core-app-api: Remove GithubSession and SamlSession types

Signed-off-by: Johan Haals <johan.haals@gmail.com>
This commit is contained in:
Johan Haals
2022-03-02 13:50:18 +01:00
parent 677081fb5d
commit f3cce3dcf7
6 changed files with 6 additions and 94 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/core-app-api': minor
---
**BREAKING**: Removed export of `GithubSession` and `SamlSession` which are only used internally.
-18
View File
@@ -380,17 +380,6 @@ export class GithubAuth {
static normalizeScope(scope?: string): Set<string>;
}
// @public @deprecated
export type GithubSession = {
providerInfo: {
accessToken: string;
scopes: Set<string>;
expiresAt?: Date;
};
profile: ProfileInfo;
backstageIdentity: BackstageIdentityResponse;
};
// @public
export class GitlabAuth {
// (undocumented)
@@ -532,13 +521,6 @@ export class SamlAuth
signOut(): Promise<void>;
}
// @public @deprecated
export type SamlSession = {
userId: string;
profile: ProfileInfo;
backstageIdentity: BackstageIdentityResponse;
};
// @public
export type SignInPageProps = {
onSignInSuccess(identityApi: IdentityApi): void;
@@ -14,5 +14,4 @@
* limitations under the License.
*/
export type { GithubSession } from './types';
export { default as GithubAuth } from './GithubAuth';
@@ -1,62 +0,0 @@
/*
* Copyright 2020 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {
ProfileInfo,
BackstageIdentityResponse,
} 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: {
accessToken: string;
scopes: Set<string>;
expiresAt?: Date;
};
profile: ProfileInfo;
// TODO(Rugvip): This should be made optional once the type is no longer public
backstageIdentity: BackstageIdentityResponse;
};
export const githubSessionSchema: z.ZodSchema<GithubSession> = z.object({
providerInfo: z.object({
accessToken: z.string(),
scopes: z.set(z.string()),
expiresAt: z.date().optional(),
}),
profile: z.object({
email: z.string().optional(),
displayName: z.string().optional(),
picture: z.string().optional(),
}),
backstageIdentity: z.object({
id: z.string(),
token: z.string(),
identity: z.object({
type: z.literal('user'),
userEntityRef: z.string(),
ownershipEntityRefs: z.array(z.string()),
}),
}),
});
@@ -14,4 +14,4 @@
* limitations under the License.
*/
export { default as SamlAuth } from './SamlAuth';
export type { ExportedSamlSession as SamlSession } from './types';
// export type { ExportedSamlSession as SamlSession } from './types';
@@ -20,18 +20,6 @@ import {
} from '@backstage/core-plugin-api';
import { z } from 'zod';
/**
* Session information for SAML auth.
*
* @public
* @deprecated This type is internal and will be removed
*/
export type ExportedSamlSession = {
userId: string;
profile: ProfileInfo;
backstageIdentity: BackstageIdentityResponse;
};
/** @internal */
export type SamlSession = {
profile: ProfileInfo;