Skip to content

Commit

Permalink
[Improve][Auth]Update authentication failed metrics report (apache#17787
Browse files Browse the repository at this point in the history
)
  • Loading branch information
tuteng authored Sep 26, 2022
1 parent 691e468 commit 5068800
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import javax.servlet.http.HttpServletResponse;
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;

/**
Expand Down Expand Up @@ -58,8 +59,15 @@ static <T, W> T applyAuthProcessor(List<W> processors, AuthProcessor<T, W> authF
}

if (null == authenticationException) {
AuthenticationMetrics.authenticateFailure(
AuthenticationProviderList.class.getSimpleName(),
"authentication-provider-list", "Authentication required");
throw new AuthenticationException("Authentication required");
} else {
AuthenticationMetrics.authenticateFailure(AuthenticationProviderList.class.getSimpleName(),
"authentication-provider-list",
authenticationException.getMessage() != null
? authenticationException.getMessage() : "Authentication required");
throw authenticationException;
}

Expand Down

0 comments on commit 5068800

Please sign in to comment.