Skip to content

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

@varpa89

Description

@varpa89

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();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions