Skip to content

Commit

Permalink
Core: Prevent RESTCatalog AuthSession from expiring (#6749)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielcweeks authored Feb 6, 2023
1 parent 531a815 commit 32a8ef5
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,12 @@ public void initialize(String name, Map<String, String> unresolved) {
}

private AuthSession session(SessionContext context) {
return sessions.get(
context.sessionId(),
id -> newSession(context.credentials(), context.properties(), catalogAuth));
AuthSession session =
sessions.get(
context.sessionId(),
id -> newSession(context.credentials(), context.properties(), catalogAuth));

return session != null ? session : catalogAuth;
}

private Supplier<Map<String, String>> headers(SessionContext context) {
Expand Down Expand Up @@ -728,7 +731,9 @@ private FileIO tableFileIO(Map<String, String> config) {
}

private AuthSession tableSession(Map<String, String> tableConf, AuthSession parent) {
return newSession(tableConf, tableConf, parent);
AuthSession session = newSession(tableConf, tableConf, parent);

return session != null ? session : parent;
}

private static ConfigResponse fetchConfig(
Expand Down Expand Up @@ -784,7 +789,7 @@ private AuthSession newSession(
}
}

return parent;
return null;
}

private Long expiresAtMillis(Map<String, String> properties) {
Expand Down

0 comments on commit 32a8ef5

Please sign in to comment.