fixed circular dependency
This commit is contained in:
parent
510e4b14fe
commit
3cd8c60518
@ -17,6 +17,7 @@ package org.thingsboard.server.service.security.auth.jwt.settings;
|
|||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.thingsboard.common.util.JacksonUtil;
|
import org.thingsboard.common.util.JacksonUtil;
|
||||||
@ -42,7 +43,6 @@ public class DefaultJwtSettingsService implements JwtSettingsService {
|
|||||||
private final AdminSettingsService adminSettingsService;
|
private final AdminSettingsService adminSettingsService;
|
||||||
private final Optional<TbClusterService> tbClusterService;
|
private final Optional<TbClusterService> tbClusterService;
|
||||||
private final JwtSettingsValidator jwtSettingsValidator;
|
private final JwtSettingsValidator jwtSettingsValidator;
|
||||||
@Lazy
|
|
||||||
private final Optional<JwtTokenFactory> jwtTokenFactory;
|
private final Optional<JwtTokenFactory> jwtTokenFactory;
|
||||||
|
|
||||||
private volatile JwtSettings jwtSettings = null; //lazy init
|
private volatile JwtSettings jwtSettings = null; //lazy init
|
||||||
|
|||||||
@ -28,6 +28,7 @@ import io.jsonwebtoken.UnsupportedJwtException;
|
|||||||
import io.jsonwebtoken.security.Keys;
|
import io.jsonwebtoken.security.Keys;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.security.authentication.BadCredentialsException;
|
import org.springframework.security.authentication.BadCredentialsException;
|
||||||
import org.springframework.security.core.GrantedAuthority;
|
import org.springframework.security.core.GrantedAuthority;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@ -70,6 +71,7 @@ public class JwtTokenFactory {
|
|||||||
private static final String CUSTOMER_ID = "customerId";
|
private static final String CUSTOMER_ID = "customerId";
|
||||||
private static final String SESSION_ID = "sessionId";
|
private static final String SESSION_ID = "sessionId";
|
||||||
|
|
||||||
|
@Lazy
|
||||||
private final JwtSettingsService jwtSettingsService;
|
private final JwtSettingsService jwtSettingsService;
|
||||||
|
|
||||||
private volatile JwtParser jwtParser;
|
private volatile JwtParser jwtParser;
|
||||||
|
|||||||
@ -53,7 +53,6 @@ public class JwtTokenFactoryTest {
|
|||||||
private JwtTokenFactory tokenFactory;
|
private JwtTokenFactory tokenFactory;
|
||||||
private AdminSettingsService adminSettingsService;
|
private AdminSettingsService adminSettingsService;
|
||||||
private JwtSettingsService jwtSettingsService;
|
private JwtSettingsService jwtSettingsService;
|
||||||
private JwtTokenFactory jwtTokenFactory;
|
|
||||||
|
|
||||||
private JwtSettings jwtSettings;
|
private JwtSettings jwtSettings;
|
||||||
|
|
||||||
@ -171,7 +170,7 @@ public class JwtTokenFactoryTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private DefaultJwtSettingsService mockJwtSettingsService() {
|
private DefaultJwtSettingsService mockJwtSettingsService() {
|
||||||
return new DefaultJwtSettingsService(adminSettingsService, Optional.empty(), new DefaultJwtSettingsValidator(), jwtTokenFactory);
|
return new DefaultJwtSettingsService(adminSettingsService, Optional.empty(), new DefaultJwtSettingsValidator(), Optional.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkExpirationTime(JwtToken jwtToken, int tokenLifetime) {
|
private void checkExpirationTime(JwtToken jwtToken, int tokenLifetime) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user