Valerde opened a new pull request, #12644:
URL: https://github.com/apache/gravitino/pull/12644
# [#12642] fix(authz): add missing supportsScheme to JdbcCredentialProvider
### What changes were proposed in this pull request?
Add the missing `supportsScheme` override to `JdbcCredentialProvider`, so it
only claims support for the `jdbc` scheme instead of inheriting the default
`return true` from the `CredentialProvider` interface.
Add `TestCatalogCredentialManager` to cover path-based provider selection
when
a catalog has multiple provider types, and add a `supportsScheme` unit test
in
`TestJdbcCredentialProvider`.
### Why are the changes needed?
When an Iceberg catalog uses a JDBC backend and stores table data in object
storage (e.g. S3), both `jdbc-user-password` and `s3-secret-key` credential
providers are configured. The path-based credential lookup in
`CatalogCredentialManager#getCredentialByPath` selects a provider by URI
scheme.
Because `JdbcCredentialProvider` did not override `supportsScheme`, it
inherited
the default implementation that returns `true` for every scheme. As a result,
a request for an S3 table path matched two providers and threw:
```
UnsupportedOperationException: Multiple credential providers found for path
s3://bucket/warehouse/table with scheme s3:
[s3-secret-key, jdbc-user-password]
```
Restricting the JDBC provider to the `jdbc` scheme resolves the conflict,
while
type-based JDBC credential fetching remains unaffected.
Fix: #12642
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
- `./gradlew spotlessApply`
- `./gradlew :core:test \
--tests org.apache.gravitino.credential.TestJdbcCredentialProvider \
--tests org.apache.gravitino.credential.TestCatalogCredentialManager \
-PskipITs`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]