icynet-auth-server/src/modules/features/oauth2/oauth2.controller.ts

47 lines
1.2 KiB
TypeScript

import { Controller, Get, Next, Post, Req, Res } from '@nestjs/common';
import { NextFunction, Request, Response } from 'express';
import { OAuth2Service } from './oauth2.service';
@Controller('oauth2')
export class OAuth2Controller {
constructor(private _service: OAuth2Service) {}
// These requests are just passed straight on to the provider controller
@Get('authorize')
public authorizeGetWrapper(
@Req() req: Request,
@Res() res: Response,
@Next() next: NextFunction,
): void {
return this._service.oauth.controller.authorization(req, res, next);
}
@Post('authorize')
public authorizePostWrapper(
@Req() req: Request,
@Res() res: Response,
@Next() next: NextFunction,
): void {
return this._service.oauth.controller.authorization(req, res, next);
}
@Post('token')
public tokenWrapper(
@Req() req: Request,
@Res() res: Response,
@Next() next: NextFunction,
): void {
return this._service.oauth.controller.token(req, res, next);
}
@Post('introspect')
public introspectWrapper(
@Req() req: Request,
@Res() res: Response,
@Next() next: NextFunction,
): void {
return this._service.oauth.controller.introspection(req, res, next);
}
}