From a7a03e67f984d788ecdffa88d9d7b3a8c68331e1 Mon Sep 17 00:00:00 2001 From: Thomas <4159106+dtslvr@users.noreply.github.com> Date: Tue, 11 Apr 2023 17:48:33 +0200 Subject: [PATCH] Deprecate GET auth endpoint --- apps/api/src/app/auth/auth.controller.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/apps/api/src/app/auth/auth.controller.ts b/apps/api/src/app/auth/auth.controller.ts index 715c284f4..1050fe5bf 100644 --- a/apps/api/src/app/auth/auth.controller.ts +++ b/apps/api/src/app/auth/auth.controller.ts @@ -7,6 +7,7 @@ import { Controller, Get, HttpException, + Param, Post, Req, Res, @@ -32,6 +33,26 @@ export class AuthController { private readonly webAuthService: WebAuthService ) {} + /** + * @deprecated + */ + @Get('anonymous/:accessToken') + public async accessTokenLoginGet( + @Param('accessToken') accessToken: string + ): Promise { + try { + const authToken = await this.authService.validateAnonymousLogin( + accessToken + ); + return { authToken }; + } catch { + throw new HttpException( + getReasonPhrase(StatusCodes.FORBIDDEN), + StatusCodes.FORBIDDEN + ); + } + } + @Post('anonymous') public async accessTokenLogin( @Body() body: { accessToken: string }