oauth2-provider/src/provider.ts

23 lines
598 B
TypeScript

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();
}
}
}