diff --git a/build.sh b/build.sh index 84efdf7b37f26e7a7083bbb402aeced4609a152e..458b5c085e3c6e51fd26278722210b3d2e8b6617 100755 --- a/build.sh +++ b/build.sh @@ -26,7 +26,7 @@ else DOCKER="sudo docker" fi -IMAGE="hbpmip/portal-backend" +IMAGE="thanasulas/portal-backend" VCS_REF=$(git describe --tags --dirty) VERSION=$(git describe --tags --dirty) @@ -38,6 +38,7 @@ docker build --build-arg BUILD_DATE=$(date -Iseconds) \ . + BUGSNAG_KEY="" eval $(grep -e "^\\s*BUGSNAG_KEY" Dockerfile | tr '\\' ' ') diff --git a/pom.xml b/pom.xml index fb47d331018bbd301afd6350b5136c2f5f2020e5..20a6f066122779eab771ca0d012dbcc4a8e8a208 100644 --- a/pom.xml +++ b/pom.xml @@ -84,7 +84,6 @@ <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> - </dependency> <dependency> <groupId>org.springframework.boot</groupId> diff --git a/src/main/java/eu/hbp/mip/configuration/SecurityConfiguration.java b/src/main/java/eu/hbp/mip/configuration/SecurityConfiguration.java index a92879577926739b703e4d015a1a64caa1ed5b87..2d21b61bdc202bf858f3103c78585c481a38c7f2 100644 --- a/src/main/java/eu/hbp/mip/configuration/SecurityConfiguration.java +++ b/src/main/java/eu/hbp/mip/configuration/SecurityConfiguration.java @@ -16,14 +16,17 @@ import org.springframework.boot.context.embedded.FilterRegistrationBean; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.http.*; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.core.Authentication; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.authority.AuthorityUtils; import org.springframework.security.oauth2.client.OAuth2ClientContext; import org.springframework.security.oauth2.client.OAuth2RestTemplate; import org.springframework.security.oauth2.client.filter.OAuth2ClientAuthenticationProcessingFilter; import org.springframework.security.oauth2.client.filter.OAuth2ClientContextFilter; -import org.springframework.security.oauth2.client.resource.OAuth2ProtectedResourceDetails; +import org.springframework.security.oauth2.client.resource.BaseOAuth2ProtectedResourceDetails; import org.springframework.security.oauth2.client.token.grant.code.AuthorizationCodeResourceDetails; import org.springframework.security.oauth2.config.annotation.web.configuration.EnableOAuth2Client; import org.springframework.security.web.access.channel.ChannelProcessingFilter; @@ -34,13 +37,13 @@ import org.springframework.security.web.csrf.CsrfFilter; import org.springframework.security.web.csrf.CsrfToken; import org.springframework.security.web.csrf.CsrfTokenRepository; import org.springframework.security.web.csrf.HttpSessionCsrfTokenRepository; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.client.RestTemplate; import org.springframework.web.filter.OncePerRequestFilter; import org.springframework.web.util.WebUtils; -import org.springframework.security.oauth2.client.resource.BaseOAuth2ProtectedResourceDetails; -import org.springframework.security.core.GrantedAuthority; -import org.springframework.security.core.authority.AuthorityUtils; - +import javax.net.ssl.*; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.ServletException; @@ -48,33 +51,15 @@ import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; +import java.net.URI; +import java.security.SecureRandom; +import java.security.cert.X509Certificate; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; //newlyadded for logout -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpMethod; -import org.springframework.http.MediaType; -import org.springframework.http.RequestEntity; -import org.springframework.http.ResponseEntity; -import org.springframework.web.client.RestTemplate; -import org.springframework.util.LinkedMultiValueMap; -import org.springframework.util.MultiValueMap; -import java.net.URI; - - -import java.security.SecureRandom; -import java.security.cert.CertificateException; -import java.security.cert.X509Certificate; - -import javax.net.ssl.HostnameVerifier; -import javax.net.ssl.HttpsURLConnection; -import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLSession; -import javax.net.ssl.TrustManager; -import javax.net.ssl.X509TrustManager; // See https://spring.io/guides/tutorials/spring-boot-oauth2/ for reference about configuring OAuth2 login diff --git a/src/main/java/eu/hbp/mip/controllers/ExperimentApi.java b/src/main/java/eu/hbp/mip/controllers/ExperimentApi.java index 476d2f21808ce573b62496602a776b0160a16979..943605b66736f71e47bac8c44989bf88e7b6140c 100644 --- a/src/main/java/eu/hbp/mip/controllers/ExperimentApi.java +++ b/src/main/java/eu/hbp/mip/controllers/ExperimentApi.java @@ -28,10 +28,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; +import org.springframework.security.core.Authentication; import org.springframework.web.bind.annotation.*; import retrofit2.Call; import retrofit2.Response; -import org.springframework.security.core.context.SecurityContextHolder; import java.io.IOException; import java.util.*; @@ -82,15 +82,13 @@ public class ExperimentApi { @RequestMapping(value = "/{uuid}", method = RequestMethod.GET) public ResponseEntity<String> getExperiment( @ApiParam(value = "uuid", required = true) @PathVariable("uuid") String uuid) { - - UserActionLogging.LogAction("authorities: "+ SecurityContextHolder.getContext().getAuthentication().getAuthorities(),""); Experiment experiment; UUID experimentUuid; try { experimentUuid = UUID.fromString(uuid); } catch (IllegalArgumentException iae) { - UserActionLogging.LogAction("Get Experiment", "Invalid Experiment UUID."); + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "Get Experiment", "Invalid Experiment UUID."); return ResponseEntity.badRequest().body("Invalid Experiment UUID"); } @@ -100,21 +98,55 @@ public class ExperimentApi { return new ResponseEntity<>("Not found", HttpStatus.NOT_FOUND); } - UserActionLogging.LogAction("Get an experiment ", " uuid : " + uuid); + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "Get an experiment ", " uuid : " + uuid); return new ResponseEntity<>(gsonOnlyExposed.toJson(experiment.jsonify()), HttpStatus.OK); } - - - + + @ApiOperation(value = "Create an experiment", response = Experiment.class) @RequestMapping(value = "/runAlgorithm", method = RequestMethod.POST) - public ResponseEntity<String> runExperiment(@RequestBody ExperimentExecutionDTO experimentExecutionDTO) { - UserActionLogging.LogAction("Run algorithm", "Running the algorithm..."); + public ResponseEntity<String> runExperiment(Authentication authentication, @RequestBody ExperimentExecutionDTO experimentExecutionDTO) { + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "Run algorithm", "Running the algorithm..."); + + // --- Validating proper access rights on the datasets --- + String allowedDatasets = authentication.getAuthorities().toString(); + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "Authorities", allowedDatasets.toString()); + + // Getting the dataset from the experiment parameters + String experimentDatasets = null; + for (AlgorithmExecutionParamDTO parameter : experimentExecutionDTO.getAlgorithms().get(0).getParameters()) { + if (parameter.getName().equals("dataset")) { + experimentDatasets = parameter.getValue(); + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "Run algorithm", "Found the dataset parameter!"); + break; + } + } + + if (experimentDatasets == null || experimentDatasets.equals("")) { + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "Run algorithm", + "A dataset should be specified when running an algorithm."); + return ResponseEntity.badRequest().body("A dataset should be specified when running an algorithm."); + } + + for (String dataset : experimentDatasets.split(",")) { + String datasetRole = "role_" + dataset; + if (!allowedDatasets.toLowerCase().contains(datasetRole.toLowerCase())) { + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "Run algorithm", + "You are not allowed to use dataset: " + dataset); + return ResponseEntity.status(403).body("You are not allowed to use dataset: " + dataset); + } + } + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "Run algorithm", + "User is authorized to use the datasets: " + experimentDatasets); + + + // --- Run the experiment --- // Get the type of algorithm String algorithmType = experimentExecutionDTO.getAlgorithms().get(0).getType(); + // Run with the appropriate engine if (algorithmType.equals("workflow")) { return runGalaxyWorkflow(experimentExecutionDTO); } else { @@ -127,7 +159,7 @@ public class ExperimentApi { public ResponseEntity<String> markExperimentAsViewed( @ApiParam(value = "uuid", required = true) @PathVariable("uuid") String uuid) { - UserActionLogging.LogAction("Mark an experiment as viewed", " uuid : " + uuid); + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "Mark an experiment as viewed", " uuid : " + uuid); Experiment experiment; UUID experimentUuid; @@ -135,8 +167,7 @@ public class ExperimentApi { try { experimentUuid = UUID.fromString(uuid); } catch (IllegalArgumentException iae) { - //LOGGER.trace("Invalid UUID", iae); - //LOGGER.warn("An invalid Experiment UUID was received !"); + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "Mark an experiment as viewed", "Invalid Experiment UUID" + uuid); return ResponseEntity.badRequest().body("Invalid Experiment UUID"); } @@ -146,7 +177,7 @@ public class ExperimentApi { experiment.setResultsViewed(true); experimentRepository.save(experiment); - UserActionLogging.LogAction("Experiment updated (marked as viewed)", " "); + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "Experiment updated (marked as viewed)", " "); return new ResponseEntity<>(gsonOnlyExposed.toJson(experiment.jsonify()), HttpStatus.OK); } @@ -156,7 +187,7 @@ public class ExperimentApi { public ResponseEntity<String> markExperimentAsShared( @ApiParam(value = "uuid", required = true) @PathVariable("uuid") String uuid) { - UserActionLogging.LogAction("Mark an experiment as shared", " uuid : " + uuid); + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "Mark an experiment as shared", " uuid : " + uuid); return doMarkExperimentAsShared(uuid, true); } @@ -165,7 +196,7 @@ public class ExperimentApi { @RequestMapping(value = "/{uuid}/markAsUnshared", method = RequestMethod.GET) public ResponseEntity<String> markExperimentAsUnshared( @ApiParam(value = "uuid", required = true) @PathVariable("uuid") String uuid) { - UserActionLogging.LogAction("Mark an experiment as unshared", " uuid : " + uuid); + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "Mark an experiment as unshared", " uuid : " + uuid); return doMarkExperimentAsShared(uuid, false); } @@ -175,7 +206,7 @@ public class ExperimentApi { public ResponseEntity<String> listExperiments( @ApiParam(value = "maxResultCount") @RequestParam int maxResultCount) { - UserActionLogging.LogAction("List experiments", " maxResultCount : " + maxResultCount); + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "List experiments", " maxResultCount : " + maxResultCount); return doListExperiments(false, null); } @@ -185,7 +216,7 @@ public class ExperimentApi { public ResponseEntity<String> listExperiments(@ApiParam(value = "slug") @RequestParam("slug") String modelSlug, @ApiParam(value = "maxResultCount") @RequestParam("maxResultCount") int maxResultCount) { - UserActionLogging.LogAction("List experiments", " modelSlug : " + modelSlug); + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "List experiments", " modelSlug : " + modelSlug); if (maxResultCount <= 0 && (modelSlug == null || "".equals(modelSlug))) { return new ResponseEntity<>("You must provide at least a slug or a limit of result", @@ -197,8 +228,8 @@ public class ExperimentApi { @ApiOperation(value = "list my experiments", response = Experiment.class, responseContainer = "List") @RequestMapping(method = RequestMethod.GET, params = {"mine"}) - public ResponseEntity<String> listMyExperiments(@ApiParam(value = "mine") @RequestParam("mine") boolean mine) { - UserActionLogging.LogAction("List my experiments", " mine : " + mine); + public ResponseEntity<String> listMyExperiments(Authentication authentication, @ApiParam(value = "mine") @RequestParam("mine") boolean mine) { + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "List my experiments", " mine : " + mine); return doListExperiments(true, null); } @@ -249,14 +280,14 @@ public class ExperimentApi { experiment.setShared(shared); experimentRepository.save(experiment); - UserActionLogging.LogAction("Experiment updated (marked as shared)", ""); + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "Experiment updated (marked as shared)", ""); return new ResponseEntity<>(gsonOnlyExposed.toJson(experiment.jsonify()), HttpStatus.OK); } /* ------------------------------- EXPERIMENT MODEL METHODS ----------------------------------------------------*/ - public Experiment createExperiment(ExperimentExecutionDTO experimentExecutionDTO){ + public Experiment createExperiment(ExperimentExecutionDTO experimentExecutionDTO) { User user = userInfo.getUser(); Experiment experiment = new Experiment(); @@ -268,24 +299,24 @@ public class ExperimentApi { experiment.setName(experimentExecutionDTO.getName()); experimentRepository.save(experiment); - UserActionLogging.LogAction("Created an experiment", " id : " + experiment.getUuid()); - UserActionLogging.LogAction("Created an experiment", " algorithms : " + experiment.getAlgorithms()); - UserActionLogging.LogAction("Created an experiment", " model : " + experiment.getModel().getSlug()); - UserActionLogging.LogAction("Created an experiment", " name : " + experiment.getName()); + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "Created an experiment", " id : " + experiment.getUuid()); + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "Created an experiment", " algorithms : " + experiment.getAlgorithms()); + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "Created an experiment", " model : " + experiment.getModel().getSlug()); + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "Created an experiment", " name : " + experiment.getName()); return experiment; } private void saveExperiment(Experiment experiment) { - UserActionLogging.LogAction("Saved an experiment", " id : " + experiment.getUuid()); - UserActionLogging.LogAction("Saved an experiment", " algorithms : " + experiment.getAlgorithms()); - UserActionLogging.LogAction("Saved an experiment", " model : " + experiment.getModel().getSlug()); - UserActionLogging.LogAction("Saved an experiment", " name : " + experiment.getName()); - UserActionLogging.LogAction("Saved an experiment", " historyId : " + experiment.getWorkflowHistoryId()); - UserActionLogging.LogAction("Saved an experiment", " status : " + experiment.getWorkflowStatus()); + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "Saved an experiment", " id : " + experiment.getUuid()); + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "Saved an experiment", " algorithms : " + experiment.getAlgorithms()); + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "Saved an experiment", " model : " + experiment.getModel().getSlug()); + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "Saved an experiment", " name : " + experiment.getName()); + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "Saved an experiment", " historyId : " + experiment.getWorkflowHistoryId()); + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "Saved an experiment", " status : " + experiment.getWorkflowStatus()); experimentRepository.save(experiment); - UserActionLogging.LogAction("Experiment saved", ""); + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "Experiment saved", ""); } private void finishExperiment(Experiment experiment) { @@ -304,7 +335,7 @@ public class ExperimentApi { * @return the response to be returned */ public ResponseEntity<String> runExaremeAlgorithm(ExperimentExecutionDTO experimentExecutionDTO) { - UserActionLogging.LogAction("Run exareme algorithm", "Running the algorithm..."); + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "Run exareme algorithm", "Running the algorithm..."); Experiment experiment = createExperiment(experimentExecutionDTO); @@ -317,13 +348,13 @@ public class ExperimentApi { String body = gson.toJson(algorithmParameters); String url = queryExaremeUrl + "/" + algorithmName; - UserActionLogging.LogAction("Run exareme algorithm", "url: " + url + ", body: " + body); + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "Run exareme algorithm", "url: " + url + ", body: " + body); ResponseEntity<String> response = new ResponseEntity<>(gsonOnlyExposed.toJson(experiment.jsonify()), HttpStatus.OK); - UserActionLogging.LogAction("Run exareme algorithm", + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "Run exareme algorithm", "Completed, returning: " + experiment.toString()); - UserActionLogging.LogAction("Run exareme algorithm", + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "Run exareme algorithm", "Starting exareme execution thread"); new Thread(() -> { // ATTENTION: Inside the Thread only LogThreadAction should be used, not LogAction! @@ -372,7 +403,7 @@ public class ExperimentApi { * @return the response to be returned */ public ResponseEntity<String> runGalaxyWorkflow(ExperimentExecutionDTO experimentExecutionDTO) { - UserActionLogging.LogAction("Run workflow", "Running a workflow..."); + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "Run workflow", "Running a workflow..."); Experiment experiment = createExperiment(experimentExecutionDTO); @@ -402,7 +433,7 @@ public class ExperimentApi { } } if (workflow == null) { - UserActionLogging.LogAction("Run workflow", + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "Run workflow", "Could not find algorithm code: " + workflowId); return ResponseEntity.status(HttpStatus.BAD_REQUEST) .body(new ErrorResponse("Could not find galaxy algorithm.").toString()); @@ -421,7 +452,7 @@ public class ExperimentApi { // Create the request client RetroFitGalaxyClients service = RetrofitClientInstance.getRetrofitInstance().create(RetroFitGalaxyClients.class); - UserActionLogging.LogAction("Run workflow", "Running Galaxy workflow with id: " + workflow.getId()); + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "Run workflow", "Running Galaxy workflow with id: " + workflow.getId()); // Call Galaxy to run the workflow Call<PostWorkflowToGalaxyDtoResponse> call = service.postWorkflowToGalaxy(workflow.getId(), galaxyApiKey, requestBodyJson); @@ -430,7 +461,7 @@ public class ExperimentApi { if (response.code() == 200) { // Call succeeded String responseBody = gson.toJson(response.body()); - UserActionLogging.LogAction("Run workflow", "Response: " + responseBody); + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "Run workflow", "Response: " + responseBody); String historyId = (String) new JSONObject(responseBody).get("history_id"); experiment.setWorkflowHistoryId(historyId); @@ -440,7 +471,7 @@ public class ExperimentApi { } else { // Something unexpected happened String msgErr = gson.toJson(response.errorBody()); - UserActionLogging.LogAction("Run workflow", "Error Response: " + msgErr); + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "Run workflow", "Error Response: " + msgErr); // Values are read from streams. JSONObject jObjectError = new JSONObject(msgErr); @@ -452,7 +483,7 @@ public class ExperimentApi { } } catch (Exception e) { - UserActionLogging.LogAction("Run workflow", "An exception occurred: " + e.getMessage()); + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "Run workflow", "An exception occurred: " + e.getMessage()); experiment.setHasError(true); experiment.setHasServerError(true); experiment.setResult(e.getMessage()); @@ -462,37 +493,37 @@ public class ExperimentApi { // Start the process of fetching the status updateWorkflowExperiment(experiment); - UserActionLogging.LogAction("Run workflow", "Run workflow completed!"); + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "Run workflow", "Run workflow completed!"); return new ResponseEntity(gsonOnlyExposed.toJson(experiment.jsonify()), HttpStatus.OK); } /** - * This method creates a thread that will fetch the workflow result when it is ready + * This method creates a thread that will fetch the workflow result when it is ready * - * @param experiment will be used to fetch it's workflow status, it should have the workflowHistoryId initialized - * and the result should not already be fetched - * @return nothing, just updates the experiment + * @param experiment will be used to fetch it's workflow status, it should have the workflowHistoryId initialized + * and the result should not already be fetched + * @return nothing, just updates the experiment */ public void updateWorkflowExperiment(Experiment experiment) { if (experiment == null) { - UserActionLogging.LogAction("Update workflow experiment", "The experiment does not exist."); + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "Update workflow experiment", "The experiment does not exist."); return; } - UserActionLogging.LogAction("Update workflow experiment", + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "Update workflow experiment", " Experiment id : " + experiment.getUuid()); if (experiment.getWorkflowHistoryId() == null) { - UserActionLogging.LogAction("Update workflow experiment", "History Id does not exist."); + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "Update workflow experiment", "History Id does not exist."); return; } - UserActionLogging.LogAction("Update workflow experiment", "Starting Thread..." ); + UserActionLogging.LogUserAction(userInfo.getUser().getUsername(), "Update workflow experiment", "Starting Thread..."); new Thread(() -> { - while(true) { + while (true) { // ATTENTION: Inside the Thread only LogThreadAction should be used, not LogAction! UserActionLogging.LogThreadAction("Update workflow experiment", "Thread is running..."); diff --git a/src/main/java/eu/hbp/mip/utils/UserActionLogging.java b/src/main/java/eu/hbp/mip/utils/UserActionLogging.java index b4a96fc864a16063c39dede8ea0233fbfd41b981..c4d7305b9a5924af29a41c9c4836004f21292f17 100644 --- a/src/main/java/eu/hbp/mip/utils/UserActionLogging.java +++ b/src/main/java/eu/hbp/mip/utils/UserActionLogging.java @@ -1,25 +1,32 @@ package eu.hbp.mip.utils; +import eu.hbp.mip.model.UserInfo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.context.SecurityContextHolder; public class UserActionLogging { - private static final Logger LOGGER = LoggerFactory.getLogger(UserActionLogging.class); public static void LogAction(String actionName, String actionIdInfo) + { + LOGGER.info( "Called endpoint: " + actionName + + " info: " + actionIdInfo); + } + + public static void LogUserAction(String userName, String actionName, String actionInfo) { LOGGER.info( " User : " - + SecurityContextHolder.getContext().getAuthentication().getName() + + userName + " called endpoint: " + actionName - + " info: " + actionIdInfo); + + " info: " + actionInfo); } // Used from Threads because LogAction won't work. public static void LogThreadAction(String actionName, String actionIdInfo) { LOGGER.info( "Thread -->" + actionName + " info: " + actionIdInfo); - } + } }