From 18b5dc980ca6cf58e0730a732d9efa1e10672677 Mon Sep 17 00:00:00 2001 From: Anderson Feitosa Date: Wed, 7 Dec 2022 12:58:58 -0300 Subject: [PATCH] FEAT: add verify access token path --- docsfera.json | 16 +++++++++++++++- src/modules/auth/auth.controller.ts | 13 ++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/docsfera.json b/docsfera.json index 391d880..7e45f94 100644 --- a/docsfera.json +++ b/docsfera.json @@ -264,6 +264,20 @@ ] } }, + "/auth/verify-access-token": { + "get": { + "operationId": "AuthController_verifyAccessToken", + "parameters": [], + "responses": { + "200": { + "description": "" + } + }, + "tags": [ + "Auth" + ] + } + }, "/connectors": { "post": { "operationId": "ConnectorController_uploadConnector", @@ -3233,7 +3247,7 @@ } }, "info": { - "title": "Maestro - feat/view-table", + "title": "Maestro - feature/verify-refresh-token", "description": "Documentation for Maestro gateway", "version": "1.0.0", "contact": {} diff --git a/src/modules/auth/auth.controller.ts b/src/modules/auth/auth.controller.ts index 503dc64..ce0406b 100644 --- a/src/modules/auth/auth.controller.ts +++ b/src/modules/auth/auth.controller.ts @@ -7,6 +7,7 @@ import { HttpStatus, Inject, UseFilters, + Get, } from '@nestjs/common'; import { ApiTags } from '@nestjs/swagger'; import { @@ -21,7 +22,10 @@ import { } from '@dadosfera/protospack-v2/dist/lib/Duc/interfaces/messages'; import { PERMISSIONS_GROUPS } from 'src/authentication/permissions.enum'; -import { RequireAllPermissions } from 'src/authentication/authentication.decorator'; +import { + Authenticated, + RequireAllPermissions, +} from 'src/authentication/authentication.decorator'; import { AuthClientService } from './auth.service'; import { DadosferaLogger } from '@dadosfera/dadosfera-logs'; import { GrpcToHttpExceptionFilter } from '../../error/grpc-to-http-exception.filter'; @@ -185,4 +189,11 @@ export class AuthController { return this.authClient.verifyTotp({ accessToken, totp }); } + + @Authenticated() + @Get('verify-access-token') + @HttpCode(HttpStatus.OK) + verifyAccessToken() { + return { access_token_status: 'valid' }; + } }