mirror of
https://github.com/fabioformosa/quartz-manager.git
synced 2026-01-06 09:33:25 +09:00
#63 renamed the base package of the api module
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.common.config;
|
||||
package it.fabioformosa.quartzmanager.api.common.config;
|
||||
|
||||
public class OpenAPIConfigConsts {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.common.config;
|
||||
package it.fabioformosa.quartzmanager.api.common.config;
|
||||
|
||||
public class QuartzManagerPaths {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.common.properties;
|
||||
package it.fabioformosa.quartzmanager.api.common.properties;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.common.utils;
|
||||
package it.fabioformosa.quartzmanager.api.common.utils;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.common.utils;
|
||||
package it.fabioformosa.quartzmanager.api.common.utils;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.configuration;
|
||||
package it.fabioformosa.quartzmanager.api.configuration;
|
||||
|
||||
import it.fabioformosa.metamorphosis.core.EnableMetamorphosisConversions;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.configuration;
|
||||
package it.fabioformosa.quartzmanager.api.configuration;
|
||||
|
||||
import io.swagger.v3.oas.models.Components;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
@@ -11,15 +11,14 @@ import io.swagger.v3.oas.models.parameters.RequestBody;
|
||||
import io.swagger.v3.oas.models.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.models.responses.ApiResponses;
|
||||
import io.swagger.v3.oas.models.security.SecurityScheme;
|
||||
import it.fabioformosa.quartzmanager.common.config.QuartzManagerPaths;
|
||||
import it.fabioformosa.quartzmanager.api.common.config.OpenAPIConfigConsts;
|
||||
import it.fabioformosa.quartzmanager.api.common.config.QuartzManagerPaths;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import static it.fabioformosa.quartzmanager.common.config.OpenAPIConfigConsts.BASIC_AUTH_SEC_OAS_SCHEME;
|
||||
|
||||
@Configuration
|
||||
public class OpenApiConfig {
|
||||
|
||||
@@ -30,7 +29,7 @@ public class OpenApiConfig {
|
||||
|
||||
if(securityDiscover != null)
|
||||
openAPI
|
||||
.components(new Components().addSecuritySchemes(BASIC_AUTH_SEC_OAS_SCHEME, buildBasicAuthScheme()))
|
||||
.components(new Components().addSecuritySchemes(OpenAPIConfigConsts.BASIC_AUTH_SEC_OAS_SCHEME, buildBasicAuthScheme()))
|
||||
.path(QuartzManagerPaths.QUARTZ_MANAGER_LOGIN_PATH,
|
||||
new PathItem().post(new Operation()
|
||||
.operationId("login")
|
||||
@@ -1,6 +1,6 @@
|
||||
package it.fabioformosa.quartzmanager.configuration;
|
||||
package it.fabioformosa.quartzmanager.api.configuration;
|
||||
|
||||
import it.fabioformosa.quartzmanager.common.properties.QuartzModuleProperties;
|
||||
import it.fabioformosa.quartzmanager.api.common.properties.QuartzModuleProperties;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -1,7 +1,7 @@
|
||||
package it.fabioformosa.quartzmanager.configuration;
|
||||
package it.fabioformosa.quartzmanager.api.configuration;
|
||||
|
||||
import it.fabioformosa.quartzmanager.common.properties.QuartzModuleProperties;
|
||||
import it.fabioformosa.quartzmanager.scheduler.AutowiringSpringBeanJobFactory;
|
||||
import it.fabioformosa.quartzmanager.api.scheduler.AutowiringSpringBeanJobFactory;
|
||||
import it.fabioformosa.quartzmanager.api.common.properties.QuartzModuleProperties;
|
||||
import org.quartz.spi.JobFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.PropertiesFactoryBean;
|
||||
@@ -17,7 +17,7 @@ import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
@ComponentScan(basePackages = {"it.fabioformosa.quartzmanager.controllers"})
|
||||
@ComponentScan(basePackages = {"it.fabioformosa.quartzmanager.api"})
|
||||
@Configuration
|
||||
@ConditionalOnProperty(name = "quartz.enabled", matchIfMissing = true)
|
||||
public class SchedulerConfig {
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.configuration;
|
||||
package it.fabioformosa.quartzmanager.api.configuration;
|
||||
|
||||
public class SecurityDiscover {
|
||||
public SecurityDiscover() {
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.configuration;
|
||||
package it.fabioformosa.quartzmanager.api.configuration;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.configuration;
|
||||
package it.fabioformosa.quartzmanager.api.configuration;
|
||||
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -8,7 +8,7 @@ import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBr
|
||||
import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
|
||||
|
||||
@Configuration
|
||||
@ComponentScan(basePackages = {"it.fabioformosa.quartzmanager.websockets"})
|
||||
@ComponentScan(basePackages = {"it.fabioformosa.quartzmanager.api.websockets"})
|
||||
@EnableWebSocketMessageBroker
|
||||
public class WebsocketConfig extends AbstractWebSocketMessageBrokerConfigurer {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.controllers;
|
||||
package it.fabioformosa.quartzmanager.api.controllers;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
@@ -6,7 +6,9 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import it.fabioformosa.quartzmanager.services.JobService;
|
||||
import it.fabioformosa.quartzmanager.api.common.config.OpenAPIConfigConsts;
|
||||
import it.fabioformosa.quartzmanager.api.common.config.QuartzManagerPaths;
|
||||
import it.fabioformosa.quartzmanager.api.services.JobService;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@@ -14,11 +16,8 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static it.fabioformosa.quartzmanager.common.config.OpenAPIConfigConsts.BASIC_AUTH_SEC_OAS_SCHEME;
|
||||
import static it.fabioformosa.quartzmanager.common.config.QuartzManagerPaths.QUARTZ_MANAGER_BASE_CONTEXT_PATH;
|
||||
|
||||
@RequestMapping(QUARTZ_MANAGER_BASE_CONTEXT_PATH + "/jobs")
|
||||
@SecurityRequirement(name = BASIC_AUTH_SEC_OAS_SCHEME)
|
||||
@RequestMapping(QuartzManagerPaths.QUARTZ_MANAGER_BASE_CONTEXT_PATH + "/jobs")
|
||||
@SecurityRequirement(name = OpenAPIConfigConsts.BASIC_AUTH_SEC_OAS_SCHEME)
|
||||
@RestController
|
||||
public class JobController {
|
||||
final private JobService jobService;
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.controllers;
|
||||
package it.fabioformosa.quartzmanager.api.controllers;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
@@ -6,8 +6,8 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import it.fabioformosa.quartzmanager.dto.SchedulerDTO;
|
||||
import it.fabioformosa.quartzmanager.services.SchedulerService;
|
||||
import it.fabioformosa.quartzmanager.api.dto.SchedulerDTO;
|
||||
import it.fabioformosa.quartzmanager.api.services.SchedulerService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.quartz.SchedulerException;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@@ -16,8 +16,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import static it.fabioformosa.quartzmanager.common.config.OpenAPIConfigConsts.BASIC_AUTH_SEC_OAS_SCHEME;
|
||||
import static it.fabioformosa.quartzmanager.common.config.QuartzManagerPaths.QUARTZ_MANAGER_BASE_CONTEXT_PATH;
|
||||
import static it.fabioformosa.quartzmanager.api.common.config.OpenAPIConfigConsts.BASIC_AUTH_SEC_OAS_SCHEME;
|
||||
import static it.fabioformosa.quartzmanager.api.common.config.QuartzManagerPaths.QUARTZ_MANAGER_BASE_CONTEXT_PATH;
|
||||
|
||||
/**
|
||||
* This controller provides scheduler info about config and status. It provides
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.controllers;
|
||||
package it.fabioformosa.quartzmanager.api.controllers;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
@@ -6,12 +6,14 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import it.fabioformosa.quartzmanager.dto.SimpleTriggerCommandDTO;
|
||||
import it.fabioformosa.quartzmanager.dto.SimpleTriggerDTO;
|
||||
import it.fabioformosa.quartzmanager.dto.SimpleTriggerInputDTO;
|
||||
import it.fabioformosa.quartzmanager.dto.TriggerDTO;
|
||||
import it.fabioformosa.quartzmanager.exceptions.TriggerNotFoundException;
|
||||
import it.fabioformosa.quartzmanager.services.SimpleTriggerService;
|
||||
import it.fabioformosa.quartzmanager.api.common.config.OpenAPIConfigConsts;
|
||||
import it.fabioformosa.quartzmanager.api.common.config.QuartzManagerPaths;
|
||||
import it.fabioformosa.quartzmanager.api.dto.SimpleTriggerCommandDTO;
|
||||
import it.fabioformosa.quartzmanager.api.dto.SimpleTriggerDTO;
|
||||
import it.fabioformosa.quartzmanager.api.dto.SimpleTriggerInputDTO;
|
||||
import it.fabioformosa.quartzmanager.api.dto.TriggerDTO;
|
||||
import it.fabioformosa.quartzmanager.api.services.SimpleTriggerService;
|
||||
import it.fabioformosa.quartzmanager.api.exceptions.TriggerNotFoundException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.quartz.SchedulerException;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@@ -19,16 +21,13 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
import static it.fabioformosa.quartzmanager.common.config.OpenAPIConfigConsts.BASIC_AUTH_SEC_OAS_SCHEME;
|
||||
import static it.fabioformosa.quartzmanager.common.config.QuartzManagerPaths.QUARTZ_MANAGER_BASE_CONTEXT_PATH;
|
||||
|
||||
@Slf4j
|
||||
@RequestMapping(SimpleTriggerController.SIMPLE_TRIGGER_CONTROLLER_BASE_URL)
|
||||
@SecurityRequirement(name = BASIC_AUTH_SEC_OAS_SCHEME)
|
||||
@SecurityRequirement(name = OpenAPIConfigConsts.BASIC_AUTH_SEC_OAS_SCHEME)
|
||||
@RestController
|
||||
public class SimpleTriggerController {
|
||||
|
||||
static protected final String SIMPLE_TRIGGER_CONTROLLER_BASE_URL = QUARTZ_MANAGER_BASE_CONTEXT_PATH + "/simple-triggers";
|
||||
static protected final String SIMPLE_TRIGGER_CONTROLLER_BASE_URL = QuartzManagerPaths.QUARTZ_MANAGER_BASE_CONTEXT_PATH + "/simple-triggers";
|
||||
|
||||
final private SimpleTriggerService simpleSchedulerService;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.controllers;
|
||||
package it.fabioformosa.quartzmanager.api.controllers;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
@@ -6,8 +6,8 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import it.fabioformosa.quartzmanager.dto.TriggerKeyDTO;
|
||||
import it.fabioformosa.quartzmanager.services.TriggerService;
|
||||
import it.fabioformosa.quartzmanager.api.dto.TriggerKeyDTO;
|
||||
import it.fabioformosa.quartzmanager.api.services.TriggerService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.quartz.SchedulerException;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -16,8 +16,8 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static it.fabioformosa.quartzmanager.common.config.OpenAPIConfigConsts.BASIC_AUTH_SEC_OAS_SCHEME;
|
||||
import static it.fabioformosa.quartzmanager.common.config.QuartzManagerPaths.QUARTZ_MANAGER_BASE_CONTEXT_PATH;
|
||||
import static it.fabioformosa.quartzmanager.api.common.config.OpenAPIConfigConsts.BASIC_AUTH_SEC_OAS_SCHEME;
|
||||
import static it.fabioformosa.quartzmanager.api.common.config.QuartzManagerPaths.QUARTZ_MANAGER_BASE_CONTEXT_PATH;
|
||||
|
||||
@Slf4j
|
||||
@RequestMapping(TriggerController.TRIGGER_CONTROLLER_BASE_URL)
|
||||
@@ -1,15 +1,14 @@
|
||||
package it.fabioformosa.quartzmanager.controllers;
|
||||
package it.fabioformosa.quartzmanager.api.controllers;
|
||||
|
||||
import it.fabioformosa.quartzmanager.api.common.config.QuartzManagerPaths;
|
||||
import org.springframework.messaging.handler.annotation.MessageMapping;
|
||||
import org.springframework.messaging.handler.annotation.SendTo;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
||||
import static it.fabioformosa.quartzmanager.common.config.QuartzManagerPaths.QUARTZ_MANAGER_BASE_CONTEXT_PATH;
|
||||
|
||||
@Controller
|
||||
public class WebsocketController {
|
||||
|
||||
@MessageMapping({ QUARTZ_MANAGER_BASE_CONTEXT_PATH + "/logs", QUARTZ_MANAGER_BASE_CONTEXT_PATH + "/progress" })
|
||||
@MessageMapping({ QuartzManagerPaths.QUARTZ_MANAGER_BASE_CONTEXT_PATH + "/logs", QuartzManagerPaths.QUARTZ_MANAGER_BASE_CONTEXT_PATH + "/progress" })
|
||||
@SendTo("/topic/logs")
|
||||
public String subscribe() {
|
||||
return "subscribed";
|
||||
@@ -1,8 +1,8 @@
|
||||
package it.fabioformosa.quartzmanager.controllers.advices;
|
||||
package it.fabioformosa.quartzmanager.api.controllers.advices;
|
||||
|
||||
import it.fabioformosa.quartzmanager.exceptions.ExceptionResponse;
|
||||
import it.fabioformosa.quartzmanager.exceptions.ResourceConflictException;
|
||||
import it.fabioformosa.quartzmanager.exceptions.TriggerNotFoundException;
|
||||
import it.fabioformosa.quartzmanager.api.exceptions.ExceptionResponse;
|
||||
import it.fabioformosa.quartzmanager.api.exceptions.ResourceConflictException;
|
||||
import it.fabioformosa.quartzmanager.api.exceptions.TriggerNotFoundException;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
@@ -1,7 +1,7 @@
|
||||
package it.fabioformosa.quartzmanager.converters;
|
||||
package it.fabioformosa.quartzmanager.api.converters;
|
||||
|
||||
import it.fabioformosa.metamorphosis.core.converters.AbstractBaseConverterToDTO;
|
||||
import it.fabioformosa.quartzmanager.dto.JobDetailDTO;
|
||||
import it.fabioformosa.quartzmanager.api.dto.JobDetailDTO;
|
||||
import lombok.SneakyThrows;
|
||||
import org.quartz.JobDetail;
|
||||
import org.quartz.JobKey;
|
||||
@@ -1,7 +1,7 @@
|
||||
package it.fabioformosa.quartzmanager.converters;
|
||||
package it.fabioformosa.quartzmanager.api.converters;
|
||||
|
||||
import it.fabioformosa.metamorphosis.core.converters.AbstractBaseConverterToDTO;
|
||||
import it.fabioformosa.quartzmanager.dto.JobKeyDTO;
|
||||
import it.fabioformosa.quartzmanager.api.dto.JobKeyDTO;
|
||||
import org.quartz.JobKey;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package it.fabioformosa.quartzmanager.converters;
|
||||
package it.fabioformosa.quartzmanager.api.converters;
|
||||
|
||||
import it.fabioformosa.metamorphosis.core.converters.AbstractBaseConverterToDTO;
|
||||
import it.fabioformosa.quartzmanager.dto.SchedulerDTO;
|
||||
import it.fabioformosa.quartzmanager.enums.SchedulerStatus;
|
||||
import it.fabioformosa.quartzmanager.api.dto.SchedulerDTO;
|
||||
import it.fabioformosa.quartzmanager.api.enums.SchedulerStatus;
|
||||
import lombok.SneakyThrows;
|
||||
import org.quartz.Scheduler;
|
||||
import org.quartz.SchedulerException;
|
||||
@@ -1,7 +1,7 @@
|
||||
package it.fabioformosa.quartzmanager.converters;
|
||||
package it.fabioformosa.quartzmanager.api.converters;
|
||||
|
||||
|
||||
import it.fabioformosa.quartzmanager.dto.SimpleTriggerCommandDTO;
|
||||
import it.fabioformosa.quartzmanager.api.dto.SimpleTriggerCommandDTO;
|
||||
import org.quartz.SimpleScheduleBuilder;
|
||||
import org.quartz.SimpleTrigger;
|
||||
import org.quartz.Trigger;
|
||||
@@ -1,6 +1,6 @@
|
||||
package it.fabioformosa.quartzmanager.converters;
|
||||
package it.fabioformosa.quartzmanager.api.converters;
|
||||
|
||||
import it.fabioformosa.quartzmanager.dto.SimpleTriggerDTO;
|
||||
import it.fabioformosa.quartzmanager.api.dto.SimpleTriggerDTO;
|
||||
import org.quartz.SimpleTrigger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package it.fabioformosa.quartzmanager.converters;
|
||||
package it.fabioformosa.quartzmanager.api.converters;
|
||||
|
||||
import it.fabioformosa.metamorphosis.core.converters.AbstractBaseConverterToDTO;
|
||||
import it.fabioformosa.quartzmanager.dto.TriggerKeyDTO;
|
||||
import it.fabioformosa.quartzmanager.api.dto.TriggerKeyDTO;
|
||||
import org.quartz.TriggerKey;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package it.fabioformosa.quartzmanager.converters;
|
||||
package it.fabioformosa.quartzmanager.api.converters;
|
||||
|
||||
import it.fabioformosa.metamorphosis.core.converters.AbstractBaseConverter;
|
||||
import it.fabioformosa.quartzmanager.dto.JobDetailDTO;
|
||||
import it.fabioformosa.quartzmanager.dto.JobKeyDTO;
|
||||
import it.fabioformosa.quartzmanager.dto.TriggerDTO;
|
||||
import it.fabioformosa.quartzmanager.dto.TriggerKeyDTO;
|
||||
import it.fabioformosa.quartzmanager.api.dto.JobDetailDTO;
|
||||
import it.fabioformosa.quartzmanager.api.dto.JobKeyDTO;
|
||||
import it.fabioformosa.quartzmanager.api.dto.TriggerDTO;
|
||||
import it.fabioformosa.quartzmanager.api.dto.TriggerKeyDTO;
|
||||
import org.quartz.JobKey;
|
||||
import org.quartz.Trigger;
|
||||
import org.quartz.TriggerKey;
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.dto;
|
||||
package it.fabioformosa.quartzmanager.api.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.dto;
|
||||
package it.fabioformosa.quartzmanager.api.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
@@ -1,6 +1,6 @@
|
||||
package it.fabioformosa.quartzmanager.dto;
|
||||
package it.fabioformosa.quartzmanager.api.dto;
|
||||
|
||||
import it.fabioformosa.quartzmanager.enums.SchedulerStatus;
|
||||
import it.fabioformosa.quartzmanager.api.enums.SchedulerStatus;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.dto;
|
||||
package it.fabioformosa.quartzmanager.api.dto;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.dto;
|
||||
package it.fabioformosa.quartzmanager.api.dto;
|
||||
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.dto;
|
||||
package it.fabioformosa.quartzmanager.api.dto;
|
||||
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.dto;
|
||||
package it.fabioformosa.quartzmanager.api.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.*;
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.dto;
|
||||
package it.fabioformosa.quartzmanager.api.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.dto;
|
||||
package it.fabioformosa.quartzmanager.api.dto;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.dto;
|
||||
package it.fabioformosa.quartzmanager.api.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.enums;
|
||||
package it.fabioformosa.quartzmanager.api.enums;
|
||||
|
||||
public enum SchedulerStatus {
|
||||
RUNNING, STOPPED, PAUSED
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.exceptions;
|
||||
package it.fabioformosa.quartzmanager.api.exceptions;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.exceptions;
|
||||
package it.fabioformosa.quartzmanager.api.exceptions;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.exceptions;
|
||||
package it.fabioformosa.quartzmanager.api.exceptions;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
@@ -1,9 +1,9 @@
|
||||
package it.fabioformosa.quartzmanager.jobs;
|
||||
package it.fabioformosa.quartzmanager.api.jobs;
|
||||
|
||||
import it.fabioformosa.quartzmanager.dto.TriggerFiredBundleDTO;
|
||||
import it.fabioformosa.quartzmanager.jobs.entities.LogRecord;
|
||||
import it.fabioformosa.quartzmanager.websockets.WebSocketProgressNotifier;
|
||||
import it.fabioformosa.quartzmanager.websockets.WebhookSender;
|
||||
import it.fabioformosa.quartzmanager.api.jobs.entities.LogRecord;
|
||||
import it.fabioformosa.quartzmanager.api.websockets.WebSocketProgressNotifier;
|
||||
import it.fabioformosa.quartzmanager.api.websockets.WebhookSender;
|
||||
import it.fabioformosa.quartzmanager.api.dto.TriggerFiredBundleDTO;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.slf4j.Logger;
|
||||
@@ -1,10 +1,10 @@
|
||||
package it.fabioformosa.quartzmanager.jobs.entities;
|
||||
package it.fabioformosa.quartzmanager.api.jobs.entities;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Log record produced by a job at the end of each run
|
||||
*
|
||||
*
|
||||
* @author Fabio.Formosa
|
||||
*
|
||||
*/
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.scheduler;
|
||||
package it.fabioformosa.quartzmanager.api.scheduler;
|
||||
|
||||
import org.quartz.spi.TriggerFiredBundle;
|
||||
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
|
||||
@@ -23,4 +23,4 @@ public final class AutowiringSpringBeanJobFactory extends SpringBeanJobFactory
|
||||
public void setApplicationContext(final ApplicationContext context) {
|
||||
beanFactory = context.getAutowireCapableBeanFactory();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package it.fabioformosa.quartzmanager.services;
|
||||
package it.fabioformosa.quartzmanager.api.services;
|
||||
|
||||
import it.fabioformosa.quartzmanager.exceptions.TriggerNotFoundException;
|
||||
import it.fabioformosa.quartzmanager.api.exceptions.TriggerNotFoundException;
|
||||
import org.quartz.*;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package it.fabioformosa.quartzmanager.services;
|
||||
package it.fabioformosa.quartzmanager.api.services;
|
||||
|
||||
import it.fabioformosa.quartzmanager.jobs.AbstractQuartzManagerJob;
|
||||
import it.fabioformosa.quartzmanager.api.jobs.AbstractQuartzManagerJob;
|
||||
import lombok.Getter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.reflections.Reflections;
|
||||
@@ -1,6 +1,6 @@
|
||||
package it.fabioformosa.quartzmanager.services;
|
||||
package it.fabioformosa.quartzmanager.api.services;
|
||||
|
||||
import it.fabioformosa.quartzmanager.dto.SchedulerDTO;
|
||||
import it.fabioformosa.quartzmanager.api.dto.SchedulerDTO;
|
||||
import org.quartz.Scheduler;
|
||||
import org.quartz.SchedulerException;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
@@ -1,9 +1,9 @@
|
||||
package it.fabioformosa.quartzmanager.services;
|
||||
package it.fabioformosa.quartzmanager.api.services;
|
||||
|
||||
import it.fabioformosa.quartzmanager.dto.SimpleTriggerCommandDTO;
|
||||
import it.fabioformosa.quartzmanager.dto.SimpleTriggerDTO;
|
||||
import it.fabioformosa.quartzmanager.dto.TriggerDTO;
|
||||
import it.fabioformosa.quartzmanager.exceptions.TriggerNotFoundException;
|
||||
import it.fabioformosa.quartzmanager.api.dto.SimpleTriggerCommandDTO;
|
||||
import it.fabioformosa.quartzmanager.api.dto.TriggerDTO;
|
||||
import it.fabioformosa.quartzmanager.api.dto.SimpleTriggerDTO;
|
||||
import it.fabioformosa.quartzmanager.api.exceptions.TriggerNotFoundException;
|
||||
import org.quartz.*;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -1,6 +1,6 @@
|
||||
package it.fabioformosa.quartzmanager.services;
|
||||
package it.fabioformosa.quartzmanager.api.services;
|
||||
|
||||
import it.fabioformosa.quartzmanager.dto.TriggerKeyDTO;
|
||||
import it.fabioformosa.quartzmanager.api.dto.TriggerKeyDTO;
|
||||
import org.quartz.Scheduler;
|
||||
import org.quartz.SchedulerException;
|
||||
import org.quartz.TriggerKey;
|
||||
@@ -1,6 +1,6 @@
|
||||
package it.fabioformosa.quartzmanager.websockets;
|
||||
package it.fabioformosa.quartzmanager.api.websockets;
|
||||
|
||||
import it.fabioformosa.quartzmanager.jobs.entities.LogRecord;
|
||||
import it.fabioformosa.quartzmanager.api.jobs.entities.LogRecord;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.messaging.simp.SimpMessageSendingOperations;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -1,6 +1,6 @@
|
||||
package it.fabioformosa.quartzmanager.websockets;
|
||||
package it.fabioformosa.quartzmanager.api.websockets;
|
||||
|
||||
import it.fabioformosa.quartzmanager.dto.TriggerFiredBundleDTO;
|
||||
import it.fabioformosa.quartzmanager.api.dto.TriggerFiredBundleDTO;
|
||||
import org.quartz.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.messaging.simp.SimpMessageSendingOperations;
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.websockets;
|
||||
package it.fabioformosa.quartzmanager.api.websockets;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -1,4 +1,4 @@
|
||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||
it.fabioformosa.quartzmanager.configuration.SchedulerConfig,\
|
||||
it.fabioformosa.quartzmanager.configuration.OpenApiConfig,\
|
||||
it.fabioformosa.quartzmanager.configuration.WebsocketConfig
|
||||
it.fabioformosa.quartzmanager.api.configuration.SchedulerConfig,\
|
||||
it.fabioformosa.quartzmanager.api.configuration.OpenApiConfig,\
|
||||
it.fabioformosa.quartzmanager.api.configuration.WebsocketConfig
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager;
|
||||
package it.fabioformosa.quartzmanager.api;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.SpringBootConfiguration;
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.configuration;
|
||||
package it.fabioformosa.quartzmanager.api.configuration;
|
||||
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -7,8 +7,6 @@ import org.quartz.SchedulerException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import static it.fabioformosa.quartzmanager.configuration.QuartzDefaultPropertiesConfig.QUARTZ_MANAGER_SCHEDULER_DEFAULT_NAME;
|
||||
|
||||
@SpringBootTest
|
||||
class SchedulerConfigDefaultAppPropertiesTest {
|
||||
|
||||
@@ -22,7 +20,7 @@ class SchedulerConfigDefaultAppPropertiesTest {
|
||||
|
||||
@Test
|
||||
void givenTheQuartzNameMissing_whenTheBootstrapOccurs_thenAQuartzInstanceShouldBeTheDefaultName() throws SchedulerException {
|
||||
Assertions.assertThat(scheduler.getSchedulerName()).isEqualTo(QUARTZ_MANAGER_SCHEDULER_DEFAULT_NAME);
|
||||
Assertions.assertThat(scheduler.getSchedulerName()).isEqualTo(QuartzDefaultPropertiesConfig.QUARTZ_MANAGER_SCHEDULER_DEFAULT_NAME);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package it.fabioformosa.quartzmanager.configuration;
|
||||
package it.fabioformosa.quartzmanager.api.configuration;
|
||||
|
||||
import it.fabioformosa.quartzmanager.common.properties.QuartzModuleProperties;
|
||||
import it.fabioformosa.quartzmanager.api.common.properties.QuartzModuleProperties;
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.quartz.Scheduler;
|
||||
@@ -1,14 +1,14 @@
|
||||
package it.fabioformosa.quartzmanager.controllers;
|
||||
package it.fabioformosa.quartzmanager.api.controllers;
|
||||
|
||||
import it.fabioformosa.quartzmanager.QuartManagerApplicationTests;
|
||||
import it.fabioformosa.quartzmanager.controllers.utils.InvalidSimpleTriggerCommandDTOProvider;
|
||||
import it.fabioformosa.quartzmanager.controllers.utils.TestUtils;
|
||||
import it.fabioformosa.quartzmanager.controllers.utils.TriggerUtils;
|
||||
import it.fabioformosa.quartzmanager.dto.SimpleTriggerCommandDTO;
|
||||
import it.fabioformosa.quartzmanager.dto.SimpleTriggerDTO;
|
||||
import it.fabioformosa.quartzmanager.dto.SimpleTriggerInputDTO;
|
||||
import it.fabioformosa.quartzmanager.exceptions.TriggerNotFoundException;
|
||||
import it.fabioformosa.quartzmanager.services.SimpleTriggerService;
|
||||
import it.fabioformosa.quartzmanager.api.QuartManagerApplicationTests;
|
||||
import it.fabioformosa.quartzmanager.api.controllers.utils.InvalidSimpleTriggerCommandDTOProvider;
|
||||
import it.fabioformosa.quartzmanager.api.controllers.utils.TestUtils;
|
||||
import it.fabioformosa.quartzmanager.api.controllers.utils.TriggerUtils;
|
||||
import it.fabioformosa.quartzmanager.api.dto.SimpleTriggerCommandDTO;
|
||||
import it.fabioformosa.quartzmanager.api.dto.SimpleTriggerDTO;
|
||||
import it.fabioformosa.quartzmanager.api.dto.SimpleTriggerInputDTO;
|
||||
import it.fabioformosa.quartzmanager.api.services.SimpleTriggerService;
|
||||
import it.fabioformosa.quartzmanager.api.exceptions.TriggerNotFoundException;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
@@ -79,7 +79,7 @@ class SimpleTriggerControllerTest {
|
||||
|
||||
private SimpleTriggerInputDTO buildSimpleTriggerCommandDTO() {
|
||||
return SimpleTriggerInputDTO.builder()
|
||||
.jobClass("it.fabioformosa.quartzmanager.jobs.SampleJob")
|
||||
.jobClass("it.fabioformosa.quartzmanager.api.jobs.SampleJob")
|
||||
.startDate(new Date())
|
||||
.repeatCount(20)
|
||||
.repeatInterval(20000L)
|
||||
@@ -1,7 +1,7 @@
|
||||
package it.fabioformosa.quartzmanager.controllers;
|
||||
package it.fabioformosa.quartzmanager.api.controllers;
|
||||
|
||||
import it.fabioformosa.quartzmanager.QuartManagerApplicationTests;
|
||||
import it.fabioformosa.quartzmanager.services.TriggerService;
|
||||
import it.fabioformosa.quartzmanager.api.QuartManagerApplicationTests;
|
||||
import it.fabioformosa.quartzmanager.api.services.TriggerService;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.mockito.Mockito;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -1,6 +1,6 @@
|
||||
package it.fabioformosa.quartzmanager.controllers.utils;
|
||||
package it.fabioformosa.quartzmanager.api.controllers.utils;
|
||||
|
||||
import it.fabioformosa.quartzmanager.dto.SimpleTriggerInputDTO;
|
||||
import it.fabioformosa.quartzmanager.api.dto.SimpleTriggerInputDTO;
|
||||
import org.junit.jupiter.api.extension.ExtensionContext;
|
||||
import org.junit.jupiter.params.provider.Arguments;
|
||||
import org.junit.jupiter.params.provider.ArgumentsProvider;
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.controllers.utils;
|
||||
package it.fabioformosa.quartzmanager.api.controllers.utils;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
@@ -1,7 +1,7 @@
|
||||
package it.fabioformosa.quartzmanager.controllers.utils;
|
||||
package it.fabioformosa.quartzmanager.api.controllers.utils;
|
||||
|
||||
import it.fabioformosa.quartzmanager.common.utils.DateUtils;
|
||||
import it.fabioformosa.quartzmanager.dto.*;
|
||||
import it.fabioformosa.quartzmanager.api.common.utils.DateUtils;
|
||||
import it.fabioformosa.quartzmanager.api.dto.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package it.fabioformosa.quartzmanager.api.jobs;
|
||||
|
||||
import it.fabioformosa.quartzmanager.api.jobs.entities.LogRecord;
|
||||
import org.quartz.JobExecutionContext;
|
||||
|
||||
public class SampleJob extends AbstractQuartzManagerJob {
|
||||
|
||||
@Override
|
||||
public LogRecord doIt(JobExecutionContext jobExecutionContext) {
|
||||
return new LogRecord(LogRecord.LogType.INFO, "Hello!");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.services;
|
||||
package it.fabioformosa.quartzmanager.api.services;
|
||||
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -10,7 +10,7 @@ class JobServiceTest {
|
||||
|
||||
@Test
|
||||
void givenTwoJobClassesInTwoPackages_whenTheJobServiceIsCalled_shouldReturnTwoJobClasses(){
|
||||
JobService jobService = new JobService("it.fabioformosa.quartzmanager.jobs, it.fabioformosa.samplepackage");
|
||||
JobService jobService = new JobService("it.fabioformosa.quartzmanager.api.jobs, it.fabioformosa.samplepackage");
|
||||
jobService.initJobClassList();
|
||||
Assertions.assertThat(jobService).isNotNull();
|
||||
Assertions.assertThat(jobService.getJobClasses().size()).isEqualTo(2);
|
||||
@@ -18,9 +18,9 @@ class JobServiceTest {
|
||||
|
||||
@ParameterizedTest
|
||||
@ValueSource(strings = {
|
||||
"it.fabioformosa.quartzmanager.jobs",
|
||||
"it.fabioformosa.quartzmanager.jobs,",
|
||||
",it.fabioformosa.quartzmanager.jobs"
|
||||
"it.fabioformosa.quartzmanager.api.jobs",
|
||||
"it.fabioformosa.quartzmanager.api.jobs,",
|
||||
",it.fabioformosa.quartzmanager.api.jobs"
|
||||
})
|
||||
void givenOnePackage_whenTheJobServiceIsCalled_shouldReturnOneJobClasses(String packageStr){
|
||||
JobService jobService = new JobService(packageStr);
|
||||
@@ -1,8 +1,8 @@
|
||||
package it.fabioformosa.quartzmanager.services;
|
||||
package it.fabioformosa.quartzmanager.api.services;
|
||||
|
||||
import it.fabioformosa.quartzmanager.common.utils.DateUtils;
|
||||
import it.fabioformosa.quartzmanager.dto.*;
|
||||
import it.fabioformosa.quartzmanager.exceptions.TriggerNotFoundException;
|
||||
import it.fabioformosa.quartzmanager.api.common.utils.DateUtils;
|
||||
import it.fabioformosa.quartzmanager.api.dto.*;
|
||||
import it.fabioformosa.quartzmanager.api.exceptions.TriggerNotFoundException;
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -48,7 +48,7 @@ class SimpleTriggerServiceTest {
|
||||
@Test
|
||||
void givenASimpleTriggerCommandDTO_whenASimpleTriggerIsScheduled_thenATriggerDTOIsReturned() throws SchedulerException, ClassNotFoundException {
|
||||
SimpleTriggerInputDTO triggerInputDTO = SimpleTriggerInputDTO.builder()
|
||||
.jobClass("it.fabioformosa.quartzmanager.jobs.SampleJob")
|
||||
.jobClass("it.fabioformosa.quartzmanager.api.jobs.SampleJob")
|
||||
.startDate(new Date())
|
||||
.repeatInterval(5000L).repeatCount(5)
|
||||
.endDate(DateUtils.getHoursFromNow(1))
|
||||
@@ -1,14 +0,0 @@
|
||||
package it.fabioformosa.quartzmanager.jobs;
|
||||
|
||||
import it.fabioformosa.quartzmanager.jobs.entities.LogRecord;
|
||||
import it.fabioformosa.quartzmanager.jobs.entities.LogRecord.LogType;
|
||||
import org.quartz.JobExecutionContext;
|
||||
|
||||
public class SampleJob extends AbstractQuartzManagerJob {
|
||||
|
||||
@Override
|
||||
public LogRecord doIt(JobExecutionContext jobExecutionContext) {
|
||||
return new LogRecord(LogType.INFO, "Hello!");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
package it.fabioformosa.samplepackage;
|
||||
|
||||
import it.fabioformosa.quartzmanager.jobs.AbstractQuartzManagerJob;
|
||||
import it.fabioformosa.quartzmanager.jobs.entities.LogRecord;
|
||||
import it.fabioformosa.quartzmanager.jobs.entities.LogRecord.LogType;
|
||||
import it.fabioformosa.quartzmanager.api.jobs.AbstractQuartzManagerJob;
|
||||
import it.fabioformosa.quartzmanager.api.jobs.entities.LogRecord;
|
||||
import it.fabioformosa.quartzmanager.api.jobs.entities.LogRecord.LogType;
|
||||
import org.quartz.JobExecutionContext;
|
||||
|
||||
public class SampleExtraJob extends AbstractQuartzManagerJob {
|
||||
|
||||
@@ -1,18 +1,11 @@
|
||||
app:
|
||||
name: quartz-manager
|
||||
|
||||
quartz:
|
||||
enabled: true
|
||||
|
||||
job:
|
||||
frequency: 4000
|
||||
repeatCount: 19
|
||||
quartz-manager:
|
||||
jobClassPackages: it.fabioformosa.quartzmanager.api.jobs
|
||||
|
||||
logging:
|
||||
level:
|
||||
org.springframework.boot.autoconfigure.security: INFO
|
||||
it.fabioformosa: DEBUG
|
||||
org.quartz: INFO
|
||||
|
||||
quartz-manager:
|
||||
jobClassPackages: it.fabioformosa.quartzmanager.jobs
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package it.fabioformosa.quartzmanager.persistence;
|
||||
package it.fabioformosa.quartzmanager.api.persistence;
|
||||
|
||||
import it.fabioformosa.quartzmanager.common.properties.QuartzModuleProperties;
|
||||
import it.fabioformosa.quartzmanager.api.common.properties.QuartzModuleProperties;
|
||||
import liquibase.integration.spring.SpringLiquibase;
|
||||
import lombok.Data;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.persistence;
|
||||
package it.fabioformosa.quartzmanager.api.persistence;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -1,2 +1,2 @@
|
||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||
it.fabioformosa.quartzmanager.persistence.PersistenceConfig
|
||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||
it.fabioformosa.quartzmanager.api.persistence.PersistenceConfig
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package it.fabioformosa.quartzmanager.security;
|
||||
package it.fabioformosa.quartzmanager.api.security;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import it.fabioformosa.quartzmanager.common.config.QuartzManagerPaths;
|
||||
import it.fabioformosa.quartzmanager.security.helpers.LoginConfigurer;
|
||||
import it.fabioformosa.quartzmanager.security.helpers.impl.*;
|
||||
import it.fabioformosa.quartzmanager.security.properties.InMemoryAccountProperties;
|
||||
import it.fabioformosa.quartzmanager.security.properties.JwtSecurityProperties;
|
||||
import it.fabioformosa.quartzmanager.api.common.config.QuartzManagerPaths;
|
||||
import it.fabioformosa.quartzmanager.api.security.helpers.LoginConfigurer;
|
||||
import it.fabioformosa.quartzmanager.api.security.helpers.impl.*;
|
||||
import it.fabioformosa.quartzmanager.api.security.properties.InMemoryAccountProperties;
|
||||
import it.fabioformosa.quartzmanager.api.security.properties.JwtSecurityProperties;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@@ -32,8 +32,8 @@ import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.cors.CorsConfigurationSource;
|
||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||
|
||||
import static it.fabioformosa.quartzmanager.common.config.QuartzManagerPaths.QUARTZ_MANAGER_LOGIN_PATH;
|
||||
import static it.fabioformosa.quartzmanager.common.config.QuartzManagerPaths.QUARTZ_MANAGER_LOGOUT_PATH;
|
||||
import static it.fabioformosa.quartzmanager.api.common.config.QuartzManagerPaths.QUARTZ_MANAGER_LOGIN_PATH;
|
||||
import static it.fabioformosa.quartzmanager.api.common.config.QuartzManagerPaths.QUARTZ_MANAGER_LOGOUT_PATH;
|
||||
|
||||
/**
|
||||
* @author Fabio.Formosa
|
||||
@@ -1,8 +1,8 @@
|
||||
package it.fabioformosa.quartzmanager.security.controllers;
|
||||
package it.fabioformosa.quartzmanager.api.security.controllers;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import it.fabioformosa.quartzmanager.common.config.OpenAPIConfigConsts;
|
||||
import it.fabioformosa.quartzmanager.api.common.config.OpenAPIConfigConsts;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import static it.fabioformosa.quartzmanager.common.config.QuartzManagerPaths.QUARTZ_MANAGER_AUTH_PATH;
|
||||
import static it.fabioformosa.quartzmanager.api.common.config.QuartzManagerPaths.QUARTZ_MANAGER_AUTH_PATH;
|
||||
|
||||
@RestController
|
||||
@Hidden
|
||||
@@ -1,21 +1,21 @@
|
||||
package it.fabioformosa.quartzmanager.security.helpers;
|
||||
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
|
||||
/**
|
||||
* It configures filters to authenticate credentials sent by client or to set authenticationSuccessHandler
|
||||
*
|
||||
* Implement this interface for a login strategy
|
||||
*
|
||||
*/
|
||||
public interface LoginConfigurer {
|
||||
|
||||
/**
|
||||
* If the authentication is based on cookie, it returns the name of cookie to be erased at the logout
|
||||
*/
|
||||
String cookieMustBeDeletedAtLogout();
|
||||
|
||||
HttpSecurity login(String loginPath, HttpSecurity http, AuthenticationManager authenticationManager) throws Exception;
|
||||
|
||||
}
|
||||
package it.fabioformosa.quartzmanager.api.security.helpers;
|
||||
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
|
||||
/**
|
||||
* It configures filters to authenticate credentials sent by client or to set authenticationSuccessHandler
|
||||
*
|
||||
* Implement this interface for a login strategy
|
||||
*
|
||||
*/
|
||||
public interface LoginConfigurer {
|
||||
|
||||
/**
|
||||
* If the authentication is based on cookie, it returns the name of cookie to be erased at the logout
|
||||
*/
|
||||
String cookieMustBeDeletedAtLogout();
|
||||
|
||||
HttpSecurity login(String loginPath, HttpSecurity http, AuthenticationManager authenticationManager) throws Exception;
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.security.helpers.impl;
|
||||
package it.fabioformosa.quartzmanager.api.security.helpers.impl;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -1,45 +1,45 @@
|
||||
package it.fabioformosa.quartzmanager.security.helpers.impl;
|
||||
|
||||
import org.springframework.security.authentication.AbstractAuthenticationToken;
|
||||
|
||||
public class AnonAuthentication extends AbstractAuthenticationToken {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public AnonAuthentication() {
|
||||
super( null );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals( Object obj ) {
|
||||
if ( this == obj )
|
||||
return true;
|
||||
if ( obj == null )
|
||||
return false;
|
||||
if ( getClass() != obj.getClass() )
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getCredentials() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getPrincipal() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAuthenticated() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
package it.fabioformosa.quartzmanager.api.security.helpers.impl;
|
||||
|
||||
import org.springframework.security.authentication.AbstractAuthenticationToken;
|
||||
|
||||
public class AnonAuthentication extends AbstractAuthenticationToken {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public AnonAuthentication() {
|
||||
super( null );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals( Object obj ) {
|
||||
if ( this == obj )
|
||||
return true;
|
||||
if ( obj == null )
|
||||
return false;
|
||||
if ( getClass() != obj.getClass() )
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getCredentials() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getPrincipal() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAuthenticated() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,20 +1,20 @@
|
||||
package it.fabioformosa.quartzmanager.security.helpers.impl;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler;
|
||||
|
||||
public class AuthenticationFailureHandler extends SimpleUrlAuthenticationFailureHandler {
|
||||
|
||||
@Override
|
||||
public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response,
|
||||
AuthenticationException exception) throws IOException, ServletException {
|
||||
|
||||
super.onAuthenticationFailure(request, response, exception);
|
||||
}
|
||||
}
|
||||
package it.fabioformosa.quartzmanager.api.security.helpers.impl;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler;
|
||||
|
||||
public class AuthenticationFailureHandler extends SimpleUrlAuthenticationFailureHandler {
|
||||
|
||||
@Override
|
||||
public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response,
|
||||
AuthenticationException exception) throws IOException, ServletException {
|
||||
|
||||
super.onAuthenticationFailure(request, response, exception);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.security.helpers.impl;
|
||||
package it.fabioformosa.quartzmanager.api.security.helpers.impl;
|
||||
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.web.authentication.SimpleUrlAuthenticationSuccessHandler;
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.security.helpers.impl;
|
||||
package it.fabioformosa.quartzmanager.api.security.helpers.impl;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -6,7 +6,7 @@ import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configurers.FormLoginConfigurer;
|
||||
|
||||
import it.fabioformosa.quartzmanager.security.helpers.LoginConfigurer;
|
||||
import it.fabioformosa.quartzmanager.api.security.helpers.LoginConfigurer;
|
||||
|
||||
/**
|
||||
* It delegates the login to the @FormLoginConfigurer of the httpSecurity.
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.security.helpers.impl;
|
||||
package it.fabioformosa.quartzmanager.api.security.helpers.impl;
|
||||
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.security.helpers.impl;
|
||||
package it.fabioformosa.quartzmanager.api.security.helpers.impl;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package it.fabioformosa.quartzmanager.security.helpers.impl;
|
||||
package it.fabioformosa.quartzmanager.api.security.helpers.impl;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import it.fabioformosa.quartzmanager.security.properties.JwtSecurityProperties;
|
||||
import it.fabioformosa.quartzmanager.security.models.UserTokenState;
|
||||
import it.fabioformosa.quartzmanager.api.security.properties.JwtSecurityProperties;
|
||||
import it.fabioformosa.quartzmanager.api.security.models.UserTokenState;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.security.helpers.impl;
|
||||
package it.fabioformosa.quartzmanager.api.security.helpers.impl;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -1,42 +1,42 @@
|
||||
package it.fabioformosa.quartzmanager.security.helpers.impl;
|
||||
|
||||
import org.springframework.security.authentication.AbstractAuthenticationToken;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
|
||||
|
||||
public class JwtTokenBasedAuthentication extends AbstractAuthenticationToken {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String token;
|
||||
private final UserDetails principle;
|
||||
|
||||
public JwtTokenBasedAuthentication(UserDetails principle) {
|
||||
super(principle.getAuthorities());
|
||||
this.principle = principle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getCredentials() {
|
||||
return token;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserDetails getPrincipal() {
|
||||
return principle;
|
||||
}
|
||||
|
||||
public String getToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAuthenticated() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setToken( String token ) {
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
}
|
||||
package it.fabioformosa.quartzmanager.api.security.helpers.impl;
|
||||
|
||||
import org.springframework.security.authentication.AbstractAuthenticationToken;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
|
||||
|
||||
public class JwtTokenBasedAuthentication extends AbstractAuthenticationToken {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String token;
|
||||
private final UserDetails principle;
|
||||
|
||||
public JwtTokenBasedAuthentication(UserDetails principle) {
|
||||
super(principle.getAuthorities());
|
||||
this.principle = principle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getCredentials() {
|
||||
return token;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserDetails getPrincipal() {
|
||||
return principle;
|
||||
}
|
||||
|
||||
public String getToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAuthenticated() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setToken( String token ) {
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package it.fabioformosa.quartzmanager.security.helpers.impl;
|
||||
package it.fabioformosa.quartzmanager.api.security.helpers.impl;
|
||||
|
||||
import io.jsonwebtoken.Claims;
|
||||
import io.jsonwebtoken.Jwts;
|
||||
import io.jsonwebtoken.SignatureAlgorithm;
|
||||
import it.fabioformosa.quartzmanager.security.properties.JwtSecurityProperties;
|
||||
import it.fabioformosa.quartzmanager.api.security.properties.JwtSecurityProperties;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.security.helpers.impl;
|
||||
package it.fabioformosa.quartzmanager.api.security.helpers.impl;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -9,7 +9,7 @@ import org.springframework.security.web.authentication.preauth.AbstractPreAuthen
|
||||
import org.springframework.security.web.util.matcher.RegexRequestMatcher;
|
||||
import org.springframework.web.filter.GenericFilterBean;
|
||||
|
||||
import it.fabioformosa.quartzmanager.security.helpers.LoginConfigurer;
|
||||
import it.fabioformosa.quartzmanager.api.security.helpers.LoginConfigurer;
|
||||
|
||||
/**
|
||||
* It adds a new filter @JwtAuthenticationFilter after @AbstractPreAuthenticatedProcessingFilter that match login path
|
||||
@@ -1,36 +1,36 @@
|
||||
package it.fabioformosa.quartzmanager.security.helpers.impl;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
public class LogoutSuccess implements LogoutSuccessHandler {
|
||||
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
public LogoutSuccess(ObjectMapper objectMapper) {
|
||||
super();
|
||||
this.objectMapper = objectMapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLogoutSuccess(HttpServletRequest httpServletRequest, HttpServletResponse response, Authentication authentication)
|
||||
throws IOException, ServletException {
|
||||
Map<String, String> result = new HashMap<>();
|
||||
result.put( "result", "success" );
|
||||
response.setContentType("application/json");
|
||||
response.getWriter().write(objectMapper.writeValueAsString(result));
|
||||
response.setStatus(HttpServletResponse.SC_OK);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
package it.fabioformosa.quartzmanager.api.security.helpers.impl;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
public class LogoutSuccess implements LogoutSuccessHandler {
|
||||
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
public LogoutSuccess(ObjectMapper objectMapper) {
|
||||
super();
|
||||
this.objectMapper = objectMapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLogoutSuccess(HttpServletRequest httpServletRequest, HttpServletResponse response, Authentication authentication)
|
||||
throws IOException, ServletException {
|
||||
Map<String, String> result = new HashMap<>();
|
||||
result.put( "result", "success" );
|
||||
response.setContentType("application/json");
|
||||
response.getWriter().write(objectMapper.writeValueAsString(result));
|
||||
response.setStatus(HttpServletResponse.SC_OK);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.security.helpers.impl;
|
||||
package it.fabioformosa.quartzmanager.api.security.helpers.impl;
|
||||
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.config.annotation.SecurityConfigurerAdapter;
|
||||
@@ -7,7 +7,7 @@ import org.springframework.security.config.annotation.web.configurers.LogoutConf
|
||||
import org.springframework.security.web.DefaultSecurityFilterChain;
|
||||
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
|
||||
|
||||
import it.fabioformosa.quartzmanager.security.helpers.LoginConfigurer;
|
||||
import it.fabioformosa.quartzmanager.api.security.helpers.LoginConfigurer;
|
||||
|
||||
/**
|
||||
* It wraps the httpSecurity to provide new function as login and logout
|
||||
@@ -1,23 +1,23 @@
|
||||
package it.fabioformosa.quartzmanager.security.helpers.impl;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
import org.springframework.security.web.AuthenticationEntryPoint;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class RestAuthenticationEntryPoint implements AuthenticationEntryPoint {
|
||||
|
||||
@Override
|
||||
public void commence(HttpServletRequest request,
|
||||
HttpServletResponse response,
|
||||
AuthenticationException authException) throws IOException {
|
||||
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, authException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
package it.fabioformosa.quartzmanager.api.security.helpers.impl;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
import org.springframework.security.web.AuthenticationEntryPoint;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class RestAuthenticationEntryPoint implements AuthenticationEntryPoint {
|
||||
|
||||
@Override
|
||||
public void commence(HttpServletRequest request,
|
||||
HttpServletResponse response,
|
||||
AuthenticationException authException) throws IOException {
|
||||
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, authException.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
package it.fabioformosa.quartzmanager.security.models;
|
||||
|
||||
public class UserTokenState {
|
||||
private String access_token;
|
||||
private Long expires_in_sec;
|
||||
|
||||
public UserTokenState() {
|
||||
this.access_token = null;
|
||||
this.expires_in_sec = null;
|
||||
}
|
||||
|
||||
public UserTokenState(String access_token, long expires_in_sec) {
|
||||
this.access_token = access_token;
|
||||
this.expires_in_sec = expires_in_sec;
|
||||
}
|
||||
|
||||
public String getAccess_token() {
|
||||
return access_token;
|
||||
}
|
||||
|
||||
public Long getExpires_in_sec() {
|
||||
return expires_in_sec;
|
||||
}
|
||||
|
||||
public void setAccess_token(String access_token) {
|
||||
this.access_token = access_token;
|
||||
}
|
||||
|
||||
public void setExpires_in_sec(Long expires_in_sec) {
|
||||
this.expires_in_sec = expires_in_sec;
|
||||
}
|
||||
}
|
||||
package it.fabioformosa.quartzmanager.api.security.models;
|
||||
|
||||
public class UserTokenState {
|
||||
private String access_token;
|
||||
private Long expires_in_sec;
|
||||
|
||||
public UserTokenState() {
|
||||
this.access_token = null;
|
||||
this.expires_in_sec = null;
|
||||
}
|
||||
|
||||
public UserTokenState(String access_token, long expires_in_sec) {
|
||||
this.access_token = access_token;
|
||||
this.expires_in_sec = expires_in_sec;
|
||||
}
|
||||
|
||||
public String getAccess_token() {
|
||||
return access_token;
|
||||
}
|
||||
|
||||
public Long getExpires_in_sec() {
|
||||
return expires_in_sec;
|
||||
}
|
||||
|
||||
public void setAccess_token(String access_token) {
|
||||
this.access_token = access_token;
|
||||
}
|
||||
|
||||
public void setExpires_in_sec(Long expires_in_sec) {
|
||||
this.expires_in_sec = expires_in_sec;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.security.properties;
|
||||
package it.fabioformosa.quartzmanager.api.security.properties;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.security.properties;
|
||||
package it.fabioformosa.quartzmanager.api.security.properties;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
@@ -1,2 +1,2 @@
|
||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||
it.fabioformosa.quartzmanager.security.WebSecurityConfigJWT
|
||||
it.fabioformosa.quartzmanager.api.security.WebSecurityConfigJWT
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package it.fabioformosa.quartzmanager.security;
|
||||
package it.fabioformosa.quartzmanager.api.security;
|
||||
|
||||
import it.fabioformosa.quartzmanager.security.models.UserTokenState;
|
||||
import it.fabioformosa.quartzmanager.api.security.models.UserTokenState;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.web.client.TestRestTemplate;
|
||||
import org.springframework.http.*;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
import static it.fabioformosa.quartzmanager.common.config.QuartzManagerPaths.QUARTZ_MANAGER_LOGIN_PATH;
|
||||
import static it.fabioformosa.quartzmanager.api.common.config.QuartzManagerPaths.QUARTZ_MANAGER_LOGIN_PATH;
|
||||
|
||||
public class AbstractSecurityLoginTest {
|
||||
@Autowired
|
||||
@@ -1,6 +1,7 @@
|
||||
package it.fabioformosa.quartzmanager.security;
|
||||
package it.fabioformosa.quartzmanager.api.security;
|
||||
|
||||
import it.fabioformosa.quartzmanager.security.controllers.TestController;
|
||||
import it.fabioformosa.quartzmanager.api.common.config.QuartzManagerPaths;
|
||||
import it.fabioformosa.quartzmanager.api.security.controllers.TestController;
|
||||
import org.hamcrest.core.IsNot;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
@@ -13,7 +14,6 @@ import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
||||
|
||||
import static it.fabioformosa.quartzmanager.common.config.QuartzManagerPaths.QUARTZ_MANAGER_LOGIN_PATH;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
|
||||
@SpringBootTest
|
||||
@@ -64,7 +64,7 @@ public class SecurityControllerTest {
|
||||
|
||||
@Test
|
||||
void givenAnAnonymousUser_whenCalledTheLoginPath_thenShouldReturn2xx() throws Exception {
|
||||
mockMvc.perform(MockMvcRequestBuilders.post(QUARTZ_MANAGER_LOGIN_PATH)
|
||||
mockMvc.perform(MockMvcRequestBuilders.post(QuartzManagerPaths.QUARTZ_MANAGER_LOGIN_PATH)
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.accept("application/json")
|
||||
.param("username", "foo")
|
||||
@@ -1,6 +1,6 @@
|
||||
package it.fabioformosa.quartzmanager.security;
|
||||
package it.fabioformosa.quartzmanager.api.security;
|
||||
|
||||
import it.fabioformosa.quartzmanager.security.models.UserTokenState;
|
||||
import it.fabioformosa.quartzmanager.api.security.models.UserTokenState;
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
@@ -1,6 +1,6 @@
|
||||
package it.fabioformosa.quartzmanager.security;
|
||||
package it.fabioformosa.quartzmanager.api.security;
|
||||
|
||||
import it.fabioformosa.quartzmanager.security.models.UserTokenState;
|
||||
import it.fabioformosa.quartzmanager.api.security.models.UserTokenState;
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
@@ -1,6 +1,6 @@
|
||||
package it.fabioformosa.quartzmanager.security;
|
||||
package it.fabioformosa.quartzmanager.api.security;
|
||||
|
||||
import it.fabioformosa.quartzmanager.security.models.UserTokenState;
|
||||
import it.fabioformosa.quartzmanager.api.security.models.UserTokenState;
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
@@ -1,6 +1,6 @@
|
||||
package it.fabioformosa.quartzmanager.security;
|
||||
package it.fabioformosa.quartzmanager.api.security;
|
||||
|
||||
import it.fabioformosa.quartzmanager.security.models.UserTokenState;
|
||||
import it.fabioformosa.quartzmanager.api.security.models.UserTokenState;
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.security;
|
||||
package it.fabioformosa.quartzmanager.api.security;
|
||||
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.security.controllers;
|
||||
package it.fabioformosa.quartzmanager.api.security.controllers;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.controllers;
|
||||
package it.fabioformosa.quartzmanager.api.controllers;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@@ -1,4 +1,4 @@
|
||||
package it.fabioformosa.quartzmanager.controllers;
|
||||
package it.fabioformosa.quartzmanager.api.controllers;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.slf4j.Logger;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user