import { RequestHandler } from 'express'; import * as controller from './controller'; import { middleware } from './middleware'; import { RenderOAuth2Decision, OAuth2, OAuth2AdapterModel } from './model/model'; export class OAuth2Provider implements OAuth2 { public bearer = middleware; public controller = controller; constructor ( public model: OAuth2AdapterModel, public decision: RenderOAuth2Decision, ) {} express(): RequestHandler { return (req, _res, next) => { console.debug('OAuth2 Injected into request'); req.oauth2 = this; next(); } } }