Skip to content

Commit

Permalink
restrict api call to (admin) users with the correct api-key value
Browse files Browse the repository at this point in the history
  • Loading branch information
etan-sb committed Dec 5, 2024
1 parent fdc18cc commit 7c0de7c
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,12 @@ public ResponseEntity<MeasureSet> createCmsId(
}

@DeleteMapping("/measures/{measureId}/delete-cms-id")
@PreAuthorize("#request.getHeader('api-key') == #apiKey")
public ResponseEntity<String> deleteCmsId(
@PathVariable String measureId, @RequestParam(name = "cmsId") Integer cmsId) {
HttpServletRequest request,
@PathVariable String measureId,
@RequestParam(name = "cmsId") Integer cmsId,
@Value("${admin-api-key}") String apiKey) {
return ResponseEntity.status(HttpStatus.OK)
.body(measureSetService.deleteCmsId(measureId, cmsId));
}
Expand Down

0 comments on commit 7c0de7c

Please sign in to comment.