Skip to content

Conversation

@Tejas-Kochar
Copy link
Contributor

@Tejas-Kochar Tejas-Kochar commented Dec 18, 2025

Summary

The Java SDK already had support for custom scopes in all three OAuth flows. It only lacked support for configuring scopes in a config file. This PR covers that gap.

Testing

Tested by loading configurations from a test config file and resolving them.


NO_CHANGELOG=true

@Tejas-Kochar Tejas-Kochar changed the title Custom Scopes Support Support for parsing custom scopes in config file Dec 22, 2025
@ConfigAttribute(env = "DATABRICKS_CLIENT_SECRET", auth = "oauth", sensitive = true)
private String clientSecret;

@ConfigAttribute(env = "DATABRICKS_SCOPES", auth = "oauth")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It actually wasn't possible to pass scopes through environment variable because Lists weren't parsed correctly, so removing this is not a breaking change.
Removing the environment variable attribute for consistency with the other SDKs where we are not supporting setting scopes via environment variables.

Comment on lines -38 to 40

@ConfigAttribute(env = "DATABRICKS_SCOPES", auth = "oauth")
@ConfigAttribute(auth = "oauth")
private List<String> scopes;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a backward-incompatible change. What's the rationale for removing this environment variable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've explained the rationale in this comment: #581 (comment)

Comment on lines 63 to +71
field.set(cfg, seconds > 0 ? Duration.ofSeconds(seconds) : null);
} else if (field.getType() == ProxyConfig.ProxyAuthType.class) {
field.set(cfg, ProxyConfig.ProxyAuthType.valueOf(value));
} else if (List.class.isAssignableFrom(field.getType())) {
// Handle List<String> fields (e.g., scopes)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a question about this big if-else block. This block doesn't have a default else, which throws an error when an unexpected type appears in the config. So is the current code simply ignoring those types?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it silently ignores those types. I can't think of a good reason for it to be this way.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We considered adding a default block that would fail for unexpected types, but rejected it for this PR, as it could lead to breaking changes.

@github-actions
Copy link

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger:
go/deco-tests-run/sdk-java

Inputs:

  • PR number: 581
  • Commit SHA: 07309183492edb2f37168e36903313a77b48904a

Checks will be approved automatically on success.

@Tejas-Kochar Tejas-Kochar added this pull request to the merge queue Dec 29, 2025
Merged via the queue into main with commit 64cfb98 Dec 29, 2025
16 checks passed
@Tejas-Kochar Tejas-Kochar deleted the custom-scopes branch December 29, 2025 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants