From 3acf16b5a47903a66416b6f1bbc86cd2ab211ecc Mon Sep 17 00:00:00 2001 From: "Robert St. John" Date: Thu, 14 Nov 2024 14:46:09 -0700 Subject: [PATCH] refactor(service): users/auth: call next middleware in oauth ingress protocol --- service/src/ingress/ingress.protocol.oauth.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/service/src/ingress/ingress.protocol.oauth.ts b/service/src/ingress/ingress.protocol.oauth.ts index 9946c2271..6d0583b4b 100644 --- a/service/src/ingress/ingress.protocol.oauth.ts +++ b/service/src/ingress/ingress.protocol.oauth.ts @@ -125,13 +125,17 @@ export function createWebBinding(idp: IdentityProvider, passport: Authenticator, const oauth2Strategy = new OAuth2ProfileStrategy(strategyOptions, profileURL, verify) const handleIngressFlowRequest = express.Router() .get('/callback', (req, res, next) => { - passport.authenticate(oauth2Strategy, + const finishIngressFlow = passport.authenticate( + oauth2Strategy, (err: Error | null | undefined, account: IdentityProviderUser, info: OAuth2Info) => { if (err) { return next(err) } req.user = { admittingFromIdentityProvider: { idpName: idp.name, account, flowState: info.state }} - })(req, res, next) + next() + } + ) + finishIngressFlow(req, res, next) }) return { ingressResponseType: IngressResponseType.Redirect,