@@ -86,8 +86,8 @@ class Connection(object):
86
86
87
87
The optional `use_kerberos` argument allows you to establish a
88
88
secure connection to HBase. This argument requires a buffered
89
- `transport` protocol. You must provide a `realm`, `principal`
90
- and `keytab` in order for authentication to work.
89
+ `transport` protocol. You must first authorize yourself with
90
+ your KDC by using kinit (e.g. kinit -kt my.keytab user@REALM)
91
91
92
92
.. versionadded:: 0.9
93
93
`protocol` argument
@@ -111,16 +111,12 @@ class Connection(object):
111
111
:param str transport: Thrift transport mode (optional)
112
112
:param bool use_kerberos: Connect to HBase via a secure connection (default: False)
113
113
:param str sasl_service: The name of the SASL service (default: hbase)
114
- :param str realm: Name of the kerberos realm (required if using sasl transport)
115
- :param str principal: Kerberos principal to authenticate as (required if using sasl transport)
116
- :param str keytab: Location of keytab file for authentication (required if using sasl transport)
117
114
"""
118
115
def __init__ (self , host = DEFAULT_HOST , port = DEFAULT_PORT , timeout = None ,
119
116
autoconnect = True , table_prefix = None ,
120
117
table_prefix_separator = '_' , compat = DEFAULT_COMPAT ,
121
118
transport = DEFAULT_TRANSPORT , protocol = DEFAULT_PROTOCOL ,
122
- use_kerberos = False , sasl_service = "hbase" , realm = None ,
123
- principal = None , keytab = None ):
119
+ use_kerberos = False , sasl_service = "hbase" ):
124
120
125
121
if transport not in THRIFT_TRANSPORTS :
126
122
raise ValueError ("'transport' must be one of %s"
@@ -151,9 +147,6 @@ def __init__(self, host=DEFAULT_HOST, port=DEFAULT_PORT, timeout=None,
151
147
self .compat = compat
152
148
153
149
self ._use_kerberos = use_kerberos
154
- self ._keytab = keytab
155
- self ._principal = principal
156
- self ._realm = realm
157
150
self ._sasl_service = sasl_service
158
151
self ._transport_class = THRIFT_TRANSPORTS [transport ]
159
152
self ._protocol_class = THRIFT_PROTOCOLS [protocol ]
@@ -177,23 +170,10 @@ def _refresh_thrift_client(self):
177
170
if self ._transport_class is not TBufferedTransport :
178
171
raise ValueError ("Must use a buffered transport "
179
172
" when use_kerberos is enabled" )
180
- if not self ._realm :
181
- raise ValueError ("A kerberos realm must be set"
182
- " when use_kerberos is enabled" )
183
- if not self ._principal :
184
- raise ValueError ("A kerberos principal must be set"
185
- " when use_kerberos is enabled" )
186
- if not self ._keytab :
187
- raise ValueError ("A kerberos keytab must be set"
188
- " when use_kerberos is enabled" )
189
- if not path .isfile (self ._keytab ):
190
- raise ValueError ("Unable to open keytab [%s], make"
191
- " sure that it exists" % self ._keytab )
192
173
193
174
saslc = sasl .Client ()
194
175
saslc .setAttr ("host" , self .host )
195
176
saslc .setAttr ("service" , self ._sasl_service )
196
- saslc .setAttr ("realm" , self ._realm )
197
177
saslc .init ()
198
178
self .transport = TSaslClientTransport (saslc , "GSSAPI" , socket )
199
179
0 commit comments