chore: cleanup changeset and refactor

Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
blam
2025-02-18 15:09:27 +01:00
parent edb88e21d2
commit 0afc4f21d8
3 changed files with 9 additions and 12 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-auth-backend-module-oidc-provider': patch
---
Simplify the `start` method in the `authenticator` to just return the helper promise
+1 -2
View File
@@ -1,6 +1,5 @@
---
'@backstage/plugin-auth-backend-module-oidc-provider': patch
'@backstage/plugin-auth-node': patch
---
Fixed a potential issue when using the Backstage's `PassportOAuthAuthenticatorHelper` to implement a custom OAuth Authenticator. The issue occurs during the start stage of the authorization process when the custom `passport.Strategy` calls the `error()` to propagate an error message. Because the `error` function wasn't being set Backstage would throw a `this.error is not a function` error thus hiding the original cause.
Add an `error` handler to the `strategy` to reject the `executeRedirectStrategy`
@@ -135,7 +135,7 @@ export const oidcAuthenticator = createOAuthAuthenticator({
async start(input, ctx) {
const { initializedPrompt, promise } = ctx;
const { helper, strategy } = await promise;
const { helper } = await promise;
const options: Record<string, string> = {
scope: input.scope,
state: input.state,
@@ -146,15 +146,8 @@ export const oidcAuthenticator = createOAuthAuthenticator({
options.prompt = prompt;
}
return new Promise((resolve, reject) => {
strategy.error = reject;
return helper
.start(input, {
...options,
})
.then(resolve)
.catch(reject);
return helper.start(input, {
...options,
});
},