Guard classes or instances to apply
@Controller('/api/v1/profile')
@UseGuards(AuthGuard())
export class ProfileController {
show() { } // Requires authentication
}
@Controller('/api/v1/students')
@UseGuards(AuthGuard({ scopes: ['students:read'] }))
export class StudentsController {
index() { } // Requires 'students:read' permission
}
UseGuards Decorator
Applies one or more guards to a controller or method. Guards are executed in order and all must pass for the request to proceed.
Execution Order:
Guard Resolution: