Skip to content

Commit

Permalink
refactor(service): users/auth: call next middleware in oauth ingress …
Browse files Browse the repository at this point in the history
…protocol
  • Loading branch information
restjohn committed Nov 14, 2024
1 parent 1794201 commit 3acf16b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions service/src/ingress/ingress.protocol.oauth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 3acf16b

Please sign in to comment.