fix #492: add token context selection

This commit is contained in:
devmrko
2026-06-26 13:53:10 +09:00
parent cd7860e253
commit 210e0bd4d0
14 changed files with 383 additions and 12 deletions

View File

@@ -1,6 +1,7 @@
package com.cloudhandson.vpdbackoffice.web;
import com.cloudhandson.vpdbackoffice.domain.probe.ProbeCommand;
import com.cloudhandson.vpdbackoffice.service.BearerTokenService;
import com.cloudhandson.vpdbackoffice.service.OrdsProbeService;
import com.cloudhandson.vpdbackoffice.service.ProtectedObjectService;
import org.springframework.stereotype.Controller;
@@ -14,29 +15,34 @@ public class ProbeController {
private final OrdsProbeService probeService;
private final ProtectedObjectService protectedObjectService;
private final BearerTokenService tokenService;
public ProbeController(
OrdsProbeService probeService,
ProtectedObjectService protectedObjectService
ProtectedObjectService protectedObjectService,
BearerTokenService tokenService
) {
this.probeService = probeService;
this.protectedObjectService = protectedObjectService;
this.tokenService = tokenService;
}
@GetMapping("/probe")
public String probe(Model model) {
model.addAttribute("objects", protectedObjectService.findEnabled());
model.addAttribute("tokens", tokenService.findTokenContextOptions());
return "probe";
}
@PostMapping("/probe")
public String run(
@RequestParam(required = false) Long tokenKeyId,
@RequestParam long objectId,
@RequestParam String bearerToken,
@RequestParam(defaultValue = "50") int limit,
Model model
) {
model.addAttribute("result", probeService.runProbe(new ProbeCommand(objectId, bearerToken, limit)));
model.addAttribute("result", probeService.runProbe(new ProbeCommand(tokenKeyId, objectId, bearerToken, limit)));
return "fragments/probe-result :: result";
}
}