roryqi commented on code in PR #11688:
URL: https://github.com/apache/gravitino/pull/11688#discussion_r3429796155
##########
plugins/idp-basic/src/main/java/org/apache/gravitino/idp/auth/BasicAuthenticator.java:
##########
@@ -62,10 +68,31 @@ public Principal authenticateToken(byte[] tokenData) {
@Override
public void initialize(Config config) {
+ validateExtensionPackage(config);
GravitinoEnv env = GravitinoEnv.getInstance();
this.userGroupManager = IdpUserGroupManager.getInstance(config,
env.idGenerator());
}
+ /**
+ * Validates that the built-in IdP REST extension package is enabled when
Basic authentication is
+ * used.
+ *
+ * @param config The server configuration.
+ */
+ static void validateExtensionPackage(Config config) {
+ boolean idpExtensionEnabled =
+ config.get(Configs.REST_API_EXTENSION_PACKAGES).stream()
+ .anyMatch(
+ pkg ->
IdpRESTFeature.IDP_REST_EXTENSION_PACKAGE.equalsIgnoreCase(pkg.trim()));
+ if (!idpExtensionEnabled) {
+ LOG.error(
+ "'basic' in gravitino.authenticators requires
gravitino.server.rest.extensionPackages "
+ + "to include {}.",
+ IdpRESTFeature.IDP_REST_EXTENSION_PACKAGE);
+ System.exit(1);
Review Comment:
You should modify the IDP initialization if possible, too.
--
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]