mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-26 03:33:58 -05:00
refactor(public-api): use TokenAuthGuard on controller not method level
As the public api is nearly completely protected by the TokenAuthGuard it seems unnecessarily verbose to add the guard to every method in the controllers, when an annotation at the top of the controller would be sufficient. Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
parent
d142cbadeb
commit
2bc8c0d6da
3 changed files with 1 additions and 5 deletions
|
@ -9,7 +9,6 @@ import {
|
||||||
Delete,
|
Delete,
|
||||||
Get,
|
Get,
|
||||||
HttpCode,
|
HttpCode,
|
||||||
NotFoundException,
|
|
||||||
Put,
|
Put,
|
||||||
UseGuards,
|
UseGuards,
|
||||||
UseInterceptors,
|
UseInterceptors,
|
||||||
|
@ -24,7 +23,6 @@ import {
|
||||||
} from '@nestjs/swagger';
|
} from '@nestjs/swagger';
|
||||||
|
|
||||||
import { TokenAuthGuard } from '../../../auth/token.strategy';
|
import { TokenAuthGuard } from '../../../auth/token.strategy';
|
||||||
import { NotInDBError } from '../../../errors/errors';
|
|
||||||
import { HistoryEntryUpdateDto } from '../../../history/history-entry-update.dto';
|
import { HistoryEntryUpdateDto } from '../../../history/history-entry-update.dto';
|
||||||
import { HistoryEntryDto } from '../../../history/history-entry.dto';
|
import { HistoryEntryDto } from '../../../history/history-entry.dto';
|
||||||
import { HistoryService } from '../../../history/history.service';
|
import { HistoryService } from '../../../history/history.service';
|
||||||
|
|
|
@ -21,13 +21,13 @@ import {
|
||||||
unauthorizedDescription,
|
unauthorizedDescription,
|
||||||
} from '../../utils/descriptions';
|
} from '../../utils/descriptions';
|
||||||
|
|
||||||
|
@UseGuards(TokenAuthGuard)
|
||||||
@ApiTags('monitoring')
|
@ApiTags('monitoring')
|
||||||
@ApiSecurity('token')
|
@ApiSecurity('token')
|
||||||
@Controller('monitoring')
|
@Controller('monitoring')
|
||||||
export class MonitoringController {
|
export class MonitoringController {
|
||||||
constructor(private monitoringService: MonitoringService) {}
|
constructor(private monitoringService: MonitoringService) {}
|
||||||
|
|
||||||
@UseGuards(TokenAuthGuard)
|
|
||||||
@Get()
|
@Get()
|
||||||
@ApiOkResponse({
|
@ApiOkResponse({
|
||||||
description: 'The server info',
|
description: 'The server info',
|
||||||
|
@ -40,7 +40,6 @@ export class MonitoringController {
|
||||||
return this.monitoringService.getServerStatus();
|
return this.monitoringService.getServerStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
@UseGuards(TokenAuthGuard)
|
|
||||||
@Get('prometheus')
|
@Get('prometheus')
|
||||||
@ApiOkResponse({
|
@ApiOkResponse({
|
||||||
description: 'Prometheus compatible monitoring data',
|
description: 'Prometheus compatible monitoring data',
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
import {
|
import {
|
||||||
BadRequestException,
|
|
||||||
Body,
|
Body,
|
||||||
Controller,
|
Controller,
|
||||||
Delete,
|
Delete,
|
||||||
|
|
Loading…
Reference in a new issue