pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [pulsar] ivankelly commented on a change in pull request #3677: PIP-30: interface and mutual change authentication
Date Mon, 04 Mar 2019 11:36:37 GMT
ivankelly commented on a change in pull request #3677: PIP-30: interface and mutual change
authentication
URL: https://github.com/apache/pulsar/pull/3677#discussion_r262022837
 
 

 ##########
 File path: pulsar-common/src/main/java/org/apache/pulsar/common/api/Commands.java
 ##########
 @@ -168,6 +212,52 @@ public static ByteBuf newConnected(int clientProtocolVersion) {
         return res;
     }
 
+    public static ByteBuf newAuthChallenge(String authMethod, AuthData brokerData, int clientProtocolVersion)
{
+        CommandAuthChallenge.Builder challengeBuilder = CommandAuthChallenge.newBuilder();
+
+        // If the broker supports a newer version of the protocol, it will anyway advertise
the max version that the
+        // client supports, to avoid confusing the client.
+        int currentProtocolVersion = getCurrentProtocolVersion();
+        int versionToAdvertise = Math.min(currentProtocolVersion, clientProtocolVersion);
+
+        challengeBuilder.setProtocolVersion(versionToAdvertise);
+        challengeBuilder.setServerVersion("Pulsar Server");
+
+        CommandAuthChallenge challenge = challengeBuilder
+            .setChallenge(PulsarApi.AuthData.newBuilder()
+                .setAuthData(copyFrom(brokerData.getBytes()))
+                .setAuthMethodName(authMethod)
+                .build())
+            .build();
+
+        ByteBuf res = serializeWithSize(BaseCommand.newBuilder().setType(Type.AUTH_RESPONSE).setAuthChallenge(challenge));
 
 Review comment:
   Type doesn't match the method name.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message