gaoran10 commented on code in PR #20030: URL: https://github.com/apache/pulsar/pull/20030#discussion_r1176056730
########## pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authentication/AuthenticationProviderToken.java: ########## @@ -158,19 +164,18 @@ public String getAuthMethodName() { @Override public String authenticate(AuthenticationDataSource authData) throws AuthenticationException { + String token; try { // Get Token - String token; token = getToken(authData); Review Comment: The method `getToken` is static, some methods use it and catch exceptions to record failure metrics, such as OpenID provider, if we increment the `INVALID_AUTH_DATA` error in the `getToken` method, this will generate repeat failure records. OpenID provider ``` CompletableFuture<DecodedJWT> authenticateTokenAsync(AuthenticationDataSource authData) { String token; try { token = AuthenticationProviderToken.getToken(authData); } catch (AuthenticationException e) { incrementFailureMetric(AuthenticationExceptionCode.ERROR_DECODING_JWT); return CompletableFuture.failedFuture(e); } return authenticateToken(token) .whenComplete((jwt, e) -> { if (jwt != null) { AuthenticationMetrics.authenticateSuccess(getClass().getSimpleName(), getAuthMethodName()); } // Failure metrics are incremented within methods above }); } ``` -- 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: commits-unsubscr...@pulsar.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org