Merge pull request #8838 from backstage/rugvip/sessions

core-app-api: fix saml and github session types
This commit is contained in:
Ben Lambert
2022-01-10 14:56:19 +01:00
committed by GitHub
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
@@ -399,7 +399,7 @@ export class GithubAuth implements OAuthApi, SessionApi {
signOut(): Promise<void>;
}
// @public
// @public @deprecated
export type GithubSession = {
providerInfo: {
accessToken: string;
@@ -551,7 +551,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(),