core-app-api: fix + deprecate saml and github session types

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2022-01-10 11:26:50 +01:00
parent 7f3894be1c
commit 34442cd5cf
5 changed files with 23 additions and 5 deletions
+7
View File
@@ -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.
+2 -2
View File
@@ -410,7 +410,7 @@ export class GithubAuth implements OAuthApi, SessionApi {
signOut(): Promise<void>;
}
// @public
// @public @deprecated
export type GithubSession = {
providerInfo: {
accessToken: string;
@@ -562,7 +562,7 @@ export class SamlAuth
signOut(): Promise<void>;
}
// @public
// @public @deprecated
export type SamlSession = {
userId: string;
profile: ProfileInfo;
@@ -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;
};
@@ -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';
@@ -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<SamlSession> = z.object({
userId: z.string(),
profile: z.object({
email: z.string().optional(),
displayName: z.string().optional(),