Skip to content

Make OPA file-based bearer token timing configurable#4972

Merged
dimas-b merged 2 commits into
apache:mainfrom
iting0321:opa-configurable-file-token-timing
Jul 9, 2026
Merged

Make OPA file-based bearer token timing configurable#4972
dimas-b merged 2 commits into
apache:mainfrom
iting0321:opa-configurable-file-token-timing

Conversation

@iting0321

Copy link
Copy Markdown
Contributor

Summary

This resolves the TODO around hard-coded token timing by adding optional file-based bearer token settings for:

  • initial-token-wait
  • refresh-retry-interval

Defaults remain unchanged:

  • Initial token wait: PT5S
  • Refresh retry interval: PT1S

Testing

  • extensions/auth/opa/impl/src/test/java/org/apache/polaris/extension/auth/ opa/token/FileBearerTokenProviderTest.java
  • extensions/auth/opa/impl/src/test/java/org/apache/polaris/extension/auth/ opa/OpaPolarisAuthorizerFactoryTest.java

Checklist

  • 🛡️ Don't disclose security issues! (contact security@apache.org)
  • 🔗 Clearly explained why the changes are needed, or linked related issues: Fixes #
  • 🧪 Added/updated tests with good coverage, or manually tested (and explained how)
  • 💡 Added comments for complex logic
  • 🧾 Updated CHANGELOG.md (if needed)
  • 📚 Updated documentation in site/content/in-dev/unreleased (if needed)

Copilot AI review requested due to automatic review settings July 5, 2026 09:16
@github-project-automation github-project-automation Bot moved this to PRs In Progress in Basic Kanban Board Jul 5, 2026
@iting0321 iting0321 force-pushed the opa-configurable-file-token-timing branch from 205409b to 084ee4b Compare July 5, 2026 09:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This pull request makes the timing behavior of OPA file-based bearer token handling configurable, replacing previously hard-coded waits/retry intervals while keeping existing defaults.

Changes:

  • Add initial-token-wait and refresh-retry-interval to the OPA file-based bearer token configuration (with unchanged defaults).
  • Wire the new configuration through OpaPolarisAuthorizerFactory into FileBearerTokenProvider.
  • Extend/update unit tests to cover the new retry-interval behavior and updated constructor signature.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
runtime/defaults/src/main/resources/application.properties Adds commented example properties for the two new timing knobs.
extensions/auth/opa/impl/src/main/java/org/apache/polaris/extension/auth/opa/OpaAuthorizationConfig.java Introduces optional config fields and validation for initial wait and retry interval.
extensions/auth/opa/impl/src/main/java/org/apache/polaris/extension/auth/opa/OpaPolarisAuthorizerFactory.java Reads new config values (with defaults) and passes them into the token provider.
extensions/auth/opa/impl/src/main/java/org/apache/polaris/extension/auth/opa/token/FileBearerTokenProvider.java Stores and uses the configured refresh retry interval instead of a hard-coded value.
extensions/auth/opa/impl/src/test/java/org/apache/polaris/extension/auth/opa/OpaPolarisAuthorizerFactoryTest.java Updates test instantiation for the new provider constructor parameter.
extensions/auth/opa/impl/src/test/java/org/apache/polaris/extension/auth/opa/token/FileBearerTokenProviderTest.java Updates constructor calls and adds coverage for configurable refresh-retry-interval scheduling.

@dimas-b dimas-b left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM 👍 Thanks, @iting0321 !

@github-project-automation github-project-automation Bot moved this from PRs In Progress to Ready to merge in Basic Kanban Board Jul 6, 2026
@dimas-b dimas-b requested a review from sungwy July 6, 2026 19:56
@dimas-b dimas-b merged commit 1aaaec9 into apache:main Jul 9, 2026
24 checks passed
@github-project-automation github-project-automation Bot moved this from Ready to merge to Done in Basic Kanban Board Jul 9, 2026
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