代码优化

This commit is contained in:
shimingxy
2024-01-20 18:10:17 +08:00
parent a1213a7539
commit b55261ffe4
8 changed files with 24 additions and 36 deletions

View File

@@ -68,12 +68,11 @@ public class AuthTokenService extends AuthJwtService{
String refreshToken = refreshTokenService.genRefreshToken(authentication);
_logger.trace("generate JWT Token");
String accessToken = genJwt(authentication);
AuthJwt authJwt = new AuthJwt(
return new AuthJwt(
accessToken,
authentication,
authJwkConfig.getExpires(),
refreshToken);
return authJwt;
}
return null;
}
@@ -118,8 +117,7 @@ public class AuthTokenService extends AuthJwtService{
}
public AuthJwt consumeCongress(String congress) {
AuthJwt authJwt = congressService.consume(congress);
return authJwt;
return congressService.consume(congress);
}
public boolean validateCaptcha(String state,String captcha) {

View File

@@ -26,7 +26,7 @@ import com.github.benmanes.caffeine.cache.Caffeine;
public class InMemoryCongressService implements CongressService{
private static final Logger _logger = LoggerFactory.getLogger(InMemoryCongressService.class);
private static final Logger logger = LoggerFactory.getLogger(InMemoryCongressService.class);
protected static Cache<String, AuthJwt> congressStore =
Caffeine.newBuilder()
@@ -52,8 +52,7 @@ public class InMemoryCongressService implements CongressService{
@Override
public AuthJwt get(String congress) {
AuthJwt authJwt = congressStore.getIfPresent(congress);
return authJwt;
return congressStore.getIfPresent(congress);
}
@Override

View File

@@ -24,13 +24,13 @@ import org.slf4j.LoggerFactory;
public class RedisCongressService implements CongressService {
private static final Logger _logger = LoggerFactory.getLogger(RedisCongressService.class);
private static final Logger logger = LoggerFactory.getLogger(RedisCongressService.class);
protected int validitySeconds = 60 * 3; //default 3 minutes.
RedisConnectionFactory connectionFactory;
public static String PREFIX="REDIS_CONGRESS_";
public static final String PREFIX = "REDIS:CONGRESS:";
/**
* @param connectionFactory
*/