From 8def26140453a0723a13b8043d50927894570a89 Mon Sep 17 00:00:00 2001 From: Tejas Mehta Date: Mon, 7 Oct 2024 00:36:55 -0400 Subject: [PATCH] Add api key auth to all bearer points (#121) --- packages/api-gateway/src/modules/auth/auth.controller.ts | 4 ++-- packages/api-gateway/src/modules/email/email.controller.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/api-gateway/src/modules/auth/auth.controller.ts b/packages/api-gateway/src/modules/auth/auth.controller.ts index ab7ba8d..40c09f0 100644 --- a/packages/api-gateway/src/modules/auth/auth.controller.ts +++ b/packages/api-gateway/src/modules/auth/auth.controller.ts @@ -79,7 +79,7 @@ export class AuthController implements OnModuleInit { type: 'string', }, }) - @ApiBearerAuth() + @ApiBearerAuth('API_Key') async getJWT(@Headers('Authorization') apiKey?: string) { const key = apiKey?.replace('Bearer ', ''); if (key === undefined) { @@ -157,7 +157,7 @@ export class AuthController implements OnModuleInit { type: 'string', }, }) - @ApiBearerAuth() + @ApiBearerAuth('API_Key') @Delete('/key') async deleteApiKey(@Headers('Authorization') apiKey?: string) { const key = apiKey?.replace('Bearer ', ''); diff --git a/packages/api-gateway/src/modules/email/email.controller.ts b/packages/api-gateway/src/modules/email/email.controller.ts index 10b6b11..77dc42f 100644 --- a/packages/api-gateway/src/modules/email/email.controller.ts +++ b/packages/api-gateway/src/modules/email/email.controller.ts @@ -35,7 +35,7 @@ import { ApiKey } from 'src/decorators/api_key.decorator'; const { EMAIL_SERVICE_NAME } = EmailProto; -@ApiBearerAuth() +@ApiBearerAuth('API_Key') @ApiTags('email') @Controller('email') export class EmailController implements OnModuleInit {