xunliu commented on code in PR #3946:
URL: https://github.com/apache/gravitino/pull/3946#discussion_r1666557383
##########
core/src/main/java/com/datastrato/gravitino/connector/BaseCatalog.java:
##########
@@ -169,12 +184,57 @@ public CatalogOperations ops() {
return ops;
}
+ public AuthorizationHook getAuthorizationHook() {
+ if (authorization == null) {
+ synchronized (this) {
+ if (authorization == null) {
+ authorization = createAuthorizationInstance();
+ }
+ }
+ }
+ return authorization.hook();
+ }
+
+ private BaseAuthorization<?> createAuthorizationInstance() {
+ String provider = entity.getProperties().get(AUTHORIZATION_IMPL);
+ if (provider == null && provider.isEmpty()) {
+ throw new IllegalArgumentException("Authorization hook provider is not
set");
+ }
+
+ ServiceLoader<AuthorizationProvider> loader =
Review Comment:
I think SPI is a better way, Anyone can develop the AuthorizationHook
plugin, just like Gravitino Catalogs.
--
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]