kkoderok commented on code in PR #13339: URL: https://github.com/apache/pulsar/pull/13339#discussion_r841390236
########## pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyConnection.java: ########## @@ -439,11 +451,65 @@ ClientConfigurationData createClientConfiguration() throws UnsupportedAuthentica private PulsarClientImpl createClient(final ClientConfigurationData clientConf, final AuthData clientAuthData, final String clientAuthMethod, final int protocolVersion) throws PulsarClientException { this.connectionPool = new ProxyConnectionPool(clientConf, service.getWorkerGroup(), - () -> new ProxyClientCnx(clientConf, service.getWorkerGroup(), clientAuthRole, clientAuthData, - clientAuthMethod, protocolVersion)); + () -> new ProxyClientCnx(clientConf, service.getWorkerGroup(), clientAuthRole, + this::getOrRefreshClientAuthData, clientAuthMethod, protocolVersion, + service.getConfiguration().isForwardAuthorizationCredentials())); return new PulsarClientImpl(clientConf, service.getWorkerGroup(), connectionPool, service.getTimer()); } + private void updateClientAuthData(AuthData clientData) { + this.clientAuthData = clientData; + authFutureList.getAndSet(Collections.emptyList()) + .forEach(future -> future.complete(clientData)); + } + + private CompletableFuture<AuthData> getOrRefreshClientAuthData() { Review Comment: When client auth data expired and proxy configured with forward authentication data, then this method requests a new token. This method is thread safe, because one ProxyConnection has multiple ProxyClientCnx, and potentially at same time, they request auth data. -- 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: dev-unsubscr...@pulsar.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org