Skip to content

Conversation

@emmyzhou-db
Copy link
Contributor

@emmyzhou-db emmyzhou-db commented May 12, 2025

What changes are proposed in this pull request?

Add Environment Variable and File-based ID Token Sources

Key Changes

  • Added EnvVarIDTokenSource to read ID tokens from environment variables
  • Added FileIDTokenSource to read ID tokens from files
  • Both implement the IDTokenSource interface for OIDC authentication
  • Added envvar-oidc and file-oidc to the list of auth types

How is this tested?

  • Unit tests for both classes

NO_CHANGELOG=true

@emmyzhou-db emmyzhou-db temporarily deployed to test-trigger-is May 13, 2025 11:14 — with GitHub Actions Inactive
@emmyzhou-db emmyzhou-db temporarily deployed to test-trigger-is May 13, 2025 11:14 — with GitHub Actions Inactive
@emmyzhou-db emmyzhou-db changed the title Add EnvVarIDTokenSource and FileIDTokenSource Add support for OIDC ID token authentication using an environment variables and files May 13, 2025
Copy link
Contributor

@parthban-db parthban-db left a 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.

Comment on lines 31 to 37
// 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),
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@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: 445
  • Commit SHA: eade1bac722c31030c206a5d79a7e3744e6c3f15

Checks will be approved automatically on success.

@emmyzhou-db emmyzhou-db temporarily deployed to test-trigger-is May 15, 2025 12:03 — with GitHub Actions Inactive
Copy link
Contributor

@renaudhartert-db renaudhartert-db left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks Emmy

@parthban-db parthban-db added this pull request to the merge queue May 15, 2025
Merged via the queue into main with commit 78501a5 May 15, 2025
15 checks passed
@parthban-db parthban-db deleted the emmyzhou-db/envvar-id-tokensource branch May 15, 2025 17:33
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.

4 participants