Skip to content

Commit 5c584e9

Browse files
authored
chore: check for cached token and exception type before retrying (#1430)
1 parent f1f0548 commit 5c584e9

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

wrapper/src/main/java/software/amazon/jdbc/plugin/federatedauth/FederatedAuthPlugin.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,9 @@ private Connection connectInternal(final HostSpec hostSpec, final Properties pro
215215
try {
216216
return connectFunc.call();
217217
} catch (final SQLException exception) {
218+
if (!isCachedToken || !this.pluginService.isLoginException(exception)) {
219+
throw exception;
220+
}
218221
updateAuthenticationToken(hostSpec, props, region, cacheKey, host);
219222
return connectFunc.call();
220223
} catch (final Exception exception) {

wrapper/src/main/java/software/amazon/jdbc/plugin/federatedauth/OktaAuthPlugin.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,9 @@ private Connection connectInternal(final HostSpec hostSpec, final Properties pro
187187
try {
188188
return connectFunc.call();
189189
} catch (final SQLException exception) {
190+
if (!isCachedToken || !this.pluginService.isLoginException(exception)) {
191+
throw exception;
192+
}
190193
updateAuthenticationToken(hostSpec, props, region, cacheKey, host);
191194
return connectFunc.call();
192195
} catch (final Exception exception) {

0 commit comments

Comments
 (0)