File tree Expand file tree Collapse file tree 3 files changed +10
-33
lines changed
Expand file tree Collapse file tree 3 files changed +10
-33
lines changed Original file line number Diff line number Diff line change @@ -330,28 +330,6 @@ The package provides the necessary token provider that handles the
330330authentication against the KDC (key distribution center) with the given
331331credentials, receives and caches the ticket, and finally retrieves the token.
332332
333- You can install the package from PyPI.
334-
335- .. code :: bash
336-
337- pip install hazelcast-kerberos
338-
339- A sample code that makes use of the package is below.
340-
341- .. code :: python
342-
343- import hazelcast
344- import hzkerberos
345-
346- token_provider = hzkerberos.TokenProvider(
347- principal = " hz/172.17.0.2@EXAMPLE.COM" ,
348- keytab = " /etc/krb5.keytab" ,
349- )
350-
351- client = hazelcast.HazelcastClient(
352- token_provider = token_provider
353- )
354-
355333For more information and possible client and server configurations, refer to
356- the `documentation <https://pypi.org/project /hazelcast-kerberos/ >`__ of the
334+ the `documentation <https://github.com/hazelcast /hazelcast-python-client- kerberos >`__ of the
357335``hazelcast-kerberos `` package.
Original file line number Diff line number Diff line change @@ -491,9 +491,10 @@ def _authenticate(self, connection):
491491 cluster_name = self ._config .cluster_name
492492 client_name = client .name
493493 if self ._config .token_provider :
494+ token = self ._config .token_provider .token (connection .connected_address )
494495 request = client_authentication_custom_codec .encode_request (
495496 cluster_name ,
496- self . _config . token_provider . token () ,
497+ token ,
497498 self .client_uuid ,
498499 CLIENT_TYPE ,
499500 SERIALIZATION_VERSION ,
Original file line number Diff line number Diff line change 11from hazelcast .six import string_types
2+ from hazelcast .core import Address
23
34
45class TokenProvider (object ):
56 """TokenProvider is a base class for token providers."""
67
7- def token (self ):
8- # type: (TokenProvider) -> bytes
8+ def token (self , address = None ):
9+ # type: (TokenProvider, Address ) -> bytes
910 """Returns a token to be used for token-based authentication.
1011
12+ Args:
13+ address (hazelcast.core.Address): Connected address for the member.
14+
1115 Returns:
1216 bytes: token as a bytes object.
1317 """
@@ -25,11 +29,5 @@ def __init__(self, token=""):
2529 else :
2630 raise TypeError ("token must be either a str or bytes object" )
2731
28- def token (self ):
29- # type: (BasicTokenProvider) -> bytes
30- """Returns a token to be used for token-based authentication.
31-
32- Returns:
33- bytes: token as a bytes object.
34- """
32+ def token (self , address = None ):
3533 return self ._token
You can’t perform that action at this time.
0 commit comments