nastra commented on code in PR #13966:
URL: https://github.com/apache/iceberg/pull/13966#discussion_r2348197178


##########
azure/src/main/java/org/apache/iceberg/azure/adlsv2/VendedAdlsCredentialProvider.java:
##########
@@ -78,6 +81,31 @@ Mono<String> credentialForAccount(String storageAccount) {
   }
 
   private AccessToken sasTokenForAccount(String storageAccount) {
+    return sasTokenFromProperties(storageAccount).orElseGet(() -> 
fetchSasToken(storageAccount));
+  }
+
+  private Optional<AccessToken> sasTokenFromProperties(String storageAccount) {
+    String sasToken = properties.get(AzureProperties.ADLS_SAS_TOKEN_PREFIX + 
storageAccount);
+    String tokenExpiresAtMillis =
+        properties.get(AzureProperties.ADLS_SAS_TOKEN_EXPIRES_AT_MS_PREFIX + 
storageAccount);
+
+    if (Strings.isNullOrEmpty(sasToken) || 
Strings.isNullOrEmpty(tokenExpiresAtMillis)) {
+      return Optional.empty();
+    }
+
+    Instant expiresAt = 
Instant.ofEpochMilli(Long.parseLong(tokenExpiresAtMillis));
+    Instant prefetchAt = expiresAt.minus(5, ChronoUnit.MINUTES);

Review Comment:
   I don't think we need to make this configurable as of now. In almost all 
cases the 5 min are usually enough and people almost never have to customize 
this, so I would delegate this until it's actually needed for a particular use 
case



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to