Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion core/src/main/java/org/apache/iceberg/rest/auth/OAuth2Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,18 @@ public static AuthSession fromTokenExchange(
parent.scope(),
parent.oauth2ServerUri(),
parent.optionalOAuthParams());
return fromTokenResponse(client, executor, response, startTimeMillis, parent);
AuthSession session = fromTokenResponse(client, executor, response, startTimeMillis, parent);
// A session created by token exchange should be refreshed via token exchange,
// not by falling back to the parent's client credential. Clear the inherited
// credential and enable exchange on the child session so that refresh always
// uses the token exchange flow, independent of the catalog-level exchangeEnabled flag.
session.config =
AuthConfig.builder()
.from(session.config)
.credential(null)
.exchangeEnabled(true)
.build();
return session;
}
}
}
Loading