From commits-return-23592-archive-asf-public=cust-asf.ponee.io@pulsar.apache.org Mon Mar 4 11:36:40 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 6AE171807C4 for ; Mon, 4 Mar 2019 12:36:39 +0100 (CET) Received: (qmail 8141 invoked by uid 500); 4 Mar 2019 11:36:38 -0000 Mailing-List: contact commits-help@pulsar.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@pulsar.apache.org Delivered-To: mailing list commits@pulsar.apache.org Received: (qmail 7856 invoked by uid 99); 4 Mar 2019 11:36:38 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Mar 2019 11:36:38 +0000 From: GitBox To: commits@pulsar.apache.org Subject: [GitHub] [pulsar] ivankelly commented on a change in pull request #3677: PIP-30: interface and mutual change authentication Message-ID: <155169939774.19363.2512747404741047399.gitbox@gitbox.apache.org> Date: Mon, 04 Mar 2019 11:36:37 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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