chore: cleanup changeset and refactor
Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
@@ -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,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,
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user