빈 아웃바운드 OAuth 토큰이 캐시에 고착되는 문제 수정

- 발급 실패를 삼키고 빈 토큰을 반환하는 구현체가 있어 그 토큰이 그대로 캐시되던 문제
- 빈 토큰은 expiration 이 없어 isExpired() 가 항상 false 라 재기동 전까지 재발급되지 않음
- SessionManagerForIgnite : 빈 토큰은 캐시하지 않고 warn 후 다음 주기에 재시도
- AccessTokenManagerByDB : 발급 결과가 비어 있으면 실패로 처리하고 null 반환
This commit is contained in:
curry772
2026-09-11 10:14:12 +09:00
parent 7723e830cf
commit 76a74cd3a1
2 changed files with 16 additions and 2 deletions
@@ -316,6 +316,14 @@ public class AccessTokenManagerByDB implements Lifecycle {
if(service != null) {
logger.debug("Executing token service of type: {} for adapter group: {}", type, adapterGroupName);
accessToken = (AccessTokenVO) service.execute(adapterGroupName, properties, outboundOAuthCredentialVo);
// 발급에 실패했는데도 빈 토큰을 반환하는 구현체가 있다. 그대로 캐시되면
// 만료시각이 없어 재발급 대상이 되지 않으므로 실패로 처리한다.
if (accessToken == null || StringUtils.isBlank(accessToken.getAccessToken())) {
logger.error("Issued token is empty. type: {}, adapter group: {}", type, adapterGroupName);
return null;
}
logger.info("New token issued successfully for adapter group: {}", adapterGroupName);
return accessToken;
@@ -938,7 +938,13 @@ public class SessionManagerForIgnite extends SessionManager {
logger.debug(String.format("getting token is null or expired borrow new token =%s", token));
cacheOutBoundAccessToken.put(key, token);
// 빈 토큰은 캐시하지 않는다. 발급 구현체가 실패를 삼키고 빈 토큰을 반환하는 경우가 있는데,
// 그게 캐시되면 만료시각이 없어 isExpired() 가 계속 false 라 재발급되지 않는다.
if (token != null && token.getAccessToken() != null && token.getAccessToken().trim().length() > 0) {
cacheOutBoundAccessToken.put(key, token);
} else {
logger.warn("Empty access token is not cached. key=" + key);
}
}
}
else