CARVIEW |
Select Language
HTTP/2 200
date: Tue, 22 Jul 2025 10:07:26 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
x-repository-download: git clone https://github.com/neo4j/neo4j-javascript-driver.git
etag: W/"fde0e0971e00a5bfcb845d650c562045"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: no-referrer-when-downgrade
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=7%2B0EpB091htXN2JwFdcUTd01RY%2Fk28uhypO5xllj%2FhdFTJHew1iDPSMhBmKVC8fc8SPIOud5R0BB%2FAjUAJ8ld8QIfW2qLHTBnquVWLgvrE%2FtjHwT1cVmO%2Fqs0TcHbHQzciE%2BhX6U%2FYQDbqrk4x5jcV0iB6id5hP2l02dmCEWq%2F8bPzzLtZfm34hh%2BeZdK%2FLHeLwGG0hoi%2FN6k5Z6xvnG3PICn2vngCBwcqvC04iqAaq2qJtfODcwRU%2BQeISjutyV4KXJPKaZ08PuDaq%2FkPCdpw%3D%3D--5lmoRwXNtbXDrQz3--krql2NT8rQCtbPzCBAFrdQ%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.1369419513.1753178845; Path=/; Domain=github.com; Expires=Wed, 22 Jul 2026 10:07:25 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Wed, 22 Jul 2026 10:07:25 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: C732:1E0F94:52C275:5C4CDB:687F62DD
Improve `AuthTokenManager` interface and factory method (#1123) · neo4j/neo4j-javascript-driver@0a1b20e · GitHub
Copy file name to clipboardExpand all lines: packages/bolt-connection/src/connection-provider/authentication-provider.js
Copy file name to clipboardExpand all lines: packages/bolt-connection/src/connection-provider/connection-provider-direct.js
Copy file name to clipboardExpand all lines: packages/bolt-connection/src/connection-provider/connection-provider-pooled.js
Copy file name to clipboardExpand all lines: packages/bolt-connection/src/connection-provider/connection-provider-routing.js
Copy file name to clipboardExpand all lines: packages/bolt-connection/src/connection/connection-error-handler.js
Copy file name to clipboardExpand all lines: packages/bolt-connection/test/connection-provider/authentication-provider.test.js
Copy file name to clipboardExpand all lines: packages/bolt-connection/test/connection-provider/connection-provider-direct.test.js
Copy file name to clipboardExpand all lines: packages/bolt-connection/test/connection-provider/connection-provider-routing.test.js
Skip to content
Navigation Menu
{{ message }}
-
Notifications
You must be signed in to change notification settings - Fork 152
Commit 0a1b20e
authored
Improve
Currently, the `AuthTokenManager` is designed to handle token expiration only. The AuthTokenManager interface only has methods to receive notifications on security errors related to token expiration: `AuthTokenManager.onTokenExpired`. The provided implementation `neo4j.expirationBasedAuthTokenManager` is built to support only token expiration. However, we also want to cater for password rotation scenarios.
### Factory Method Changes
#### Expiration based and bearer tokens
The method `neo4j.expirationBasedAuthTokenManager` was renamed and moved to `neo4j.authTokenManagers.bearer`.
```typescript
import neo4j, { AuthToken } from 'neo4j-driver'
/**
* Method called whenever the driver needs to refresh the token.
*
* The refresh will happen if the driver is notified by the server
* about a token expiration or if the `Date.now() > tokenData.expiry`
*
* Important, the driver will block all the connections creation until
* this function resolves the new auth token.
*/
async function fetchAuthTokenFromMyProvider () {
const bearer: string = await myProvider.getBearerToken()
const token: AuthToken = neo4j.auth.bearer(bearer)
const expiration: Date = myProvider.getExpiryDate()
return {
token,
// if expiration is not provided,
// the driver will only fetch a new token when a failure happens
expiration
}
}
const driver = neo4j.driver(
'neo4j://localhost:7687',
neo4j.authTokenManagers.bearer({
tokenProvider: fetchAuthTokenFromMyProvider
})
)
```
#### Password rotation and basic auth
`neo4j.authTokenManagers.basic` was added to handle password rotation with `AuthTokenManager`.
```typescript
import neo4j, { AuthToken } from 'neo4j-driver'
/**
* Method called whenever the driver needs to refresh the token.
*
* Important, the driver will block all the connections creation until
* this function resolves the new auth token.
*/
async function fetchMyUserAndPassword () {
const { user, password } = await myProvider.getUserAndPassword()
return neo4j.auth.basic(user, password)
}
const driver = neo4j.driver(
'neo4j://localhost:7687',
neo4j.authTokenManagers.basic({
tokenProvider: fetchMyUserAndPassword
})
)
```
### Development checklist
* [x] Update AuthTokenManager interface
* [x] Change `expirationBasedAuthTokenManager` factory name to `authTokenManagers.bearer`
* [x] Add `authTokenManagers.basic` factory
* [x] Adapt `testkit-backend`AuthTokenManager
interface and factory method (#1123)1 parent c23b651 commit 0a1b20eCopy full SHA for 0a1b20e
File tree
Expand file treeCollapse file tree
32 files changed
+829
-246
lines changedFilter options
- packages
- bolt-connection
- src
- connection-provider
- connection
- test
- connection-provider
- connection
- core
- src
- test
- neo4j-driver-deno/lib
- bolt-connection
- connection-provider
- connection
- core
- neo4j-driver-lite/src
- neo4j-driver
- src
- test/types
- types
- testkit-backend
- deno
- src
- controller
- feature
- skipped-tests
Expand file treeCollapse file tree
32 files changed
+829
-246
lines changedpackages/bolt-connection/src/connection-provider/authentication-provider.js
Copy file name to clipboardExpand all lines: packages/bolt-connection/src/connection-provider/authentication-provider.js+5-9Lines changed: 5 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
17 | 17 |
| |
18 | 18 |
| |
19 | 19 |
| |
20 |
| - | |
| 20 | + | |
21 | 21 |
| |
22 | 22 |
| |
23 | 23 |
| |
24 | 24 |
| |
25 | 25 |
| |
26 | 26 |
| |
27 | 27 |
| |
28 |
| - | |
29 |
| - | |
30 |
| - | |
| 28 | + | |
31 | 29 |
| |
32 | 30 |
| |
33 | 31 |
| |
| |||
56 | 54 |
| |
57 | 55 |
| |
58 | 56 |
| |
59 |
| - | |
60 |
| - | |
61 |
| - | |
62 |
| - | |
| 57 | + | |
63 | 58 |
| |
64 |
| - | |
| 59 | + | |
65 | 60 |
| |
| 61 | + | |
66 | 62 |
| |
67 | 63 |
|
packages/bolt-connection/src/connection-provider/connection-provider-direct.js
Copy file name to clipboardExpand all lines: packages/bolt-connection/src/connection-provider/connection-provider-direct.js+4-4Lines changed: 4 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
50 | 50 |
| |
51 | 51 |
| |
52 | 52 |
| |
53 |
| - | |
54 |
| - | |
| 53 | + | |
| 54 | + | |
55 | 55 |
| |
56 | 56 |
| |
57 | 57 |
| |
| |||
68 | 68 |
| |
69 | 69 |
| |
70 | 70 |
| |
71 |
| - | |
| 71 | + | |
72 | 72 |
| |
73 | 73 |
| |
74 | 74 |
| |
75 | 75 |
| |
76 |
| - | |
| 76 | + | |
77 | 77 |
| |
78 | 78 |
| |
79 | 79 |
| |
|
packages/bolt-connection/src/connection-provider/connection-provider-pooled.js
Copy file name to clipboardExpand all lines: packages/bolt-connection/src/connection-provider/connection-provider-pooled.js+7-8Lines changed: 7 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
19 | 19 |
| |
20 | 20 |
| |
21 | 21 |
| |
22 |
| - | |
| 22 | + | |
23 | 23 |
| |
24 | 24 |
| |
25 | 25 |
| |
| |||
41 | 41 |
| |
42 | 42 |
| |
43 | 43 |
| |
44 |
| - | |
45 | 44 |
| |
46 | 45 |
| |
47 | 46 |
| |
| |||
224 | 223 |
| |
225 | 224 |
| |
226 | 225 |
| |
227 |
| - | |
228 |
| - | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
229 | 232 |
| |
230 | 233 |
| |
231 | 234 |
| |
| |||
235 | 238 |
| |
236 | 239 |
| |
237 | 240 |
| |
238 |
| - | |
239 |
| - | |
240 |
| - | |
241 |
| - | |
242 | 241 |
| |
243 | 242 |
| |
244 | 243 |
|
packages/bolt-connection/src/connection-provider/connection-provider-routing.js
Copy file name to clipboardExpand all lines: packages/bolt-connection/src/connection-provider/connection-provider-routing.js+4-4Lines changed: 4 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
116 | 116 |
| |
117 | 117 |
| |
118 | 118 |
| |
119 |
| - | |
| 119 | + | |
120 | 120 |
| |
121 | 121 |
| |
122 | 122 |
| |
123 | 123 |
| |
124 |
| - | |
| 124 | + | |
125 | 125 |
| |
126 | 126 |
| |
127 | 127 |
| |
| |||
150 | 150 |
| |
151 | 151 |
| |
152 | 152 |
| |
153 |
| - | |
| 153 | + | |
154 | 154 |
| |
155 | 155 |
| |
156 | 156 |
| |
| |||
584 | 584 |
| |
585 | 585 |
| |
586 | 586 |
| |
587 |
| - | |
| 587 | + | |
588 | 588 |
| |
589 | 589 |
| |
590 | 590 |
| |
|
packages/bolt-connection/src/connection/connection-error-handler.js
Copy file name to clipboardExpand all lines: packages/bolt-connection/src/connection/connection-error-handler.js+10-11Lines changed: 10 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
26 | 26 |
| |
27 | 27 |
| |
28 | 28 |
| |
29 |
| - | |
| 29 | + | |
30 | 30 |
| |
31 | 31 |
| |
32 | 32 |
| |
33 | 33 |
| |
34 |
| - | |
| 34 | + | |
35 | 35 |
| |
36 | 36 |
| |
37 | 37 |
| |
38 | 38 |
| |
39 | 39 |
| |
40 | 40 |
| |
41 |
| - | |
| 41 | + | |
42 | 42 |
| |
43 | 43 |
| |
44 | 44 |
| |
45 | 45 |
| |
46 | 46 |
| |
47 |
| - | |
| 47 | + | |
48 | 48 |
| |
49 | 49 |
| |
50 | 50 |
| |
| |||
63 | 63 |
| |
64 | 64 |
| |
65 | 65 |
| |
66 |
| - | |
67 |
| - | |
| 66 | + | |
| 67 | + | |
68 | 68 |
| |
69 | 69 |
| |
70 | 70 |
| |
| |||
76 | 76 |
| |
77 | 77 |
| |
78 | 78 |
| |
79 |
| - | |
80 |
| - | |
81 |
| - | |
82 |
| - | |
83 |
| - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
84 | 83 |
| |
85 | 84 |
| |
86 | 85 |
| |
|
packages/bolt-connection/test/connection-provider/authentication-provider.test.js
Copy file name to clipboardExpand all lines: packages/bolt-connection/test/connection-provider/authentication-provider.test.js+9-2Lines changed: 9 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
16 | 16 |
| |
17 | 17 |
| |
18 | 18 |
| |
19 |
| - | |
| 19 | + | |
20 | 20 |
| |
21 | 21 |
| |
22 | 22 |
| |
| |||
642 | 642 |
| |
643 | 643 |
| |
644 | 644 |
| |
| 645 | + | |
| 646 | + | |
645 | 647 |
| |
646 | 648 |
| |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
647 | 654 |
| |
648 | 655 |
| |
649 | 656 |
| |
| |||
785 | 792 |
| |
786 | 793 |
| |
787 | 794 |
| |
788 |
| - | |
| 795 | + | |
789 | 796 |
| |
790 | 797 |
| |
791 | 798 |
| |
|
packages/bolt-connection/test/connection-provider/connection-provider-direct.test.js
Copy file name to clipboardExpand all lines: packages/bolt-connection/test/connection-provider/connection-provider-direct.test.js+22-2Lines changed: 22 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
20 | 20 |
| |
21 | 21 |
| |
22 | 22 |
| |
23 |
| - | |
| 23 | + | |
24 | 24 |
| |
25 | 25 |
| |
26 | 26 |
| |
| |||
209 | 209 |
| |
210 | 210 |
| |
211 | 211 |
| |
212 |
| - | |
| 212 | + | |
213 | 213 |
| |
214 | 214 |
| |
215 | 215 |
| |
| |||
246 | 246 |
| |
247 | 247 |
| |
248 | 248 |
| |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
249 | 269 |
| |
250 | 270 |
| |
251 | 271 |
| |
|
packages/bolt-connection/test/connection-provider/connection-provider-routing.test.js
Copy file name to clipboardExpand all lines: packages/bolt-connection/test/connection-provider/connection-provider-routing.test.js+51-3Lines changed: 51 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
26 | 26 |
| |
27 | 27 |
| |
28 | 28 |
| |
29 |
| - | |
| 29 | + | |
30 | 30 |
| |
31 | 31 |
| |
32 | 32 |
| |
| |||
1718 | 1718 |
| |
1719 | 1719 |
| |
1720 | 1720 |
| |
1721 |
| - | |
| 1721 | + | |
| 1722 | + | |
1722 | 1723 |
| |
1723 | 1724 |
| |
1724 | 1725 |
| |
| |||
1756 | 1757 |
| |
1757 | 1758 |
| |
1758 | 1759 |
| |
| 1760 | + | |
| 1761 | + | |
| 1762 | + | |
| 1763 | + | |
| 1764 | + | |
| 1765 | + | |
| 1766 | + | |
| 1767 | + | |
| 1768 | + | |
| 1769 | + | |
| 1770 | + | |
| 1771 | + | |
| 1772 | + | |
| 1773 | + | |
| 1774 | + | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
| 1789 | + | |
| 1790 | + | |
| 1791 | + | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
| 1796 | + | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
| 1800 | + | |
| 1801 | + | |
1759 | 1802 |
| |
1760 |
| - | |
| 1803 | + | |
| 1804 | + | |
1761 | 1805 |
| |
1762 | 1806 |
| |
1763 | 1807 |
| |
| |||
3944 | 3988 |
| |
3945 | 3989 |
| |
3946 | 3990 |
| |
| 3991 | + | |
| 3992 | + | |
| 3993 | + | |
| 3994 | + |
You can’t perform that action at this time.
0 commit comments