-
Notifications
You must be signed in to change notification settings - Fork 33
Add support for OIDC ID token authentication using an environment variables and files #445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
databricks-sdk-java/src/main/java/com/databricks/sdk/core/oauth/FileIDTokenSource.java
Outdated
Show resolved
Hide resolved
databricks-sdk-java/src/main/java/com/databricks/sdk/core/oauth/FileIDTokenSource.java
Outdated
Show resolved
Hide resolved
databricks-sdk-java/src/main/java/com/databricks/sdk/core/oauth/FileIDTokenSource.java
Outdated
Show resolved
Hide resolved
databricks-sdk-java/src/main/java/com/databricks/sdk/core/oauth/EnvVarIDTokenSource.java
Show resolved
Hide resolved
databricks-sdk-java/src/main/java/com/databricks/sdk/core/DefaultCredentialsProvider.java
Outdated
Show resolved
Hide resolved
databricks-sdk-java/src/main/java/com/databricks/sdk/core/oauth/EnvVarIDTokenSource.java
Outdated
Show resolved
Hide resolved
databricks-sdk-java/src/main/java/com/databricks/sdk/core/oauth/EnvVarIDTokenSource.java
Show resolved
Hide resolved
databricks-sdk-java/src/main/java/com/databricks/sdk/core/oauth/FileIDTokenSource.java
Outdated
Show resolved
Hide resolved
databricks-sdk-java/src/main/java/com/databricks/sdk/core/oauth/FileIDTokenSource.java
Show resolved
Hide resolved
parthban-db
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good. Few small comments.
| // Test case name, file path (null means create temp file), file content, expected token, | ||
| // expected exception | ||
| Arguments.of("Valid token file", null, TEST_TOKEN, TEST_TOKEN, null), | ||
| Arguments.of("Token with whitespace", null, " " + TEST_TOKEN + " ", TEST_TOKEN, null), | ||
| Arguments.of("Empty file", null, "", null, DatabricksException.class), | ||
| Arguments.of("File with only whitespace", null, " ", null, DatabricksException.class), | ||
| Arguments.of("Null file path", null, null, null, IllegalArgumentException.class), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure I understand this correctly. What are you trying to test in the Null file path because it will create the file anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file is only created if the file content is not null, so in cases where the content is null, no file will be created. But I agree that the previous logic was a bit convoluted, so I’ve refactored the tests to make them more straightforward and intuitive.
databricks-sdk-java/src/test/java/com/databricks/sdk/core/oauth/FileIDTokenSourceTest.java
Outdated
Show resolved
Hide resolved
databricks-sdk-java/src/test/java/com/databricks/sdk/core/oauth/FileIDTokenSourceTest.java
Show resolved
Hide resolved
databricks-sdk-java/src/main/java/com/databricks/sdk/core/oauth/EnvVarIDTokenSource.java
Outdated
Show resolved
Hide resolved
databricks-sdk-java/src/main/java/com/databricks/sdk/core/oauth/FileIDTokenSource.java
Outdated
Show resolved
Hide resolved
|
If integration tests don't run automatically, an authorized user can run them manually by following the instructions below: Trigger: Inputs:
Checks will be approved automatically on success. |
renaudhartert-db
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks Emmy
What changes are proposed in this pull request?
Add Environment Variable and File-based ID Token Sources
Key Changes
EnvVarIDTokenSourceto read ID tokens from environment variablesFileIDTokenSourceto read ID tokens from filesIDTokenSourceinterface for OIDC authenticationHow is this tested?
NO_CHANGELOG=true