From 806113554bcd5b33b0817ff03d87a40856fff21f Mon Sep 17 00:00:00 2001 From: hailin Date: Sat, 21 Feb 2026 23:42:37 -0800 Subject: [PATCH] fix: remove AuthGuard('jwt') from all service controllers Kong handles JWT validation at the gateway level. Service-level AuthGuard('jwt') fails because services don't register a Passport JWT strategy (only auth-service does). Removed from 17 controllers across ops, inventory, monitor, comm, audit, and agent services. Co-Authored-By: Claude Opus 4.6 --- .../src/interfaces/rest/controllers/agent.controller.ts | 8 +------- .../interfaces/rest/controllers/risk-rules.controller.ts | 8 -------- .../interfaces/rest/controllers/session.controller.ts | 6 +----- .../src/interfaces/rest/controllers/audit.controller.ts | 5 ++--- .../interfaces/rest/controllers/channel.controller.ts | 3 --- .../interfaces/rest/controllers/contact.controller.ts | 7 +------ .../rest/controllers/escalation-policy.controller.ts | 7 ------- .../interfaces/rest/controllers/message.controller.ts | 5 +---- .../interfaces/rest/controllers/cluster.controller.ts | 6 +----- .../interfaces/rest/controllers/credential.controller.ts | 7 +------ .../src/interfaces/rest/controllers/server.controller.ts | 8 +------- .../src/interfaces/rest/controllers/alert.controller.ts | 7 +------ .../rest/controllers/health-check.controller.ts | 5 +---- .../interfaces/rest/controllers/approval.controller.ts | 7 +------ .../interfaces/rest/controllers/runbook.controller.ts | 7 +------ .../rest/controllers/standing-order.controller.ts | 9 +-------- .../src/interfaces/rest/controllers/task.controller.ts | 6 +----- 17 files changed, 15 insertions(+), 96 deletions(-) diff --git a/packages/services/agent-service/src/interfaces/rest/controllers/agent.controller.ts b/packages/services/agent-service/src/interfaces/rest/controllers/agent.controller.ts index a049e22..4cc26f9 100644 --- a/packages/services/agent-service/src/interfaces/rest/controllers/agent.controller.ts +++ b/packages/services/agent-service/src/interfaces/rest/controllers/agent.controller.ts @@ -1,5 +1,4 @@ -import { Controller, Post, Body, Param, Delete, Get, UseGuards, NotFoundException, BadRequestException } from '@nestjs/common'; -import { AuthGuard } from '@nestjs/passport'; +import { Controller, Post, Body, Param, Delete, Get, NotFoundException, BadRequestException } from '@nestjs/common'; import { TenantId } from '@it0/common'; import { EngineRegistry } from '../../../infrastructure/engines/engine-registry'; import { AgentStreamGateway } from '../../ws/agent-stream.gateway'; @@ -22,7 +21,6 @@ export class AgentController { // TODO 10: Execute task @Post('tasks') - @UseGuards(AuthGuard('jwt')) async executeTask( @TenantId() tenantId: string, @Body() body: { prompt: string; systemPrompt?: string; maxTurns?: number; allowedTools?: string[] }, @@ -115,7 +113,6 @@ export class AgentController { // TODO 11: Cancel task @Delete('tasks/:taskId') - @UseGuards(AuthGuard('jwt')) async cancelTask(@Param('taskId') taskId: string) { const task = await this.taskRepository.findById(taskId); if (!task) { @@ -143,7 +140,6 @@ export class AgentController { // TODO 12: Approve command @Post('tasks/:taskId/approve') - @UseGuards(AuthGuard('jwt')) async approveCommand(@Param('taskId') taskId: string, @Body() body: { approved: boolean }) { const task = await this.taskRepository.findById(taskId); if (!task) { @@ -230,7 +226,6 @@ export class AgentController { // TODO 13: List engines @Get('engines') - @UseGuards(AuthGuard('jwt')) async listEngines() { const engines = this.engineRegistry.listAvailable(); return { engines }; @@ -238,7 +233,6 @@ export class AgentController { // TODO 14: Switch engine @Post('engines/switch') - @UseGuards(AuthGuard('jwt')) async switchEngine(@Body() body: { engineType: string }) { const engine = this.engineRegistry.switchEngine(body.engineType as AgentEngineType); return { message: 'Engine switched', engineType: engine.engineType }; diff --git a/packages/services/agent-service/src/interfaces/rest/controllers/risk-rules.controller.ts b/packages/services/agent-service/src/interfaces/rest/controllers/risk-rules.controller.ts index fb004dc..916effb 100644 --- a/packages/services/agent-service/src/interfaces/rest/controllers/risk-rules.controller.ts +++ b/packages/services/agent-service/src/interfaces/rest/controllers/risk-rules.controller.ts @@ -6,10 +6,8 @@ import { Delete, Param, Body, - UseGuards, NotFoundException, } from '@nestjs/common'; -import { AuthGuard } from '@nestjs/passport'; import * as crypto from 'crypto'; interface RiskRule { @@ -47,13 +45,11 @@ export class RiskRulesController { /* ---------- Risk Rules CRUD ---------- */ @Get('risk-rules') - @UseGuards(AuthGuard('jwt')) listRules() { return { data: this.rules, total: this.rules.length }; } @Post('risk-rules') - @UseGuards(AuthGuard('jwt')) createRule(@Body() body: any) { const now = new Date().toISOString(); const rule: RiskRule = { @@ -71,7 +67,6 @@ export class RiskRulesController { } @Put('risk-rules/:id') - @UseGuards(AuthGuard('jwt')) updateRule(@Param('id') id: string, @Body() body: any) { const rule = this.rules.find((r) => r.id === id); if (!rule) { @@ -87,7 +82,6 @@ export class RiskRulesController { } @Delete('risk-rules/:id') - @UseGuards(AuthGuard('jwt')) deleteRule(@Param('id') id: string) { const idx = this.rules.findIndex((r) => r.id === id); if (idx === -1) { @@ -100,13 +94,11 @@ export class RiskRulesController { /* ---------- Permissions ---------- */ @Get('permissions') - @UseGuards(AuthGuard('jwt')) getPermissions() { return this.permissionMatrix; } @Put('permissions') - @UseGuards(AuthGuard('jwt')) updatePermissions(@Body() body: PermissionMatrix) { this.permissionMatrix = { ...this.permissionMatrix, ...body }; return this.permissionMatrix; diff --git a/packages/services/agent-service/src/interfaces/rest/controllers/session.controller.ts b/packages/services/agent-service/src/interfaces/rest/controllers/session.controller.ts index b41d80e..306a6cf 100644 --- a/packages/services/agent-service/src/interfaces/rest/controllers/session.controller.ts +++ b/packages/services/agent-service/src/interfaces/rest/controllers/session.controller.ts @@ -1,5 +1,4 @@ -import { Controller, Get, Param, UseGuards, NotFoundException } from '@nestjs/common'; -import { AuthGuard } from '@nestjs/passport'; +import { Controller, Get, Param, NotFoundException } from '@nestjs/common'; import { TenantId } from '@it0/common'; import { SessionRepository } from '../../../infrastructure/repositories/session.repository'; import { TaskRepository } from '../../../infrastructure/repositories/task.repository'; @@ -13,14 +12,12 @@ export class SessionController { // TODO 15: List sessions @Get() - @UseGuards(AuthGuard('jwt')) async listSessions(@TenantId() tenantId: string) { return this.sessionRepository.findByTenant(tenantId); } // TODO 16: Get session details @Get(':sessionId') - @UseGuards(AuthGuard('jwt')) async getSession(@Param('sessionId') sessionId: string) { const session = await this.sessionRepository.findById(sessionId); if (!session) { @@ -31,7 +28,6 @@ export class SessionController { // TODO 17: Get session history @Get(':sessionId/history') - @UseGuards(AuthGuard('jwt')) async getSessionHistory(@Param('sessionId') sessionId: string) { return this.taskRepository.findBySessionId(sessionId); } diff --git a/packages/services/audit-service/src/interfaces/rest/controllers/audit.controller.ts b/packages/services/audit-service/src/interfaces/rest/controllers/audit.controller.ts index b7a05af..df6cd4c 100644 --- a/packages/services/audit-service/src/interfaces/rest/controllers/audit.controller.ts +++ b/packages/services/audit-service/src/interfaces/rest/controllers/audit.controller.ts @@ -1,5 +1,4 @@ import { Controller, Get, Query, UseGuards } from '@nestjs/common'; -import { AuthGuard } from '@nestjs/passport'; import { Roles, RolesGuard } from '@it0/common'; import { AuditLogRepository } from '../../../infrastructure/repositories/audit-log.repository'; @@ -8,7 +7,7 @@ export class AuditController { constructor(private readonly auditLogRepository: AuditLogRepository) {} @Get('logs') - @UseGuards(AuthGuard('jwt'), RolesGuard) + @UseGuards(RolesGuard) @Roles('admin') async queryLogs( @Query('actionType') actionType?: string, @@ -36,7 +35,7 @@ export class AuditController { } @Get('logs/export') - @UseGuards(AuthGuard('jwt'), RolesGuard) + @UseGuards(RolesGuard) @Roles('admin') async exportLogs(@Query('format') format: 'json' | 'csv' = 'json') { return this.auditLogRepository.exportLogs(format); diff --git a/packages/services/comm-service/src/interfaces/rest/controllers/channel.controller.ts b/packages/services/comm-service/src/interfaces/rest/controllers/channel.controller.ts index ef61eaa..6006a7b 100644 --- a/packages/services/comm-service/src/interfaces/rest/controllers/channel.controller.ts +++ b/packages/services/comm-service/src/interfaces/rest/controllers/channel.controller.ts @@ -4,14 +4,11 @@ import { Patch, Param, Body, - UseGuards, NotFoundException, } from '@nestjs/common'; -import { AuthGuard } from '@nestjs/passport'; import { AdapterRegistry } from '../../../infrastructure/adapters/adapter-registry'; @Controller('api/v1/comm/channels') -@UseGuards(AuthGuard('jwt')) export class ChannelController { constructor(private readonly adapterRegistry: AdapterRegistry) {} diff --git a/packages/services/comm-service/src/interfaces/rest/controllers/contact.controller.ts b/packages/services/comm-service/src/interfaces/rest/controllers/contact.controller.ts index b764c23..24f9f46 100644 --- a/packages/services/comm-service/src/interfaces/rest/controllers/contact.controller.ts +++ b/packages/services/comm-service/src/interfaces/rest/controllers/contact.controller.ts @@ -1,5 +1,4 @@ -import { Controller, Get, Post, Put, Delete, Body, Param, UseGuards, NotFoundException } from '@nestjs/common'; -import { AuthGuard } from '@nestjs/passport'; +import { Controller, Get, Post, Put, Delete, Body, Param, NotFoundException } from '@nestjs/common'; import { ContactRepository } from '../../../infrastructure/repositories/contact.repository'; import { Contact } from '../../../domain/entities/contact.entity'; import * as crypto from 'crypto'; @@ -9,13 +8,11 @@ export class ContactController { constructor(private readonly contactRepository: ContactRepository) {} @Get() - @UseGuards(AuthGuard('jwt')) async listContacts() { return this.contactRepository.findAll(); } @Post() - @UseGuards(AuthGuard('jwt')) async createContact(@Body() body: any) { const contact = new Contact(); contact.id = crypto.randomUUID(); @@ -32,7 +29,6 @@ export class ContactController { } @Put(':id') - @UseGuards(AuthGuard('jwt')) async updateContact(@Param('id') id: string, @Body() body: any) { const contact = await this.contactRepository.findById(id); if (!contact) { @@ -43,7 +39,6 @@ export class ContactController { } @Delete(':id') - @UseGuards(AuthGuard('jwt')) async deleteContact(@Param('id') id: string) { const contact = await this.contactRepository.findById(id); if (!contact) { diff --git a/packages/services/comm-service/src/interfaces/rest/controllers/escalation-policy.controller.ts b/packages/services/comm-service/src/interfaces/rest/controllers/escalation-policy.controller.ts index 43675f6..3dc65ff 100644 --- a/packages/services/comm-service/src/interfaces/rest/controllers/escalation-policy.controller.ts +++ b/packages/services/comm-service/src/interfaces/rest/controllers/escalation-policy.controller.ts @@ -6,10 +6,8 @@ import { Delete, Param, Body, - UseGuards, NotFoundException, } from '@nestjs/common'; -import { AuthGuard } from '@nestjs/passport'; import { EscalationPolicyRepository } from '../../../infrastructure/repositories/escalation-policy.repository'; import { EscalationPolicy } from '../../../domain/entities/escalation-policy.entity'; import * as crypto from 'crypto'; @@ -21,14 +19,12 @@ export class EscalationPolicyController { ) {} @Get() - @UseGuards(AuthGuard('jwt')) async listPolicies() { const policies = await this.policyRepository.findAll(); return policies.map((p) => this.serialize(p)); } @Get(':id') - @UseGuards(AuthGuard('jwt')) async getPolicy(@Param('id') id: string) { const policy = await this.policyRepository.findById(id); if (!policy) { @@ -38,7 +34,6 @@ export class EscalationPolicyController { } @Post() - @UseGuards(AuthGuard('jwt')) async createPolicy(@Body() body: any) { const policy = new EscalationPolicy(); policy.id = crypto.randomUUID(); @@ -52,7 +47,6 @@ export class EscalationPolicyController { } @Put(':id') - @UseGuards(AuthGuard('jwt')) async updatePolicy(@Param('id') id: string, @Body() body: any) { const policy = await this.policyRepository.findById(id); if (!policy) { @@ -67,7 +61,6 @@ export class EscalationPolicyController { } @Delete(':id') - @UseGuards(AuthGuard('jwt')) async deletePolicy(@Param('id') id: string) { const policy = await this.policyRepository.findById(id); if (!policy) { diff --git a/packages/services/comm-service/src/interfaces/rest/controllers/message.controller.ts b/packages/services/comm-service/src/interfaces/rest/controllers/message.controller.ts index 6c8dfba..d0afe4f 100644 --- a/packages/services/comm-service/src/interfaces/rest/controllers/message.controller.ts +++ b/packages/services/comm-service/src/interfaces/rest/controllers/message.controller.ts @@ -1,5 +1,4 @@ -import { Controller, Get, Post, Body, Query, UseGuards } from '@nestjs/common'; -import { AuthGuard } from '@nestjs/passport'; +import { Controller, Get, Post, Body, Query } from '@nestjs/common'; import { MessageRepository } from '../../../infrastructure/repositories/message.repository'; import { Message } from '../../../domain/entities/message.entity'; import * as crypto from 'crypto'; @@ -9,7 +8,6 @@ export class MessageController { constructor(private readonly messageRepository: MessageRepository) {} @Get() - @UseGuards(AuthGuard('jwt')) async listMessages(@Query('direction') direction?: string) { if (direction) { return this.messageRepository.findByDirection(direction); @@ -18,7 +16,6 @@ export class MessageController { } @Post() - @UseGuards(AuthGuard('jwt')) async sendMessage(@Body() body: any) { const message = new Message(); message.id = crypto.randomUUID(); diff --git a/packages/services/inventory-service/src/interfaces/rest/controllers/cluster.controller.ts b/packages/services/inventory-service/src/interfaces/rest/controllers/cluster.controller.ts index ddb3071..5112db7 100644 --- a/packages/services/inventory-service/src/interfaces/rest/controllers/cluster.controller.ts +++ b/packages/services/inventory-service/src/interfaces/rest/controllers/cluster.controller.ts @@ -1,5 +1,4 @@ -import { Controller, Get, Post, Body, Param, UseGuards, NotFoundException } from '@nestjs/common'; -import { AuthGuard } from '@nestjs/passport'; +import { Controller, Get, Post, Body, Param, NotFoundException } from '@nestjs/common'; import { ClusterRepository } from '../../../infrastructure/repositories/cluster.repository'; import { Cluster } from '../../../domain/entities/cluster.entity'; import * as crypto from 'crypto'; @@ -9,13 +8,11 @@ export class ClusterController { constructor(private readonly clusterRepository: ClusterRepository) {} @Get() - @UseGuards(AuthGuard('jwt')) async listClusters() { return this.clusterRepository.findAll(); } @Post() - @UseGuards(AuthGuard('jwt')) async createCluster(@Body() body: any) { const cluster = new Cluster(); cluster.id = crypto.randomUUID(); @@ -29,7 +26,6 @@ export class ClusterController { } @Get(':id') - @UseGuards(AuthGuard('jwt')) async getCluster(@Param('id') id: string) { const cluster = await this.clusterRepository.findById(id); if (!cluster) { diff --git a/packages/services/inventory-service/src/interfaces/rest/controllers/credential.controller.ts b/packages/services/inventory-service/src/interfaces/rest/controllers/credential.controller.ts index 96bc408..e7bde8a 100644 --- a/packages/services/inventory-service/src/interfaces/rest/controllers/credential.controller.ts +++ b/packages/services/inventory-service/src/interfaces/rest/controllers/credential.controller.ts @@ -1,5 +1,4 @@ import { Controller, Get, Post, Delete, Body, Param, UseGuards, NotFoundException } from '@nestjs/common'; -import { AuthGuard } from '@nestjs/passport'; import { Roles, RolesGuard } from '@it0/common'; import { CredentialRepository } from '../../../infrastructure/repositories/credential.repository'; import { CredentialVaultService } from '../../../infrastructure/crypto/credential-vault.service'; @@ -14,14 +13,12 @@ export class CredentialController { ) {} @Get() - @UseGuards(AuthGuard('jwt')) async listCredentials() { const credentials = await this.credentialRepository.findAll(); return credentials.map(c => this.toSafeOutput(c)); } @Post() - @UseGuards(AuthGuard('jwt')) async createCredential( @Body() body: { name: string; type: string; plainValue: string; keyType?: string; expiresAt?: string }, ) { @@ -42,7 +39,6 @@ export class CredentialController { } @Get(':id') - @UseGuards(AuthGuard('jwt')) async getCredential(@Param('id') id: string) { const credential = await this.credentialRepository.findById(id); if (!credential) { @@ -52,7 +48,6 @@ export class CredentialController { } @Delete(':id') - @UseGuards(AuthGuard('jwt')) async deleteCredential(@Param('id') id: string) { const credential = await this.credentialRepository.findById(id); if (!credential) { @@ -63,7 +58,7 @@ export class CredentialController { } @Post(':id/decrypt') - @UseGuards(AuthGuard('jwt'), RolesGuard) + @UseGuards(RolesGuard) @Roles('admin') async decryptCredential(@Param('id') id: string) { const credential = await this.credentialRepository.findById(id); diff --git a/packages/services/inventory-service/src/interfaces/rest/controllers/server.controller.ts b/packages/services/inventory-service/src/interfaces/rest/controllers/server.controller.ts index d158d1f..1717908 100644 --- a/packages/services/inventory-service/src/interfaces/rest/controllers/server.controller.ts +++ b/packages/services/inventory-service/src/interfaces/rest/controllers/server.controller.ts @@ -1,5 +1,4 @@ -import { Controller, Get, Post, Put, Delete, Body, Param, Query, UseGuards, NotFoundException } from '@nestjs/common'; -import { AuthGuard } from '@nestjs/passport'; +import { Controller, Get, Post, Put, Delete, Body, Param, Query, NotFoundException } from '@nestjs/common'; import { ServerRepository } from '../../../infrastructure/repositories/server.repository'; import { Server } from '../../../domain/entities/server.entity'; import * as crypto from 'crypto'; @@ -17,7 +16,6 @@ export class ServerController { } @Get() - @UseGuards(AuthGuard('jwt')) async listServers(@Query('environment') env?: string) { const servers = env ? await this.serverRepository.findByEnvironment(env) @@ -26,7 +24,6 @@ export class ServerController { } @Post() - @UseGuards(AuthGuard('jwt')) async createServer(@Body() body: any) { const server = new Server(); server.id = crypto.randomUUID(); @@ -51,7 +48,6 @@ export class ServerController { } @Get(':id') - @UseGuards(AuthGuard('jwt')) async getServer(@Param('id') id: string) { const server = await this.serverRepository.findById(id); if (!server) { @@ -61,7 +57,6 @@ export class ServerController { } @Put(':id') - @UseGuards(AuthGuard('jwt')) async updateServer(@Param('id') id: string, @Body() body: any) { const server = await this.serverRepository.findById(id); if (!server) { @@ -76,7 +71,6 @@ export class ServerController { } @Delete(':id') - @UseGuards(AuthGuard('jwt')) async deleteServer(@Param('id') id: string) { const server = await this.serverRepository.findById(id); if (!server) { diff --git a/packages/services/monitor-service/src/interfaces/rest/controllers/alert.controller.ts b/packages/services/monitor-service/src/interfaces/rest/controllers/alert.controller.ts index 2793a11..99f878d 100644 --- a/packages/services/monitor-service/src/interfaces/rest/controllers/alert.controller.ts +++ b/packages/services/monitor-service/src/interfaces/rest/controllers/alert.controller.ts @@ -1,5 +1,4 @@ -import { Controller, Get, Post, Put, Body, Param, Query, UseGuards, NotFoundException } from '@nestjs/common'; -import { AuthGuard } from '@nestjs/passport'; +import { Controller, Get, Post, Put, Body, Param, Query, NotFoundException } from '@nestjs/common'; import { AlertRuleRepository } from '../../../infrastructure/repositories/alert-rule.repository'; import { AlertEventRepository } from '../../../infrastructure/repositories/alert-event.repository'; import { AlertRule } from '../../../domain/entities/alert-rule.entity'; @@ -13,13 +12,11 @@ export class AlertController { ) {} @Get('rules') - @UseGuards(AuthGuard('jwt')) async listRules() { return this.alertRuleRepository.findAll(); } @Post('rules') - @UseGuards(AuthGuard('jwt')) async createRule(@Body() body: any) { const rule = new AlertRule(); rule.id = crypto.randomUUID(); @@ -36,7 +33,6 @@ export class AlertController { } @Get('events') - @UseGuards(AuthGuard('jwt')) async listEvents(@Query('status') status?: string) { if (status) { return this.alertEventRepository.findByStatus(status); @@ -45,7 +41,6 @@ export class AlertController { } @Put('events/:id/acknowledge') - @UseGuards(AuthGuard('jwt')) async acknowledgeEvent(@Param('id') id: string) { const event = await this.alertEventRepository.findById(id); if (!event) { diff --git a/packages/services/monitor-service/src/interfaces/rest/controllers/health-check.controller.ts b/packages/services/monitor-service/src/interfaces/rest/controllers/health-check.controller.ts index 687080d..5435920 100644 --- a/packages/services/monitor-service/src/interfaces/rest/controllers/health-check.controller.ts +++ b/packages/services/monitor-service/src/interfaces/rest/controllers/health-check.controller.ts @@ -1,5 +1,4 @@ -import { Controller, Get, Post, Body, Query, UseGuards } from '@nestjs/common'; -import { AuthGuard } from '@nestjs/passport'; +import { Controller, Get, Post, Body, Query } from '@nestjs/common'; import { HealthCheckResultRepository } from '../../../infrastructure/repositories/health-check-result.repository'; import { HealthCheckResult } from '../../../domain/entities/health-check-result.entity'; import * as crypto from 'crypto'; @@ -9,7 +8,6 @@ export class HealthCheckController { constructor(private readonly healthCheckResultRepo: HealthCheckResultRepository) {} @Get() - @UseGuards(AuthGuard('jwt')) async listHealthChecks(@Query('serverId') serverId?: string) { if (serverId) { return this.healthCheckResultRepo.findByServerId(serverId); @@ -18,7 +16,6 @@ export class HealthCheckController { } @Post('run') - @UseGuards(AuthGuard('jwt')) async runHealthCheck(@Body() body: { serverIds?: string[]; checkType?: string }) { const results: HealthCheckResult[] = []; const serverIds = body.serverIds || []; diff --git a/packages/services/ops-service/src/interfaces/rest/controllers/approval.controller.ts b/packages/services/ops-service/src/interfaces/rest/controllers/approval.controller.ts index d0f5fad..a2410eb 100644 --- a/packages/services/ops-service/src/interfaces/rest/controllers/approval.controller.ts +++ b/packages/services/ops-service/src/interfaces/rest/controllers/approval.controller.ts @@ -1,5 +1,4 @@ -import { Controller, Get, Post, Body, Param, Query, UseGuards, NotFoundException } from '@nestjs/common'; -import { AuthGuard } from '@nestjs/passport'; +import { Controller, Get, Post, Body, Param, Query, NotFoundException } from '@nestjs/common'; import { ApprovalRepository } from '../../../infrastructure/repositories/approval.repository'; import { ApproveTaskUseCase } from '../../../application/use-cases/approve-task.use-case'; @@ -11,13 +10,11 @@ export class ApprovalController { ) {} @Get() - @UseGuards(AuthGuard('jwt')) async listApprovals(@Query('status') status?: string) { return this.approveTaskUseCase.getApprovalRequests(status); } @Get(':id') - @UseGuards(AuthGuard('jwt')) async getApproval(@Param('id') id: string) { const approval = await this.approvalRepository.findById(id); if (!approval) { @@ -27,7 +24,6 @@ export class ApprovalController { } @Post(':id/approve') - @UseGuards(AuthGuard('jwt')) async approve( @Param('id') id: string, @Body() body: { approvedBy: string }, @@ -37,7 +33,6 @@ export class ApprovalController { } @Post(':id/reject') - @UseGuards(AuthGuard('jwt')) async reject( @Param('id') id: string, @Body() body: { rejectedBy: string; reason?: string }, diff --git a/packages/services/ops-service/src/interfaces/rest/controllers/runbook.controller.ts b/packages/services/ops-service/src/interfaces/rest/controllers/runbook.controller.ts index 64cd45d..0ee6bd3 100644 --- a/packages/services/ops-service/src/interfaces/rest/controllers/runbook.controller.ts +++ b/packages/services/ops-service/src/interfaces/rest/controllers/runbook.controller.ts @@ -1,5 +1,4 @@ -import { Controller, Get, Post, Put, Delete, Body, Param, UseGuards, NotFoundException } from '@nestjs/common'; -import { AuthGuard } from '@nestjs/passport'; +import { Controller, Get, Post, Put, Delete, Body, Param, NotFoundException } from '@nestjs/common'; import { RunbookRepository } from '../../../infrastructure/repositories/runbook.repository'; import { Runbook } from '../../../domain/entities/runbook.entity'; import * as crypto from 'crypto'; @@ -9,13 +8,11 @@ export class RunbookController { constructor(private readonly runbookRepository: RunbookRepository) {} @Get() - @UseGuards(AuthGuard('jwt')) async listRunbooks() { return this.runbookRepository.findAll(); } @Post() - @UseGuards(AuthGuard('jwt')) async createRunbook(@Body() body: any) { const runbook = new Runbook(); runbook.id = crypto.randomUUID(); @@ -33,7 +30,6 @@ export class RunbookController { } @Put(':id') - @UseGuards(AuthGuard('jwt')) async updateRunbook(@Param('id') id: string, @Body() body: any) { const runbook = await this.runbookRepository.findById(id); if (!runbook) { @@ -44,7 +40,6 @@ export class RunbookController { } @Delete(':id') - @UseGuards(AuthGuard('jwt')) async deleteRunbook(@Param('id') id: string) { const runbook = await this.runbookRepository.findById(id); if (!runbook) { diff --git a/packages/services/ops-service/src/interfaces/rest/controllers/standing-order.controller.ts b/packages/services/ops-service/src/interfaces/rest/controllers/standing-order.controller.ts index ed3be39..bf4f617 100644 --- a/packages/services/ops-service/src/interfaces/rest/controllers/standing-order.controller.ts +++ b/packages/services/ops-service/src/interfaces/rest/controllers/standing-order.controller.ts @@ -1,5 +1,4 @@ -import { Controller, Get, Post, Put, Patch, Param, Body, UseGuards, NotFoundException } from '@nestjs/common'; -import { AuthGuard } from '@nestjs/passport'; +import { Controller, Get, Post, Put, Patch, Param, Body, NotFoundException } from '@nestjs/common'; import { StandingOrderRepository } from '../../../infrastructure/repositories/standing-order.repository'; import { StandingOrderExecutionRepository } from '../../../infrastructure/repositories/standing-order-execution.repository'; import { StandingOrder } from '../../../domain/entities/standing-order.entity'; @@ -13,7 +12,6 @@ export class StandingOrderController { ) {} @Get() - @UseGuards(AuthGuard('jwt')) async listOrders() { const orders = await this.standingOrderRepository.findAll(); return orders.map((o) => this.serializeOrder(o)); @@ -93,7 +91,6 @@ export class StandingOrderController { } @Post() - @UseGuards(AuthGuard('jwt')) async createOrder(@Body() body: any) { const order = new StandingOrder(); order.id = crypto.randomUUID(); @@ -110,7 +107,6 @@ export class StandingOrderController { } @Get(':id') - @UseGuards(AuthGuard('jwt')) async getOrder(@Param('id') id: string) { const order = await this.standingOrderRepository.findById(id); if (!order) { @@ -120,7 +116,6 @@ export class StandingOrderController { } @Put(':id') - @UseGuards(AuthGuard('jwt')) async updateOrder(@Param('id') id: string, @Body() body: any) { const order = await this.standingOrderRepository.findById(id); if (!order) { @@ -133,7 +128,6 @@ export class StandingOrderController { } @Patch(':id/status') - @UseGuards(AuthGuard('jwt')) async updateStatus(@Param('id') id: string, @Body() body: { status: string }) { const order = await this.standingOrderRepository.findById(id); if (!order) { @@ -145,7 +139,6 @@ export class StandingOrderController { } @Get(':id/executions') - @UseGuards(AuthGuard('jwt')) async getExecutions(@Param('id') id: string) { const order = await this.standingOrderRepository.findById(id); if (!order) { diff --git a/packages/services/ops-service/src/interfaces/rest/controllers/task.controller.ts b/packages/services/ops-service/src/interfaces/rest/controllers/task.controller.ts index 99dabda..c453bc7 100644 --- a/packages/services/ops-service/src/interfaces/rest/controllers/task.controller.ts +++ b/packages/services/ops-service/src/interfaces/rest/controllers/task.controller.ts @@ -1,5 +1,4 @@ -import { Controller, Get, Post, Body, Param, UseGuards, NotFoundException } from '@nestjs/common'; -import { AuthGuard } from '@nestjs/passport'; +import { Controller, Get, Post, Body, Param, NotFoundException } from '@nestjs/common'; import { TaskRepository } from '../../../infrastructure/repositories/task.repository'; import { OpsTask } from '../../../domain/entities/ops-task.entity'; import * as crypto from 'crypto'; @@ -9,13 +8,11 @@ export class TaskController { constructor(private readonly taskRepository: TaskRepository) {} @Get() - @UseGuards(AuthGuard('jwt')) async listTasks() { return this.taskRepository.findAll(); } @Post() - @UseGuards(AuthGuard('jwt')) async createTask(@Body() body: any) { const task = new OpsTask(); task.id = crypto.randomUUID(); @@ -34,7 +31,6 @@ export class TaskController { } @Get(':id') - @UseGuards(AuthGuard('jwt')) async getTask(@Param('id') id: string) { const task = await this.taskRepository.findById(id); if (!task) {