ivankelly commented on a change in pull request #3067: PIP-25: C++ / Python /
Go implementation for token authentication
URL: https://github.com/apache/pulsar/pull/3067#discussion_r236613785
##########
File path: pulsar-client-cpp/python/pulsar_test.py
##########
@@ -793,6 +793,43 @@ def test_get_topics_partitions(self):
[topic_non_partitioned])
client.close()
+ def test_token_auth(self):
+ with open('/tmp/pulsar-test-data/certs/token.txt') as tf:
+ token = tf.read().strip()
+ client = Client(self.adminUrl,
+ authentication=AuthenticationToken(token))
+
+ consumer =
client.subscribe('persistent://private/auth/my-python-topic-token-auth',
+ 'my-sub',
+ consumer_type=ConsumerType.Shared)
+ producer =
client.create_producer('persistent://private/auth/my-python-topic-token-auth')
+ producer.send(b'hello')
+
+ msg = consumer.receive(1000)
+ self.assertTrue(msg)
+ self.assertEqual(msg.data(), b'hello')
+ client.close()
+
+ def test_token_auth_supplier(self):
+ def read_token():
+ with open('/tmp/pulsar-test-data/certs/token.txt') as tf:
+ return tf.read().strip()
+
+ client = Client(self.serviceUrl,
Review comment:
why serviceUrl and http above? If you use http here it will still exercise
both endpoints
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services