Skip to content

Commit b3725f0

Browse files
committed
Fixed a cloud-only issue where a SignatureProvider created using
a ResourcePrincipal may time out after a few minutes, resulting in a "not authenticated" exception
1 parent ca3fc38 commit b3725f0

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).
88
- Allow application to retry a QueryRequest if it gets a timeout exception and the query only does reads
99
- Cloud only: Updated OCI regions
1010

11+
### Fixed
12+
- Cloud only: Fixed an issue where a long running applications using SignatureProvider
13+
with resource principal may encounter NotAuthenticated error after several minutes even
14+
if authentication succeed for the first requests.
15+
1116
## [5.3.6] 2022-08-23
1217

1318
### Added

driver/src/main/java/oracle/nosql/driver/iam/SignatureProvider.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,14 @@ synchronized SignatureDetails getSignatureDetailsInternal(boolean isRefresh)
887887
long nowPlus = System.currentTimeMillis() + 60_000L;
888888
String date = createFormatter().format(new Date(nowPlus));
889889
String keyId = provider.getKeyId();
890-
if (provider instanceof InstancePrincipalsProvider) {
890+
891+
/*
892+
* Security token based providers may refresh the security token
893+
* and associated private key in above getKeyId() method, reload
894+
* private key to PrivateKeyProvider to avoid a mismatch, which
895+
* will create an invalid signature, cause authentication error.
896+
*/
897+
if (provider instanceof SecurityTokenBasedProvider) {
891898
privateKeyProvider.reload(provider.getPrivateKey(),
892899
provider.getPassphraseCharacters());
893900
}

0 commit comments

Comments
 (0)