Feature / Refactor to session based auth in backend #9
|
@ -41,9 +41,9 @@ export class AuthController {
|
|||
description: 'User signin successfully',
|
||||
type: LoginResponseDto,
|
||||
})
|
||||
@HttpCode(HttpStatus.OK)
|
||||
@Public()
|
||||
@Post('signin')
|
||||
@HttpCode(HttpStatus.OK)
|
||||
public async signin(
|
||||
@Res({ passthrough: true }) response: Response,
|
||||
@Req() request: Request,
|
||||
|
@ -52,6 +52,11 @@ export class AuthController {
|
|||
return await this.authService.signin(userCredentials, response, request);
|
||||
}
|
||||
|
||||
@ApiCreatedResponse({
|
||||
description: 'User tokens refreshed successfully',
|
||||
type: AccessTokenDto,
|
||||
})
|
||||
@HttpCode(HttpStatus.OK)
|
||||
@Public()
|
||||
@Post('refresh')
|
||||
public async refreshToken(@Req() request: Request): Promise<AccessTokenDto> {
|
||||
|
@ -62,48 +67,9 @@ export class AuthController {
|
|||
description: 'User signed out successfully',
|
||||
type: Boolean,
|
||||
})
|
||||
@Post('logout')
|
||||
@HttpCode(HttpStatus.OK)
|
||||
@Post('logout')
|
||||
public async logout(@GetCurrentUserId() userId: string): Promise<boolean> {
|
||||
return this.authService.logout(userId);
|
||||
}
|
||||
|
||||
// @ApiHeader({
|
||||
// name: 'Authorization',
|
||||
// required: true,
|
||||
// schema: {
|
||||
// example: 'Bearer <refresh_token>',
|
||||
// },
|
||||
// })
|
||||
// @ApiCreatedResponse({
|
||||
// description: 'User tokens refreshed successfully',
|
||||
// type: TokensDto,
|
||||
// })
|
||||
// @Public()
|
||||
// @UseGuards(RefreshTokenGuard)
|
||||
// @Post('refresh')
|
||||
// @HttpCode(HttpStatus.OK)
|
||||
// public async refresh(
|
||||
// @GetCurrentUserId() userId: string,
|
||||
// @GetCurrentUser('refresh_token') refresh_token: string
|
||||
// ): Promise<TokensDto> {
|
||||
// return this.authService.refresh(userId, refresh_token);
|
||||
// }
|
||||
|
||||
// @ApiHeader({
|
||||
// name: 'Authorization',
|
||||
// required: true,
|
||||
// schema: {
|
||||
// example: 'Bearer <access_token>',
|
||||
// },
|
||||
// })
|
||||
// @ApiCreatedResponse({
|
||||
// description: 'Token validity checked successfully',
|
||||
// type: Boolean,
|
||||
// })
|
||||
// @Post('check-token')
|
||||
// @HttpCode(HttpStatus.OK)
|
||||
// public checkTokenValidity(): Promise<boolean> {
|
||||
// return this.authService.checkTokenValidity();
|
||||
// }
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue