mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-18 10:49:09 +00:00
FIX: do not use User() on non-authenticated routes
This commit is contained in:
+26
-1
@@ -79,6 +79,16 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/AuthRefreshAccessTokenReq"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "",
|
||||
@@ -3287,7 +3297,7 @@
|
||||
}
|
||||
},
|
||||
"info": {
|
||||
"title": "Maestro - feat/update-connection",
|
||||
"title": "Maestro - fix/refresh-token",
|
||||
"description": "Documentation for Maestro gateway",
|
||||
"version": "1.0.0",
|
||||
"contact": {}
|
||||
@@ -3473,6 +3483,21 @@
|
||||
"mfaStatus"
|
||||
]
|
||||
},
|
||||
"AuthRefreshAccessTokenReq": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"refreshToken": {
|
||||
"type": "string"
|
||||
},
|
||||
"customerName": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"refreshToken",
|
||||
"customerName"
|
||||
]
|
||||
},
|
||||
"CreateConnectorDto": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@@ -11,7 +11,6 @@ import {
|
||||
} from '@nestjs/common';
|
||||
import { ApiTags } from '@nestjs/swagger';
|
||||
import {
|
||||
AuthRefreshAccessTokenRequest,
|
||||
AuthChangePasswordRequest,
|
||||
AuthResetPasswordRequest,
|
||||
AuthVerifyResetPasswordCodeRequest,
|
||||
@@ -31,7 +30,11 @@ import { DadosferaLogger } from '@dadosfera/dadosfera-logs';
|
||||
import { GrpcToHttpExceptionFilter } from '../../error/grpc-to-http-exception.filter';
|
||||
import { RequestUser, User } from 'src/authentication/user.decorator';
|
||||
import { Metadata } from '@grpc/grpc-js';
|
||||
import { AuthSignInReq, AuthSignInRes } from './dtos/login';
|
||||
import {
|
||||
AuthRefreshAccessTokenReq,
|
||||
AuthSignInReq,
|
||||
AuthSignInRes,
|
||||
} from './dtos/login';
|
||||
import { PackTheMetadata } from 'src/utils/ PackTheMetadata';
|
||||
|
||||
@ApiTags('Auth')
|
||||
@@ -78,14 +81,14 @@ export class AuthController {
|
||||
@Post('refresh-access-token')
|
||||
@HttpCode(HttpStatus.OK)
|
||||
async refreshAccessToken(
|
||||
@Body() { refreshToken }: AuthRefreshAccessTokenRequest,
|
||||
@Body()
|
||||
{ refreshToken, customerName: customer_name }: AuthRefreshAccessTokenReq,
|
||||
@Headers('Dadosfera-Lang') language: string,
|
||||
@User() user: RequestUser,
|
||||
) {
|
||||
this.logger.info('/auth - RefreshAccessToken');
|
||||
|
||||
const metadata = PackTheMetadata({
|
||||
customer_name: user.customer_name,
|
||||
customer_name,
|
||||
language,
|
||||
});
|
||||
|
||||
|
||||
@@ -97,3 +97,10 @@ export class AuthSignInRes implements AuthSignInResponse {
|
||||
@ApiPropertyOptional()
|
||||
termsOfUse?: TermsOfUseStatus;
|
||||
}
|
||||
|
||||
export class AuthRefreshAccessTokenReq {
|
||||
@ApiProperty()
|
||||
refreshToken: string;
|
||||
@ApiProperty()
|
||||
customerName: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user