diff --git a/src/external/dto/req/createExternalToken.dto.ts b/src/external/dto/req/createExternalToken.dto.ts index a8e61bd..f814032 100644 --- a/src/external/dto/req/createExternalToken.dto.ts +++ b/src/external/dto/req/createExternalToken.dto.ts @@ -1,6 +1,8 @@ +import { ApiProperty } from '@nestjs/swagger'; import { IsString } from 'class-validator'; export class CreateExternalTokenDto { + @ApiProperty() @IsString() idpToken: string; } diff --git a/src/external/dto/res/externalInfoRes.dto.ts b/src/external/dto/res/externalInfoRes.dto.ts index fcfec1b..db37cec 100644 --- a/src/external/dto/res/externalInfoRes.dto.ts +++ b/src/external/dto/res/externalInfoRes.dto.ts @@ -69,5 +69,6 @@ class GroupWithRoleResDto implements GroupWithRole { } export class ExternalInfoResDto { + @ApiProperty({ type: GroupWithRoleResDto, isArray: true }) list: GroupWithRoleResDto[]; } diff --git a/src/external/dto/res/externalTokenRes.dto.ts b/src/external/dto/res/externalTokenRes.dto.ts index 6419fa7..8fb6f2d 100644 --- a/src/external/dto/res/externalTokenRes.dto.ts +++ b/src/external/dto/res/externalTokenRes.dto.ts @@ -1,3 +1,6 @@ +import { ApiProperty } from '@nestjs/swagger'; + export class ExternalTokenResDto { + @ApiProperty() token: string; } diff --git a/src/external/external.controller.ts b/src/external/external.controller.ts index 5fc0e20..b5529fb 100644 --- a/src/external/external.controller.ts +++ b/src/external/external.controller.ts @@ -1,5 +1,7 @@ import { Body, Controller, Get, Post, Req, UseGuards } from '@nestjs/common'; import { + ApiBasicAuth, + ApiBearerAuth, ApiForbiddenResponse, ApiInternalServerErrorResponse, ApiOperation, @@ -29,6 +31,7 @@ export class ExternalController { @ApiUnauthorizedResponse() @ApiForbiddenResponse() @ApiInternalServerErrorResponse() + @ApiBasicAuth('client') @Post() async createCertToken( @GetClient() client: Client, @@ -44,6 +47,7 @@ export class ExternalController { @UseGuards(ExternalGuard) @ApiUnauthorizedResponse() @ApiInternalServerErrorResponse() + @ApiBearerAuth('external') @Get('info') async getCertInfo(@Req() req: any): Promise { return this.externalService.getExternalInfo(req.user); diff --git a/src/main.ts b/src/main.ts index 80db8ff..593b8c8 100644 --- a/src/main.ts +++ b/src/main.ts @@ -12,6 +12,12 @@ async function bootstrap() { .setTitle('Groups API') .setDescription('The Groups API') .setVersion('1.0') + .addBearerAuth( + { + type: 'http', + }, + 'external', + ) .addBasicAuth( { type: 'http',