Fix global vars. Add authorizazion to check Deploy

This commit is contained in:
Konstantinos Triantafyllou 2024-02-20 10:55:47 +02:00
parent b3381e6a79
commit f19df08435
2 changed files with 3 additions and 2 deletions

View File

@ -4,7 +4,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
import java.util.Date; import java.util.Date;
@ConfigurationProperties("irishservice.globalVars") @ConfigurationProperties("irishmonitorservice.globalVars")
public class GlobalVars { public class GlobalVars {
public static Date date = new Date(); public static Date date = new Date();
private Date buildDate; private Date buildDate;

View File

@ -4,6 +4,7 @@ import eu.dnetlib.irishmonitorservice.configuration.GlobalVars;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
@ -26,7 +27,7 @@ public class IrishServiceCheckDeployController {
return "Hello from irish-monitor-service!"; return "Hello from irish-monitor-service!";
} }
// @PreAuthorize("hasAnyAuthority(@AuthorizationService.PORTAL_ADMIN)") @PreAuthorize("hasAnyAuthority(@AuthorizationService.PORTAL_ADMIN)")
@RequestMapping(value = "/health_check/advanced", method = RequestMethod.GET) @RequestMapping(value = "/health_check/advanced", method = RequestMethod.GET)
public Map<String, String> checkEverything() { public Map<String, String> checkEverything() {
Map<String, String> response = new HashMap<>(); Map<String, String> response = new HashMap<>();