Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can we override auth.session-timeout-ms of catalog or avoid cache at all? #12350

Open
varpa89 opened this issue Feb 20, 2025 · 0 comments
Open
Labels
question Further information is requested

Comments

@varpa89
Copy link

varpa89 commented Feb 20, 2025

Query engine

Trino

Question

I'd like to reuse extraCredentials 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 because Trino passes it as a property.
But the thing is that RestSessionCatalog 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 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();
}
@varpa89 varpa89 added the question Further information is requested label Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant