Fixed a bug where expired cookies would not be refreshed.
Signed-off-by: Hitoshi Kamezaki <kamezaki@ap-com.co.jp> update
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/backend-app-api': patch
|
||||
---
|
||||
|
||||
Fixed a bug where expired cookies would not be refreshed.
|
||||
+17
-7
@@ -235,14 +235,24 @@ class DefaultHttpAuthService implements HttpAuthService {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const existingCredentials = await this.#auth.authenticate(existingCookie, {
|
||||
allowLimitedAccess: true,
|
||||
});
|
||||
if (!this.#auth.isPrincipal(existingCredentials, 'user')) {
|
||||
return undefined;
|
||||
}
|
||||
try {
|
||||
const existingCredentials = await this.#auth.authenticate(
|
||||
existingCookie,
|
||||
{
|
||||
allowLimitedAccess: true,
|
||||
},
|
||||
);
|
||||
if (!this.#auth.isPrincipal(existingCredentials, 'user')) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return existingCredentials.expiresAt;
|
||||
return existingCredentials.expiresAt;
|
||||
} catch (error) {
|
||||
if (error.name === 'AuthenticationError') {
|
||||
return undefined;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user