From 1bed9a35c02ac7c215f905dc0bfc358a667285e8 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Thu, 9 May 2024 09:50:12 +0200 Subject: [PATCH] core-app-api: remove fallback to provider expiration Signed-off-by: Patrik Oldsberg --- .changeset/slimy-donkeys-laugh.md | 5 +++++ .../src/apis/implementations/auth/oauth2/OAuth2.ts | 9 ++------- 2 files changed, 7 insertions(+), 7 deletions(-) create mode 100644 .changeset/slimy-donkeys-laugh.md diff --git a/.changeset/slimy-donkeys-laugh.md b/.changeset/slimy-donkeys-laugh.md new file mode 100644 index 0000000000..c18102e68c --- /dev/null +++ b/.changeset/slimy-donkeys-laugh.md @@ -0,0 +1,5 @@ +--- +'@backstage/core-app-api': patch +--- + +The Backstage identity session expiration check will no longer fall back to using the provider expiration. This was introduced to smooth out the rollout of Backstage release 1.18, and is no longer needed. 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 6be7cfc89d..dbad031652 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 @@ -116,16 +116,11 @@ export default class OAuth2 }, }; if (backstageIdentity) { - // TODO(Rugvip): This fallback can be removed a few releases after 1.18. It's there to avoid - // breaking deployments that update their frontend before updating their backend. - const expInSec = - backstageIdentity.expiresInSeconds ?? - res.providerInfo.expiresInSeconds; session.backstageIdentity = { token: backstageIdentity.token, identity: backstageIdentity.identity, - expiresAt: expInSec - ? new Date(Date.now() + expInSec * 1000) + expiresAt: backstageIdentity.expiresInSeconds + ? new Date(Date.now() + backstageIdentity.expiresInSeconds * 1000) : undefined, }; }