hunk.code_window: import com.appsmith.server.authentication.handlers.LogoutSuccessHandler;
   import com.appsmith.server.services.UserService;
   import com.fasterxml.jackson.databind.ObjectMapper;
   import org.springframework.beans.factory.annotation.Autowired;
   import org.springframework.context.annotation.Bean;
   import org.springframework.core.io.ClassPathResource;
   import org.springframework.http.HttpMethod;
   import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity;
  
hunk.labels: keep keep keep add keep keep keep keep
hunk.after_edit: import org.springframework.beans.factory.annotation.Value;
  
hunk.file_path: app/server/appsmith-server/src/main/java/com/appsmith/server/configurations/SecurityConfig.java
hunk.type: add
file: package com.appsmith.server.helpers;
  
  import com.appsmith.external.plugins.PluginExecutor;
  import com.appsmith.server.domains.Plugin;
  import com.appsmith.server.exceptions.AppsmithError;
  import com.appsmith.server.exceptions.AppsmithException;
  import org.pf4j.PluginManager;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Component;
  import reactor.core.publisher.Mono;
  
  import java.util.List;
  
  @Component
  public class PluginExecutorHelper {
  
      private PluginManager pluginManager;
  
      @Autowired
      public PluginExecutorHelper(PluginManager pluginManager) {
          this.pluginManager = pluginManager;
      }
  
      public Mono<PluginExecutor> getPluginExecutor(Mono<Plugin> pluginMono) {
          return pluginMono.flatMap(plugin -> {
                      List<PluginExecutor> executorList = pluginManager.getExtensions(PluginExecutor.class, plugin.getPackageName());
                      if (executorList.isEmpty()) {
                          return Mono.error(new AppsmithException(AppsmithError.NO_RESOURCE_FOUND, "plugin", plugin.getPackageName()));
                      }
                      return Mono.just(executorList.get(0));
                  }
          );
      }
  }
  