[Broker Auth SASL] Remove unnecessary authenticate method definition
@@ -52,11 +52,18 @@ import javax.servlet.http.HttpServletResponse;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import org.apache.pulsar.broker.ServiceConfiguration;
-import org.apache.pulsar.broker.authentication.metrics.AuthenticationMetrics;
import org.apache.pulsar.common.api.AuthData;
import org.apache.pulsar.common.sasl.JAASCredentialsContainer;
import org.apache.pulsar.common.sasl.SaslConstants;
+/**
+ * Authentication Provider for SASL (Simple Authentication and Security Layer).
+ *
+ * Note: This provider does not override the default implementation for
+ * {@link AuthenticationProvider#authenticate(AuthenticationDataSource)}. As the Javadoc for the interface's method
+ * indicates, this method should only be implemented when using single stage authentication. In the case of this
+ * provider, the authentication is multi-stage.
+ */
@Slf4j
public class AuthenticationProviderSasl implements AuthenticationProvider {
@@ -98,22 +105,6 @@ public class AuthenticationProviderSasl implements AuthenticationProvider {
this.signer = new SaslRoleTokenSigner(Long.toString(new Random().nextLong()).getBytes());
}
- @Override
- public String authenticate(AuthenticationDataSource authData) throws AuthenticationException {
- try {
- if (authData instanceof SaslAuthenticationDataSource) {
- AuthenticationMetrics.authenticateSuccess(getClass().getSimpleName(), getAuthMethodName());
- return ((SaslAuthenticationDataSource) authData).getAuthorizationID();
- } else {
- throw new AuthenticationException("Not support authDataSource type, expect sasl.");
- }
- } catch (AuthenticationException exception) {
- AuthenticationMetrics.authenticateFailure(getClass().getSimpleName(), getAuthMethodName(), exception.getMessage());
- throw exception;
- }
-
- }
-
@Override
public String getAuthMethodName() {
return SaslConstants.AUTH_METHOD_NAME;
