mirror of
https://gitee.com/dromara/MaxKey.git
synced 2026-05-15 04:52:09 +08:00
代码优化
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user