mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-23 02:06:29 -05:00
openapi: adds auth to all public api routes
See: https://docs.nestjs.com/openapi/security Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
parent
8d89614a4d
commit
74fd7abfb2
5 changed files with 12 additions and 0 deletions
|
@ -25,7 +25,9 @@ import { NotesService } from '../../../notes/notes.service';
|
|||
import { UserInfoDto } from '../../../users/user-info.dto';
|
||||
import { UsersService } from '../../../users/users.service';
|
||||
import { TokenAuthGuard } from '../../../auth/token-auth.guard';
|
||||
import { ApiSecurity } from '@nestjs/swagger';
|
||||
|
||||
@ApiSecurity('token')
|
||||
@Controller('me')
|
||||
export class MeController {
|
||||
constructor(
|
||||
|
|
|
@ -28,7 +28,9 @@ import { ConsoleLoggerService } from '../../../logger/console-logger.service';
|
|||
import { MediaService } from '../../../media/media.service';
|
||||
import { MulterFile } from '../../../media/multer-file.interface';
|
||||
import { TokenAuthGuard } from '../../../auth/token-auth.guard';
|
||||
import { ApiSecurity } from '@nestjs/swagger';
|
||||
|
||||
@ApiSecurity('token')
|
||||
@Controller('media')
|
||||
export class MediaController {
|
||||
constructor(
|
||||
|
|
|
@ -7,7 +7,9 @@
|
|||
import { Controller, Get, UseGuards } from '@nestjs/common';
|
||||
import { MonitoringService } from '../../../monitoring/monitoring.service';
|
||||
import { TokenAuthGuard } from '../../../auth/token-auth.guard';
|
||||
import { ApiSecurity } from '@nestjs/swagger';
|
||||
|
||||
@ApiSecurity('token')
|
||||
@Controller('monitoring')
|
||||
export class MonitoringController {
|
||||
constructor(private monitoringService: MonitoringService) {}
|
||||
|
|
|
@ -24,7 +24,9 @@ import { NotesService } from '../../../notes/notes.service';
|
|||
import { RevisionsService } from '../../../revisions/revisions.service';
|
||||
import { MarkdownBody } from '../../utils/markdownbody-decorator';
|
||||
import { TokenAuthGuard } from '../../../auth/token-auth.guard';
|
||||
import { ApiSecurity } from '@nestjs/swagger';
|
||||
|
||||
@ApiSecurity('token')
|
||||
@Controller('notes')
|
||||
export class NotesController {
|
||||
constructor(
|
||||
|
|
|
@ -26,6 +26,10 @@ async function bootstrap() {
|
|||
const swaggerOptions = new DocumentBuilder()
|
||||
.setTitle('HedgeDoc')
|
||||
.setVersion('2.0-dev')
|
||||
.addSecurity('token', {
|
||||
type: 'http',
|
||||
scheme: 'bearer',
|
||||
})
|
||||
.build();
|
||||
const document = SwaggerModule.createDocument(app, swaggerOptions);
|
||||
SwaggerModule.setup('apidoc', app, document);
|
||||
|
|
Loading…
Reference in a new issue