refactor: remove api-key authguard (#12675)

This commit is contained in:
Lauris Skraucis 2023-12-04 14:25:24 +01:00 committed by GitHub
parent 6cca86f74c
commit a3955980d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,9 +14,7 @@ import {
HttpStatus, HttpStatus,
Logger, Logger,
Res, Res,
UseGuards,
} from "@nestjs/common"; } from "@nestjs/common";
import { AuthGuard } from "@nestjs/passport";
@Controller({ @Controller({
path: "oauth-clients", path: "oauth-clients",
@ -28,7 +26,6 @@ export class OAuthClientController {
constructor(private readonly oauthClientRepository: OAuthClientRepository) {} constructor(private readonly oauthClientRepository: OAuthClientRepository) {}
@Post("/") @Post("/")
@UseGuards(AuthGuard("api-key"))
@HttpCode(HttpStatus.CREATED) @HttpCode(HttpStatus.CREATED)
async createOAuthClient( async createOAuthClient(
@Res({ passthrough: true }) res: Response, @Res({ passthrough: true }) res: Response,
@ -49,7 +46,6 @@ export class OAuthClientController {
} }
@Get("/") @Get("/")
@UseGuards(AuthGuard("api-key"))
@HttpCode(HttpStatus.OK) @HttpCode(HttpStatus.OK)
async getOAuthClients(@Res({ passthrough: true }) res: Response) { async getOAuthClients(@Res({ passthrough: true }) res: Response) {
const userId = res.locals.apiKey?.userId; const userId = res.locals.apiKey?.userId;
@ -57,14 +53,12 @@ export class OAuthClientController {
} }
@Get("/:clientId") @Get("/:clientId")
@UseGuards(AuthGuard("api-key"))
@HttpCode(HttpStatus.OK) @HttpCode(HttpStatus.OK)
async getOAuthClientById(@Param("clientId") clientId: string) { async getOAuthClientById(@Param("clientId") clientId: string) {
return this.oauthClientRepository.getOAuthClient(clientId); return this.oauthClientRepository.getOAuthClient(clientId);
} }
@Put("/:clientId") @Put("/:clientId")
@UseGuards(AuthGuard("api-key"))
@HttpCode(HttpStatus.OK) @HttpCode(HttpStatus.OK)
async updateOAuthClient( async updateOAuthClient(
@Param("clientId") clientId: string, @Param("clientId") clientId: string,
@ -75,7 +69,6 @@ export class OAuthClientController {
} }
@Delete("/:clientId") @Delete("/:clientId")
@UseGuards(AuthGuard("api-key"))
@HttpCode(HttpStatus.NO_CONTENT) @HttpCode(HttpStatus.NO_CONTENT)
async deleteOAuthClient(@Param("clientId") clientId: string) { async deleteOAuthClient(@Param("clientId") clientId: string) {
this.logger.log(`Deleting OAuth Client with ID: ${clientId}`); this.logger.log(`Deleting OAuth Client with ID: ${clientId}`);