Authentication middleware implementation on Gateway + Documentation implementation w/ auth

This commit is contained in:
rodrigo.zamboni
2022-01-27 18:18:31 -03:00
parent 332e0f0d80
commit a824a8768b
34 changed files with 4945 additions and 4060 deletions
+15 -6
View File
@@ -1,19 +1,28 @@
import axios from 'axios';
require("dotenv").config();
import { RestInputsService } from './rest-inputs.service';
import { CreateInputGrpcClientDto } from 'src/inputs/dto/create-input-grpc-client.dto';
import { UpdateInputGrpcClientDto } from 'src/inputs/dto/update-input-grpc-client.dto';
import { Controller, Get, Post, Body, Patch, Param, Delete, Put, Headers } from '@nestjs/common';
import { AuthenticateController } from 'src/utils/Authenticate';
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
import { CreateRestInputDto } from './dto/create-rest-input.dto';
import { UpdateRestInputDto } from './dto/update-rest-input.dto';
import { testConnectionDTO } from './dto/testConnection.dto';
@ApiTags('Inputs')
@ApiBearerAuth()
@Controller('input')
export class RestInputsController {
constructor(private readonly restInputsService: RestInputsService) {}
@Get('/test-auth/')
async testauth(){
return "Auth Success"
}
@Post('/test-connection/')
async testConnection(@Body() body){
async testConnection(@Body() body:testConnectionDTO){
const authController = new AuthenticateController()
const accessToken = await authController.authenticate()
@@ -33,7 +42,7 @@ export class RestInputsController {
}
@Post()
async create(@Body() body: CreateInputGrpcClientDto){
async create(@Body() body: CreateRestInputDto){
const authController = new AuthenticateController()
const accessToken = await authController.authenticate()
@@ -92,7 +101,7 @@ export class RestInputsController {
@Put(':id')
async update(
@Body() body: UpdateInputGrpcClientDto,
@Body() body: UpdateRestInputDto,
@Param() id: string,
){
const authController = new AuthenticateController()