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
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,7 @@ private ParamRules buildRules() {
ParamRules rules = new ParamRules()
// OAuth2 requires either credential or token, but not both
.mutuallyExclusive(icebergRestOauth2Credential, icebergRestOauth2Token,
"OAuth2 cannot have both credential and token configured")
// If using credential flow, server URI is required
.requireAllIfPresent(icebergRestOauth2Credential,
new String[] {icebergRestOauth2ServerUri},
"OAuth2 credential flow requires server-uri");
"OAuth2 cannot have both credential and token configured");

// Custom validation: OAuth2 scope should not be used with token
if (Strings.isNotBlank(icebergRestOauth2Token) && Strings.isNotBlank(icebergRestOauth2Scope)) {
Expand Down Expand Up @@ -274,7 +270,9 @@ private void addOAuth2Properties() {
if (Strings.isNotBlank(icebergRestOauth2Credential)) {
// Client Credentials Flow
icebergRestCatalogProperties.put(OAuth2Properties.CREDENTIAL, icebergRestOauth2Credential);
icebergRestCatalogProperties.put(OAuth2Properties.OAUTH2_SERVER_URI, icebergRestOauth2ServerUri);
if (Strings.isNotBlank(icebergRestOauth2ServerUri)) {
icebergRestCatalogProperties.put(OAuth2Properties.OAUTH2_SERVER_URI, icebergRestOauth2ServerUri);
}
if (Strings.isNotBlank(icebergRestOauth2Scope)) {
icebergRestCatalogProperties.put(OAuth2Properties.SCOPE, icebergRestOauth2Scope);
}
Expand Down
Loading