You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by pe...@apache.org on 2022/04/13 00:58:21 UTC

[pulsar] branch master updated: fix debug log authenticate role error (#14784)

This is an automated email from the ASF dual-hosted git repository.

penghui pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 97b7e77a907 fix debug log authenticate role error (#14784)
97b7e77a907 is described below

commit 97b7e77a9075159dd58a279d64f834e85472f437
Author: Dezhi LIiu <33...@users.noreply.github.com>
AuthorDate: Wed Apr 13 08:58:14 2022 +0800

    fix debug log authenticate role error (#14784)
---
 .../main/java/org/apache/pulsar/broker/service/ServerCnx.java    | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
index 0102b8d01ad..09dbaa9e8d2 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
@@ -832,8 +832,13 @@ public class ServerCnx extends PulsarHandler implements TransportCnx {
             authState = authenticationProvider.newAuthState(clientData, remoteAddress, sslSession);
 
             if (log.isDebugEnabled()) {
-                log.debug("[{}] Authenticate role : {}", remoteAddress,
-                    authState != null ? authState.getAuthRole() : null);
+                String role = "";
+                if (authState != null && authState.isComplete()) {
+                    role = authState.getAuthRole();
+                } else {
+                    role = "authentication incomplete or null";
+                }
+                log.debug("[{}] Authenticate role : {}", remoteAddress, role);
             }
 
             state = doAuthentication(clientData, clientProtocolVersion, clientVersion);