Skip to content

Commit 6b022d3

Browse files
feat(NODE-7152): deprecate MongoAuthProcess class (#267)
1 parent 88d5d04 commit 6b022d3

File tree

5 files changed

+160
-41
lines changed

5 files changed

+160
-41
lines changed

.github/workflows/check-docs.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
on:
2+
pull_request:
3+
branches: [main]
4+
workflow_dispatch: {}
5+
workflow_call: {}
6+
7+
name: Build and Test
8+
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
id-token: write
13+
14+
jobs:
15+
check_docs:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Install dependencies
21+
run: npm install --ignore-scripts
22+
23+
- name: Build and check docs
24+
run: |
25+
npm run docs
26+
if ! git diff --quiet README.md ; then
27+
echo "Generated readme is out-of-sync! Please update the readme and re-commit, modifying the template in etc/README.hbs if necessary."
28+
exit 1
29+
fi

README.md

Lines changed: 41 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
Kerberos
22
========
3-
The `kerberos` package is a C++ extension for Node.js that provides cross-platform support for kerberos authentication using GSSAPI on linux/osx, and SSPI on windows. Much of the code in this module is adapted from [ccs-kerberos](https://github.com/apple/ccs-pykerberos) and [winkerberos](https://github.com/mongodb-labs/winkerberos).
3+
The `kerberos` package is a C++ extension for Node.js that provides cross-platform support for kerberos authentication
4+
using GSSAPI on linux/osx, and SSPI on windows. Much of the code in this module is adapted from
5+
[ccs-kerberos](https://github.com/apple/ccs-pykerberos) and [winkerberos](https://github.com/mongodb-labs/winkerberos).
46

57
### Requirements
68

@@ -15,27 +17,34 @@ The `kerberos` package is a C++ extension for Node.js that provides cross-platfo
1517
- Distribution-specific kerberos packages (e.g. `krb5` on Homebrew)
1618

1719
**Windows**
18-
- **Option 1:** Install all the required tools and configurations using Microsoft's [windows-build-tools](https://github.com/felixrieseberg/windows-build-tools) by running `npm install -g windows-build-tools` from an elevated PowerShell (run as Administrator).
20+
- **Option 1:** Install all the required tools and configurations using Microsoft's
21+
[windows-build-tools](https://github.com/felixrieseberg/windows-build-tools) by running `npm install -g
22+
windows-build-tools` from an elevated PowerShell (run as Administrator).
1923
- **Option 2:** Install dependencies and configuration manually
20-
1. Visual C++ Build Environment:
21-
* **Option 1:** Install [Visual C++ Build Tools](http://go.microsoft.com/fwlink/?LinkId=691126) using the *Default Install* option.
22-
* **Option 2:** Install [Visual Studio 2015](https://www.visualstudio.com/products/visual-studio-community-vs) (or modify an existing installation) and select *Common Tools for Visual C++* during setup.
24+
1. Visual C++ Build Environment:
25+
* **Option 1:** Install [Visual C++ Build Tools](http://go.microsoft.com/fwlink/?LinkId=691126) using the *Default
26+
Install* option.
27+
* **Option 2:** Install [Visual Studio 2015](https://www.visualstudio.com/products/visual-studio-community-vs) (or
28+
modify an existing installation) and select *Common Tools for Visual C++* during setup.
2329

24-
> :bulb: [Windows Vista / 7 only] requires [.NET Framework 4.5.1](http://www.microsoft.com/en-us/download/details.aspx?id=40773)
30+
> :bulb: [Windows Vista / 7 only] requires [.NET Framework
31+
4.5.1](http://www.microsoft.com/en-us/download/details.aspx?id=40773)
2532

26-
2. Install [Python 2.7](https://www.python.org/downloads/) or [Miniconda 2.7](http://conda.pydata.org/miniconda.html) (`v3.x.x` is not supported), and run `npm config set python python2.7`
27-
3. Launch cmd, `npm config set msvs_version 2015`
33+
2. Install [Python 2.7](https://www.python.org/downloads/) or [Miniconda 2.7](http://conda.pydata.org/miniconda.html)
34+
(`v3.x.x` is not supported), and run `npm config set python python2.7`
35+
3. Launch cmd, `npm config set msvs_version 2015`
2836

2937
### MongoDB Node.js Driver Version Compatibility
3038

31-
Only the following version combinations with the [MongoDB Node.js Driver](https://github.com/mongodb/node-mongodb-native) are considered stable.
39+
Only the following version combinations with the [MongoDB Node.js
40+
Driver](https://github.com/mongodb/node-mongodb-native) are considered stable.
3241

33-
42+
3443
| ------------- | -------------- | -------------- |
35-
| `[email protected]` | N/A | |
36-
| `[email protected]` | | |
37-
| `[email protected]` | | |
38-
| `[email protected]` | | N/A |
44+
| `[email protected]` | N/A ||
45+
| `[email protected]` |||
46+
| `[email protected]` |||
47+
| `[email protected]` || N/A |
3948

4049
### Installation
4150

@@ -51,18 +60,20 @@ Below are the platforms that are available as prebuilds on each github release.
5160
`prebuild-install` downloads these automatically depending on the platform you are running npm install on.
5261

5362
- Linux GLIBC 2.23 or later
54-
- s390x
55-
- arm64
56-
- x64
63+
- s390x
64+
- arm64
65+
- x64
5766
- MacOS universal binary
58-
- x64
59-
- arm64
67+
- x64
68+
- arm64
6069
- Windows
61-
- x64
70+
- x64
6271

6372
### Release Integrity
6473

65-
Releases are created automatically and signed using the [Node team's GPG key](https://pgp.mongodb.com/node-driver.asc). This applies to the git tag as well as all release packages provided as part of a GitHub release. To verify the provided packages, download the key and import it using gpg:
74+
Releases are created automatically and signed using the [Node team's GPG key](https://pgp.mongodb.com/node-driver.asc).
75+
This applies to the git tag as well as all release packages provided as part of a GitHub release. To verify the provided
76+
packages, download the key and import it using gpg:
6677

6778
```
6879
gpg --import node-driver.asc
@@ -71,9 +82,9 @@ gpg --import node-driver.asc
7182
The GitHub release contains a detached signature file for the NPM package (named
7283
`kerberos-X.Y.Z.tgz.sig`).
7384

74-
The following command returns the link npm package.
85+
The following command returns the link npm package.
7586
```shell
76-
npm view [email protected] dist.tarball
87+
npm view [email protected] dist.tarball
7788
```
7889

7990
Using the result of the above command, a `curl` command can return the official npm package for the release.
@@ -84,16 +95,19 @@ gpg --verify kerberos-X.Y.Z.tgz.sig kerberos-X.Y.Z.tgz
8495
```
8596

8697
>[!Note]
87-
No verification is done when using npm to install the package. To ensure release integrity when using npm, download the tarball manually from the GitHub release, verify the signature, then install the package from the downloaded tarball using npm install mongodb-X.Y.Z.tgz.
98+
No verification is done when using npm to install the package. To ensure release integrity when using npm, download the
99+
tarball manually from the GitHub release, verify the signature, then install the package from the downloaded tarball
100+
using npm install mongodb-X.Y.Z.tgz.
88101

89-
To verify the native `.node` packages, follow the same steps as above.
102+
To verify the native `.node` packages, follow the same steps as above.
90103

91104
### Testing
92105

93106
Run the test suite using:
94107

95108
```bash
96-
docker run -i -v PATH_TO_KERBEROS_REPO:/app -w /app -e PROJECT_DIRECTORY=/app ubuntu:20.04 /bin/bash /app/.evergreen/run-tests-ubuntu.sh
109+
docker run -i -v PATH_TO_KERBEROS_REPO:/app -w /app -e PROJECT_DIRECTORY=/app ubuntu:20.04 /bin/bash
110+
/app/.evergreen/run-tests-ubuntu.sh
97111
```
98112

99113
NOTE: The test suite requires an active kerberos deployment.
@@ -278,7 +292,7 @@ Details are looked up via the `/etc/keytab` file.
278292
| [options] | <code>object</code> | Optional settings |
279293
| [options.principal] | <code>string</code> | Optional string containing the client principal in the form 'user@realm' (e.g. '[email protected]'). |
280294
| [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) |
281-
| [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`. |
295+
| [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`. |
282296
| [callback] | <code>function</code> | |
283297

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

etc/README.hbs

Lines changed: 79 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Kerberos
22
========
3-
[![Build Status](https://travis-ci.org/mongodb-js/kerberos.svg?branch=master)](https://travis-ci.org/mongodb-js/kerberos)
4-
5-
The `kerberos` package is a C++ extension for Node.js that provides cross-platform support for kerberos authentication using GSSAPI on linux/osx, and SSPI on windows. Much of the code in this module is adapted from [ccs-kerberos](https://github.com/apple/ccs-pykerberos) and [winkerberos](https://github.com/mongodb-labs/winkerberos).
3+
The `kerberos` package is a C++ extension for Node.js that provides cross-platform support for kerberos authentication
4+
using GSSAPI on linux/osx, and SSPI on windows. Much of the code in this module is adapted from
5+
[ccs-kerberos](https://github.com/apple/ccs-pykerberos) and [winkerberos](https://github.com/mongodb-labs/winkerberos).
66

77
### Requirements
88

@@ -17,16 +17,34 @@ The `kerberos` package is a C++ extension for Node.js that provides cross-platfo
1717
- Distribution-specific kerberos packages (e.g. `krb5` on Homebrew)
1818

1919
**Windows**
20-
- **Option 1:** Install all the required tools and configurations using Microsoft's [windows-build-tools](https://github.com/felixrieseberg/windows-build-tools) by running `npm install -g windows-build-tools` from an elevated PowerShell (run as Administrator).
20+
- **Option 1:** Install all the required tools and configurations using Microsoft's
21+
[windows-build-tools](https://github.com/felixrieseberg/windows-build-tools) by running `npm install -g
22+
windows-build-tools` from an elevated PowerShell (run as Administrator).
2123
- **Option 2:** Install dependencies and configuration manually
22-
1. Visual C++ Build Environment:
23-
* **Option 1:** Install [Visual C++ Build Tools](http://go.microsoft.com/fwlink/?LinkId=691126) using the *Default Install* option.
24-
* **Option 2:** Install [Visual Studio 2015](https://www.visualstudio.com/products/visual-studio-community-vs) (or modify an existing installation) and select *Common Tools for Visual C++* during setup.
24+
1. Visual C++ Build Environment:
25+
* **Option 1:** Install [Visual C++ Build Tools](http://go.microsoft.com/fwlink/?LinkId=691126) using the *Default
26+
Install* option.
27+
* **Option 2:** Install [Visual Studio 2015](https://www.visualstudio.com/products/visual-studio-community-vs) (or
28+
modify an existing installation) and select *Common Tools for Visual C++* during setup.
29+
30+
> :bulb: [Windows Vista / 7 only] requires [.NET Framework
31+
4.5.1](http://www.microsoft.com/en-us/download/details.aspx?id=40773)
32+
33+
2. Install [Python 2.7](https://www.python.org/downloads/) or [Miniconda 2.7](http://conda.pydata.org/miniconda.html)
34+
(`v3.x.x` is not supported), and run `npm config set python python2.7`
35+
3. Launch cmd, `npm config set msvs_version 2015`
2536

26-
> :bulb: [Windows Vista / 7 only] requires [.NET Framework 4.5.1](http://www.microsoft.com/en-us/download/details.aspx?id=40773)
37+
### MongoDB Node.js Driver Version Compatibility
2738

28-
2. Install [Python 2.7](https://www.python.org/downloads/) or [Miniconda 2.7](http://conda.pydata.org/miniconda.html) (`v3.x.x` is not supported), and run `npm config set python python2.7`
29-
3. Launch cmd, `npm config set msvs_version 2015`
39+
Only the following version combinations with the [MongoDB Node.js
40+
Driver](https://github.com/mongodb/node-mongodb-native) are considered stable.
41+
42+
43+
| ------------- | -------------- | -------------- |
44+
| `[email protected]` | N/A | ✓ |
45+
| `[email protected]` | ✓ | ✓ |
46+
| `[email protected]` | ✓ | ✓ |
47+
| `[email protected]` | ✓ | N/A |
3048

3149
### Installation
3250

@@ -36,16 +54,64 @@ Now you can install `kerberos` with the following:
3654
npm install kerberos
3755
```
3856

57+
#### Prebuild Platforms
58+
59+
Below are the platforms that are available as prebuilds on each github release.
60+
`prebuild-install` downloads these automatically depending on the platform you are running npm install on.
61+
62+
- Linux GLIBC 2.23 or later
63+
- s390x
64+
- arm64
65+
- x64
66+
- MacOS universal binary
67+
- x64
68+
- arm64
69+
- Windows
70+
- x64
71+
72+
### Release Integrity
73+
74+
Releases are created automatically and signed using the [Node team's GPG key](https://pgp.mongodb.com/node-driver.asc).
75+
This applies to the git tag as well as all release packages provided as part of a GitHub release. To verify the provided
76+
packages, download the key and import it using gpg:
77+
78+
```
79+
gpg --import node-driver.asc
80+
```
81+
82+
The GitHub release contains a detached signature file for the NPM package (named
83+
`kerberos-X.Y.Z.tgz.sig`).
84+
85+
The following command returns the link npm package.
86+
```shell
87+
npm view [email protected] dist.tarball
88+
```
89+
90+
Using the result of the above command, a `curl` command can return the official npm package for the release.
91+
92+
To verify the integrity of the downloaded package, run the following command:
93+
```shell
94+
gpg --verify kerberos-X.Y.Z.tgz.sig kerberos-X.Y.Z.tgz
95+
```
96+
97+
>[!Note]
98+
No verification is done when using npm to install the package. To ensure release integrity when using npm, download the
99+
tarball manually from the GitHub release, verify the signature, then install the package from the downloaded tarball
100+
using npm install mongodb-X.Y.Z.tgz.
101+
102+
To verify the native `.node` packages, follow the same steps as above.
103+
39104
### Testing
40105

41106
Run the test suite using:
42107

43108
```bash
44-
npm test
109+
docker run -i -v PATH_TO_KERBEROS_REPO:/app -w /app -e PROJECT_DIRECTORY=/app ubuntu:20.04 /bin/bash
110+
/app/.evergreen/run-tests-ubuntu.sh
45111
```
46112

47-
NOTE: The test suite requires an active kerberos deployment, see `test/scripts/travis.sh` to better understand these requirements.
113+
NOTE: The test suite requires an active kerberos deployment.
48114

49115
# Documentation
50116

51-
{{>main}}
117+
{{>main}}

lib/auth_processes/mongodb.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22
const dns = require('dns');
33
const kerberos = require('../kerberos');
44

5+
/**
6+
* A class that was used for MongoDB kerberos authentication with legacy
7+
* MongoDB Node drivers (`mongodb<4.0`).
8+
*
9+
* Not intended for direct use.
10+
*
11+
* @kind class
12+
*
13+
* @deprecated This class will be removed in an upcoming major release.
14+
*/
515
class MongoAuthProcess {
616
constructor(host, port, serviceName, options) {
717
options = options || {};

lib/kerberos.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ const principalDetails = defineOperation(kerberos.principalDetails, [
157157
* @param {string} service A string containing the service principal in the form 'type@fqdn' (e.g. '[email protected]').
158158
* @param {object} [options] Optional settings
159159
* @param {string} [options.principal] Optional string containing the client principal in the form 'user@realm' (e.g. '[email protected]').
160-
* @param {number} [options.gssFlags] 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)
160+
* @param {number} [options.flags] 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)
161161
* @param {number} [options.mechOID] Optional GSS mech OID. Defaults to None (GSS_C_NO_OID). Other possible values are `GSS_MECH_OID_KRB5`, `GSS_MECH_OID_SPNEGO`.
162162
* @param {function} [callback]
163163
* @return {Promise} returns Promise if no callback passed

0 commit comments

Comments
 (0)