varpa89 opened a new issue, #12350:
URL: https://github.com/apache/iceberg/issues/12350

   ### Query engine
   
   Trino
   
   ### Question
   
   I'd like to reuse 
[extraCredentials](https://trino.io/docs/current/client/jdbc.html#:~:text=to%20false.-,extraCredentials,-Extra%20credentials%20for)
 option of the trino driver and communicate with a rest catalog via token that 
we provide via this option.
   In this case a session is being created via 
[AuthSession.fromAccessToken](https://github.com/apache/iceberg/blob/main/core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java#L1102)
 because Trino 
[passes](https://github.com/trinodb/trino/blob/master/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/catalog/rest/TrinoRestCatalog.java#L839)
 it as a property.
   But the thing is that 
[RestSessionCatalog](https://github.com/apache/iceberg/blob/main/core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java#L346)
 uses cache for sessions. And it means that in case we send a new token, the 
old one will be used until cache is expired (1 hour is default).
   I see there is a 
[property](https://github.com/apache/iceberg/blob/main/core/src/main/java/org/apache/iceberg/CatalogProperties.java#L159)
 `auth.session-timeout-ms`, but can't override it. Is it possible?
   
   ```
   private static Cache<String, AuthSession> newSessionCache(Map<String, 
String> properties) {
     long expirationIntervalMs =
         PropertyUtil.propertyAsLong(
             properties,
             CatalogProperties.AUTH_SESSION_TIMEOUT_MS,
             CatalogProperties.AUTH_SESSION_TIMEOUT_MS_DEFAULT);
   
     return Caffeine.newBuilder()
         .expireAfterAccess(Duration.ofMillis(expirationIntervalMs))
         .removalListener(
             (RemovalListener<String, AuthSession>)
                 (id, auth, cause) -> {
                   if (auth != null) {
                     auth.stopRefreshing();
                   }
                 })
         .build();
   }
   ```


-- 
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: issues-unsubscr...@iceberg.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to