Skip to content

Commit 3a5a37f

Browse files
feat(NODE-6416)!: drop callback support from public API (#269)
1 parent 16584e5 commit 3a5a37f

File tree

11 files changed

+249
-821
lines changed

11 files changed

+249
-821
lines changed

.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"es6": true
1111
},
1212
"parserOptions": {
13-
"ecmaVersion": 2019
13+
"ecmaVersion": 2023
1414
},
1515
"plugins": [
1616
"prettier"

README.md

Lines changed: 20 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ NOTE: The test suite requires an active kerberos deployment.
126126
## Functions
127127

128128
<dl>
129-
<dt><a href="#checkPassword">checkPassword(username, password, service, [defaultRealm], [callback])</a> ⇒ <code>Promise</code></dt>
129+
<dt><a href="#checkPassword">checkPassword(username, password, service, [defaultRealm])</a> ⇒ <code>Promise.&lt;null&gt;</code></dt>
130130
<dd><p>This function provides a simple way to verify that a user name and password
131131
match those normally used for Kerberos authentication.
132132
It does this by checking that the supplied user name and password can be
@@ -141,14 +141,14 @@ has the correct realms and KDCs listed.</p>
141141
only be used for testing. Do not use this in any production system - your
142142
security could be compromised if you do.</p>
143143
</dd>
144-
<dt><a href="#principalDetails">principalDetails(service, hostname, [callback])</a> ⇒ <code>Promise</code></dt>
144+
<dt><a href="#principalDetails">principalDetails(service, hostname)</a> ⇒ <code>Promise</code></dt>
145145
<dd><p>This function returns the service principal for the server given a service type and hostname.</p>
146146
<p>Details are looked up via the <code>/etc/keytab</code> file.</p>
147147
</dd>
148-
<dt><a href="#initializeClient">initializeClient(service, [options], [callback])</a> ⇒ <code>Promise</code></dt>
148+
<dt><a href="#initializeClient">initializeClient(service, [options])</a> ⇒ <code><a href="#KerberosClient">Promise.&lt;KerberosClient&gt;</a></code></dt>
149149
<dd><p>Initializes a context for client-side authentication with the given service principal.</p>
150150
</dd>
151-
<dt><a href="#initializeServer">initializeServer(service, [callback])</a> ⇒ <code>Promise</code></dt>
151+
<dt><a href="#initializeServer">initializeServer(service)</a> ⇒ <code><a href="#KerberosServer">Promise.&lt;KerberosServer&gt;</a></code></dt>
152152
<dd><p>Initializes a context for server-side authentication with the given service principal.</p>
153153
</dd>
154154
</dl>
@@ -168,52 +168,46 @@ security could be compromised if you do.</p>
168168

169169
* [KerberosClient](#KerberosClient)
170170

171-
* [.step(challenge, [callback])](#KerberosClient+step)
171+
* [.step(challenge)](#KerberosClient+step)
172172

173-
* [.wrap(challenge, [options], [callback])](#KerberosClient+wrap)
173+
* [.wrap(challenge, [options])](#KerberosClient+wrap)
174174

175-
* [.unwrap(challenge, [callback])](#KerberosClient+unwrap)
175+
* [.unwrap(challenge)](#KerberosClient+unwrap)
176176

177177

178178
<a name="KerberosClient+step"></a>
179179

180-
### *kerberosClient*.step(challenge, [callback])
180+
### *kerberosClient*.step(challenge)
181181

182182
| Param | Type | Description |
183183
| --- | --- | --- |
184184
| challenge | <code>string</code> | A string containing the base64-encoded server data (which may be empty for the first step) |
185-
| [callback] | <code>function</code> | |
186185

187186
Processes a single kerberos client-side step using the supplied server challenge.
188187

189-
**Returns**: <code>Promise</code> - returns Promise if no callback passed
190188
<a name="KerberosClient+wrap"></a>
191189

192-
### *kerberosClient*.wrap(challenge, [options], [callback])
190+
### *kerberosClient*.wrap(challenge, [options])
193191

194192
| Param | Type | Description |
195193
| --- | --- | --- |
196194
| challenge | <code>string</code> | The response returned after calling `unwrap` |
197-
| [options] | <code>object</code> | Optional settings |
195+
| [options] | <code>object</code> | Options |
198196
| [options.user] | <code>string</code> | The user to authorize |
199197
| [options.protect] | <code>boolean</code> | Indicates if the wrap should request message confidentiality |
200-
| [callback] | <code>function</code> | |
201198

202199
Perform the client side kerberos wrap step.
203200

204-
**Returns**: <code>Promise</code> - returns Promise if no callback passed
205201
<a name="KerberosClient+unwrap"></a>
206202

207-
### *kerberosClient*.unwrap(challenge, [callback])
203+
### *kerberosClient*.unwrap(challenge)
208204

209205
| Param | Type | Description |
210206
| --- | --- | --- |
211207
| challenge | <code>string</code> | A string containing the base64-encoded server data |
212-
| [callback] | <code>function</code> | |
213208

214209
Perform the client side kerberos unwrap step
215210

216-
**Returns**: <code>Promise</code> - returns Promise if no callback passed
217211
<a name="KerberosServer"></a>
218212

219213
## KerberosServer
@@ -228,27 +222,24 @@ Perform the client side kerberos unwrap step
228222

229223
<a name="KerberosServer+step"></a>
230224

231-
### *kerberosServer*.step(challenge, [callback])
225+
### *kerberosServer*.step(challenge)
232226

233227
| Param | Type | Description |
234228
| --- | --- | --- |
235229
| challenge | <code>string</code> | A string containing the base64-encoded client data |
236-
| [callback] | <code>function</code> | |
237230

238231
Processes a single kerberos server-side step using the supplied client data.
239232

240-
**Returns**: <code>Promise</code> - returns Promise if no callback passed
241233
<a name="checkPassword"></a>
242234

243-
## checkPassword(username, password, service, [defaultRealm], [callback])
235+
## checkPassword(username, password, service, [defaultRealm])
244236

245237
| Param | Type | Description |
246238
| --- | --- | --- |
247239
| username | <code>string</code> | The Kerberos user name. If no realm is supplied, then the `defaultRealm` will be used. |
248240
| password | <code>string</code> | The password for the user. |
249241
| service | <code>string</code> | The Kerberos service to check access for. |
250242
| [defaultRealm] | <code>string</code> | The default realm to use if one is not supplied in the user argument. |
251-
| [callback] | <code>function</code> | |
252243

253244
This function provides a simple way to verify that a user name and password
254245
match those normally used for Kerberos authentication.
@@ -266,25 +257,24 @@ IMPORTANT: This method is vulnerable to KDC spoofing attacks and it should
266257
only be used for testing. Do not use this in any production system - your
267258
security could be compromised if you do.
268259

269-
**Returns**: <code>Promise</code> - returns Promise if no callback passed
260+
**Returns**: <code>Promise.&lt;null&gt;</code> - returns Promise that rejects if the password is invalid
270261
<a name="principalDetails"></a>
271262

272-
## principalDetails(service, hostname, [callback])
263+
## principalDetails(service, hostname)
273264

274265
| Param | Type | Description |
275266
| --- | --- | --- |
276267
| service | <code>string</code> | The Kerberos service type for the server. |
277268
| hostname | <code>string</code> | The hostname of the server. |
278-
| [callback] | <code>function</code> | |
279269

280270
This function returns the service principal for the server given a service type and hostname.
281271

282272
Details are looked up via the `/etc/keytab` file.
283273

284-
**Returns**: <code>Promise</code> - returns Promise if no callback passed
274+
**Returns**: <code>Promise</code> - returns Promise
285275
<a name="initializeClient"></a>
286276

287-
## initializeClient(service, [options], [callback])
277+
## initializeClient(service, [options])
288278

289279
| Param | Type | Description |
290280
| --- | --- | --- |
@@ -293,20 +283,18 @@ Details are looked up via the `/etc/keytab` file.
293283
| [options.principal] | <code>string</code> | Optional string containing the client principal in the form 'user@realm' (e.g. '[email protected]'). |
294284
| [options.flags] | <code>number</code> | Optional integer used to set GSS flags. (e.g. `GSS_C_DELEG_FLAG\|GSS_C_MUTUAL_FLAG\|GSS_C_SEQUENCE_FLAG` will allow for forwarding credentials to the remote host) |
295285
| [options.mechOID] | <code>number</code> | Optional GSS mech OID. Defaults to None (GSS_C_NO_OID). Other possible values are `GSS_MECH_OID_KRB5`, `GSS_MECH_OID_SPNEGO`. |
296-
| [callback] | <code>function</code> | |
297286

298287
Initializes a context for client-side authentication with the given service principal.
299288

300-
**Returns**: <code>Promise</code> - returns Promise if no callback passed
289+
**Returns**: [<code>Promise.&lt;KerberosClient&gt;</code>](#KerberosClient) - returns Promise
301290
<a name="initializeServer"></a>
302291

303-
## initializeServer(service, [callback])
292+
## initializeServer(service)
304293

305294
| Param | Type | Description |
306295
| --- | --- | --- |
307296
| service | <code>string</code> | A string containing the service principal in the form 'type@fqdn' (e.g. '[email protected]'). |
308-
| [callback] | <code>function</code> | |
309297

310298
Initializes a context for server-side authentication with the given service principal.
311299

312-
**Returns**: <code>Promise</code> - returns Promise if no callback passed
300+
**Returns**: [<code>Promise.&lt;KerberosServer&gt;</code>](#KerberosServer) - returns Promise

lib/auth_processes/mongodb.js

Lines changed: 0 additions & 161 deletions
This file was deleted.

lib/index.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,3 @@ module.exports = kerberos;
99
module.exports.Kerberos = kerberos;
1010

1111
module.exports.version = require('../package.json').version;
12-
13-
// Set up the auth processes
14-
module.exports.processes = {
15-
MongoAuthProcess: require('./auth_processes/mongodb').MongoAuthProcess
16-
};

0 commit comments

Comments
 (0)