2021-11-05 09:19:44 +01:00
|
|
|
package eu.dnetlib.loginservice.controllers;
|
|
|
|
|
2023-05-18 12:00:03 +02:00
|
|
|
import eu.dnetlib.authentication.configuration.AuthenticationConfiguration;
|
|
|
|
import eu.dnetlib.authentication.configuration.Properties;
|
2022-10-10 14:55:40 +02:00
|
|
|
import org.apache.logging.log4j.LogManager;
|
|
|
|
import org.apache.logging.log4j.Logger;
|
2021-11-24 23:20:57 +01:00
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
2021-11-05 09:19:44 +01:00
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
2021-11-24 23:20:57 +01:00
|
|
|
import java.util.Map;
|
|
|
|
|
2021-11-05 09:19:44 +01:00
|
|
|
@RestController
|
|
|
|
public class HealthController {
|
2022-10-10 14:55:40 +02:00
|
|
|
private final Logger log = LogManager.getLogger(this.getClass());
|
2023-05-18 12:00:03 +02:00
|
|
|
private final AuthenticationConfiguration configuration;
|
2021-11-24 23:20:57 +01:00
|
|
|
|
|
|
|
@Autowired
|
2023-05-18 12:00:03 +02:00
|
|
|
public HealthController(AuthenticationConfiguration configuration) {
|
|
|
|
this.configuration = configuration;
|
2021-11-24 23:20:57 +01:00
|
|
|
}
|
2021-11-05 09:19:44 +01:00
|
|
|
|
|
|
|
@RequestMapping(value = {"", "/health_check"}, method = RequestMethod.GET)
|
|
|
|
public String hello() {
|
|
|
|
log.debug("Hello from Login service!");
|
|
|
|
return "Hello from Login service!";
|
|
|
|
}
|
2021-11-24 23:20:57 +01:00
|
|
|
|
|
|
|
@PreAuthorize("hasAnyAuthority('PORTAL_ADMINISTRATOR')")
|
|
|
|
@RequestMapping(value = "/health_check/advanced", method = RequestMethod.GET)
|
|
|
|
public Map<String, String> checkEverything() {
|
2023-05-18 15:15:47 +02:00
|
|
|
return configuration.getProperties();
|
2021-11-24 23:20:57 +01:00
|
|
|
}
|
2021-11-05 09:19:44 +01:00
|
|
|
}
|