mirror of
https://github.com/fabioformosa/quartz-manager.git
synced 2025-12-27 04:33:20 +09:00
#78 fixed sonar errors
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package it.fabioformosa.quartzmanager.api.security.properties;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -12,12 +13,19 @@ import java.util.Base64;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "quartz-manager.security.jwt")
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
@Setter
|
||||
public class JwtSecurityProperties {
|
||||
private String secret;
|
||||
|
||||
{
|
||||
private long expirationInSec = 28800;
|
||||
|
||||
private CookieStrategy cookieStrategy = new CookieStrategy();
|
||||
private HeaderStrategy headerStrategy = new HeaderStrategy();
|
||||
|
||||
public JwtSecurityProperties() {
|
||||
SecureRandom random = new SecureRandom();
|
||||
byte[] bytes = new byte[20];
|
||||
random.nextBytes(bytes);
|
||||
@@ -25,11 +33,6 @@ public class JwtSecurityProperties {
|
||||
secret = encoder.encodeToString(bytes);
|
||||
}
|
||||
|
||||
private long expirationInSec = 28800;
|
||||
|
||||
private CookieStrategy cookieStrategy = new CookieStrategy();
|
||||
private HeaderStrategy headerStrategy = new HeaderStrategy();
|
||||
|
||||
@Data
|
||||
public static class CookieStrategy {
|
||||
private boolean enabled = false;
|
||||
|
||||
@@ -12,7 +12,7 @@ import javax.validation.Validator;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.Map;
|
||||
|
||||
public class AbstractPropertyValidatorTest {
|
||||
public abstract class AbstractPropertyValidatorTest {
|
||||
protected static Validator propertyValidator;
|
||||
|
||||
@BeforeAll
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class InMemoryUsersValidationControllerTest extends AbstractPropertyValidatorTest {
|
||||
class InMemoryUsersValidationControllerTest extends AbstractPropertyValidatorTest {
|
||||
|
||||
static Stream<Arguments> notValidInMemoryProps = Stream.of(
|
||||
Arguments.of(
|
||||
|
||||
@@ -28,8 +28,7 @@ public class MisfireTestJob extends AbstractQuartzManagerJob {
|
||||
|
||||
log.info("{} woke up!", Thread.currentThread().getName());
|
||||
} catch (InterruptedException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new RuntimeException(e);
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
|
||||
return new LogRecord(LogRecord.LogType.INFO, "Hello!");
|
||||
|
||||
Reference in New Issue
Block a user