@sap/cds-dk 9.9.4 → 9.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/lib/mtx/auth_manager.js +30 -17
- package/lib/mtx/settings_manager.js +7 -4
- package/npm-shrinkwrap.json +16 -16
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,12 @@ This project adheres to [Semantic Versioning](https://semver.org/).
|
|
|
6
6
|
|
|
7
7
|
The format is based on [Keep a Changelog](https://keepachangelog.com/).
|
|
8
8
|
|
|
9
|
+
## Version 9.9.5 - 2026-08-24
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- `cds login` now uses the renamed login endpoints `/-/cds/login/grant` and `/-/cds/login/grant-metadata` with a legacy fallback, and updates saved legacy token URLs.
|
|
14
|
+
|
|
9
15
|
## Version 9.9.4 - 2026-07-31
|
|
10
16
|
|
|
11
17
|
### Changed
|
package/lib/mtx/auth_manager.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const cds = require('../cds');
|
|
2
|
-
const { SettingsManager } = require('./settings_manager');
|
|
2
|
+
const { SettingsManager, OAUTH_PATH, OAUTH_PATH_LEGACY_TOKEN } = require('./settings_manager');
|
|
3
3
|
const { ParamCollection } = require('./params');
|
|
4
4
|
const { getMessage } = require('./util/logging');
|
|
5
5
|
const { buildResponseError, buildNetworkError, parseResponseBody } = require('./util/request');
|
|
@@ -63,6 +63,32 @@ function reqParams(method, params) {
|
|
|
63
63
|
: { url: `${url}?${data}`, data: undefined, ignored };
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
async function postTokenTo(url, data, method, params) {
|
|
67
|
+
DEBUG?.(`Getting authentication token from ${method.toUpperCase()} ${params.obfuscateQueryParams(url)}`);
|
|
68
|
+
const response = await fetch(url, {
|
|
69
|
+
method: method.toUpperCase(),
|
|
70
|
+
body: data,
|
|
71
|
+
headers: { 'content-type': 'application/x-www-form-urlencoded' }
|
|
72
|
+
});
|
|
73
|
+
if (!response.ok) {
|
|
74
|
+
throw await buildResponseError(method, url, response);
|
|
75
|
+
}
|
|
76
|
+
return parseResponseBody(response);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
async function postToken(params, url, data, method) {
|
|
80
|
+
try {
|
|
81
|
+
return await postTokenTo(url, data, method, params);
|
|
82
|
+
} catch (e) {
|
|
83
|
+
if (e.status !== 404 || !url.includes(OAUTH_PATH)) {
|
|
84
|
+
throw e;
|
|
85
|
+
}
|
|
86
|
+
const legacyUrl = url.replace(OAUTH_PATH, OAUTH_PATH_LEGACY_TOKEN);
|
|
87
|
+
DEBUG?.(`Token endpoint not found, retrying against legacy path ${params.obfuscateQueryParams(legacyUrl)}`);
|
|
88
|
+
return postTokenTo(legacyUrl, data, method, params);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
66
92
|
async function fetchToken(params) {
|
|
67
93
|
if (params.has('token') || !(params.has('refreshToken') || params.has('passcode') || params.has('clientid') || !params.has('passcodeUrl'))) {
|
|
68
94
|
return;
|
|
@@ -75,25 +101,12 @@ async function fetchToken(params) {
|
|
|
75
101
|
if (Object.keys(ignored).length) {
|
|
76
102
|
console.log(`Ignoring parameters for fetching token: ${Object.entries(ignored).map(([param, reason]) => `${param} (${reason})`).join(', ')}.`);
|
|
77
103
|
}
|
|
78
|
-
DEBUG?.(`Getting authentication token from ${method.toUpperCase()} ${params.obfuscateQueryParams(url)}`);
|
|
79
104
|
error = undefined;
|
|
80
105
|
try {
|
|
81
|
-
|
|
82
|
-
method: method.toUpperCase(),
|
|
83
|
-
body: data,
|
|
84
|
-
headers: { 'content-type': 'application/x-www-form-urlencoded' }
|
|
85
|
-
});
|
|
86
|
-
if (!response.ok) {
|
|
87
|
-
throw await buildResponseError(method, url, response);
|
|
88
|
-
}
|
|
89
|
-
responseData = await parseResponseBody(response);
|
|
106
|
+
responseData = await postToken(params, url, data, method);
|
|
90
107
|
break;
|
|
91
108
|
} catch (e) {
|
|
92
|
-
|
|
93
|
-
error = e;
|
|
94
|
-
} else {
|
|
95
|
-
error = buildNetworkError(method, url, e);
|
|
96
|
-
}
|
|
109
|
+
error = e.status ? e : buildNetworkError(method, url, e);
|
|
97
110
|
DEBUG?.(`HTTP status ${error.status}`);
|
|
98
111
|
if (params.has('refreshToken')) {
|
|
99
112
|
DEBUG?.('Discarding invalid refresh token');
|
|
@@ -122,7 +135,7 @@ async function fetchToken(params) {
|
|
|
122
135
|
message += `. Ensure the client credentials are correct`;
|
|
123
136
|
}
|
|
124
137
|
} else {
|
|
125
|
-
message = '
|
|
138
|
+
message = 'token request failed';
|
|
126
139
|
}
|
|
127
140
|
throw new Error(message + '.', { cause: error });
|
|
128
141
|
}
|
|
@@ -35,8 +35,9 @@ const KEYRING_DESC = {
|
|
|
35
35
|
|
|
36
36
|
const MTX_FULLY_QUALIFIED = 'com.sap.cds.mtx';
|
|
37
37
|
const OAUTH_PATH_LEGACY = '/mtx/v1/oauth/token';
|
|
38
|
-
const
|
|
39
|
-
const
|
|
38
|
+
const OAUTH_PATH_LEGACY_TOKEN = '/-/cds/login/token';
|
|
39
|
+
const OAUTH_PATH = '/-/cds/login/grant';
|
|
40
|
+
const OAUTH_META_PATH = '/-/cds/login/grant-metadata';
|
|
40
41
|
|
|
41
42
|
const SETTINGS_DIR = path.join(os.homedir(), CONFIG_SUBDIRS[os.platform()] || '', MTX_FULLY_QUALIFIED);
|
|
42
43
|
const SETTINGS_FILE = 'projects.json';
|
|
@@ -295,7 +296,7 @@ class SettingsManager {
|
|
|
295
296
|
async function updateTokenUrl() {
|
|
296
297
|
const tokenUrl = secure(params.get('tokenUrl'), 'token URL');
|
|
297
298
|
const renewUrl = !logout && !params.get('skipToken')
|
|
298
|
-
&& (!tokenUrl || tokenUrl.includes('//-/cds') || tokenUrl.includes(OAUTH_PATH_LEGACY)
|
|
299
|
+
&& (!tokenUrl || tokenUrl.includes('//-/cds') || tokenUrl.includes(OAUTH_PATH_LEGACY) || tokenUrl.includes(OAUTH_PATH_LEGACY_TOKEN)
|
|
299
300
|
|| params.get('appUrl') !== loadedSettings.get('appUrl')
|
|
300
301
|
|| params.get('subdomain') !== loadedSettings.get('subdomain'));
|
|
301
302
|
if (renewUrl) {
|
|
@@ -719,5 +720,7 @@ class SettingsManager {
|
|
|
719
720
|
module.exports = {
|
|
720
721
|
SettingsManager,
|
|
721
722
|
other,
|
|
722
|
-
notifyLogin
|
|
723
|
+
notifyLogin,
|
|
724
|
+
OAUTH_PATH,
|
|
725
|
+
OAUTH_PATH_LEGACY_TOKEN
|
|
723
726
|
};
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap/cds-dk",
|
|
3
|
-
"version": "9.9.
|
|
3
|
+
"version": "9.9.5",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@sap/cds-dk",
|
|
9
|
-
"version": "9.9.
|
|
9
|
+
"version": "9.9.5",
|
|
10
10
|
"license": "SEE LICENSE IN LICENSE",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@cap-js/asyncapi": "^1.0.0",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
55
|
"node_modules/@cap-js/openapi": {
|
|
56
|
-
"version": "1.
|
|
57
|
-
"integrity": "sha512-
|
|
56
|
+
"version": "1.6.0",
|
|
57
|
+
"integrity": "sha512-1Knrn9dU3CBAlKRlhTzZTlzbg1IULbUV39mvhcuDZrgMhSWhJ3OuJVcNWtMClq+VkUeYTkMYpysbPqrMRoeEdw==",
|
|
58
58
|
"license": "Apache-2.0",
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"pluralize": "^8.0.0"
|
|
@@ -151,8 +151,8 @@
|
|
|
151
151
|
}
|
|
152
152
|
},
|
|
153
153
|
"node_modules/@sap/cds-mtxs": {
|
|
154
|
-
"version": "3.9.
|
|
155
|
-
"integrity": "sha512
|
|
154
|
+
"version": "3.9.6",
|
|
155
|
+
"integrity": "sha512-/eTldcrM9nc5orKJxqdrAiWvO5WcFoZWb1WH0DczWxX3abPJvD+0otHDeA9Uc5XP4ecFQ51bc4ZjR01lfXW1ew==",
|
|
156
156
|
"license": "SEE LICENSE IN LICENSE",
|
|
157
157
|
"dependencies": {
|
|
158
158
|
"@sap/hdi-deploy": "^5"
|
|
@@ -217,8 +217,8 @@
|
|
|
217
217
|
}
|
|
218
218
|
},
|
|
219
219
|
"node_modules/@sap/xsenv": {
|
|
220
|
-
"version": "6.2.
|
|
221
|
-
"integrity": "sha512-
|
|
220
|
+
"version": "6.2.2",
|
|
221
|
+
"integrity": "sha512-SGn+yaVKeXND/rQaQhqTZC+M6g5ASW1YnqAdQiZqNL74E1T1kUsDHttgOjQNkLObMZ0fsxgQxRPMnuVcAgIODg==",
|
|
222
222
|
"license": "SEE LICENSE IN LICENSE",
|
|
223
223
|
"dependencies": {
|
|
224
224
|
"debug": "4.4.3",
|
|
@@ -332,8 +332,8 @@
|
|
|
332
332
|
}
|
|
333
333
|
},
|
|
334
334
|
"node_modules/body-parser/node_modules/content-type": {
|
|
335
|
-
"version": "2.
|
|
336
|
-
"integrity": "sha512-
|
|
335
|
+
"version": "2.1.0",
|
|
336
|
+
"integrity": "sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag==",
|
|
337
337
|
"license": "MIT",
|
|
338
338
|
"engines": {
|
|
339
339
|
"node": ">=18"
|
|
@@ -841,8 +841,8 @@
|
|
|
841
841
|
}
|
|
842
842
|
},
|
|
843
843
|
"node_modules/hdb": {
|
|
844
|
-
"version": "2.29.
|
|
845
|
-
"integrity": "sha512-
|
|
844
|
+
"version": "2.29.6",
|
|
845
|
+
"integrity": "sha512-I9AQxpTn6OKm66rzzNWbJeKnxn1ylJinzSsq0J1O0HOwxv3VNuwQttKem2/DG/Sv/yRIU20dBiqZTqXjqs6Eog==",
|
|
846
846
|
"license": "Apache-2.0",
|
|
847
847
|
"dependencies": {
|
|
848
848
|
"iconv-lite": "0.7.0"
|
|
@@ -1630,8 +1630,8 @@
|
|
|
1630
1630
|
}
|
|
1631
1631
|
},
|
|
1632
1632
|
"node_modules/type-is/node_modules/content-type": {
|
|
1633
|
-
"version": "2.
|
|
1634
|
-
"integrity": "sha512-
|
|
1633
|
+
"version": "2.1.0",
|
|
1634
|
+
"integrity": "sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag==",
|
|
1635
1635
|
"license": "MIT",
|
|
1636
1636
|
"engines": {
|
|
1637
1637
|
"node": ">=18"
|
|
@@ -1699,8 +1699,8 @@
|
|
|
1699
1699
|
"license": "ISC"
|
|
1700
1700
|
},
|
|
1701
1701
|
"node_modules/ws": {
|
|
1702
|
-
"version": "8.21.
|
|
1703
|
-
"integrity": "sha512
|
|
1702
|
+
"version": "8.21.3",
|
|
1703
|
+
"integrity": "sha512-201TZ/kPWxoPr/OKWjquZR1SWKXcvxdH+e1xrx89b3YbmzLMFCLfnaG1HFIgWzJOEWZ7MvpK++odZufgYR50Rw==",
|
|
1704
1704
|
"license": "MIT",
|
|
1705
1705
|
"engines": {
|
|
1706
1706
|
"node": ">=10.0.0"
|