Skip to content

Commit

Permalink
[#6245] fix(authz): Authorization should use classloader to create th…
Browse files Browse the repository at this point in the history
…e plugin (#6246)

### What changes were proposed in this pull request?

Authorization should use classloader to create the plugin

### Why are the changes needed?

Fix: #6245

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

I tested it manually.
  • Loading branch information
jerqi authored Jan 15, 2025
1 parent 24c9076 commit 857a464
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,15 @@ public void initAuthorizationPluginInstance(IsolatedClassLoader classLoader) {
try {
BaseAuthorization<?> authorization =
BaseAuthorization.createAuthorization(classLoader, authorizationProvider);

// Load the authorization plugin with the class loader of the catalog.
// Because the JDBC authorization plugin may load JDBC driver using the class loader.
authorizationPlugin =
authorization.newPlugin(entity.namespace().level(0), provider(), this.conf);
classLoader.withClassLoader(
cl ->
authorization.newPlugin(
entity.namespace().level(0), provider(), this.conf));

} catch (Exception e) {
LOG.error("Failed to load authorization with class loader", e);
throw new RuntimeException(e);
Expand Down

0 comments on commit 857a464

Please sign in to comment.