axiam-sdk 1.1.0 → 1.1.2
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/README.md +27 -2
- package/dist/amqp/index.d.cts +3 -2
- package/dist/amqp/index.d.ts +3 -2
- package/dist/{authzCore-BQfX9qxN.d.cts → authzCore-CqXzLNmT.d.cts} +4 -3
- package/dist/{authzCore-BlSHwGnW.d.ts → authzCore-D-hquWSI.d.ts} +4 -3
- package/dist/browser/index.d.cts +8 -7
- package/dist/browser/index.d.ts +8 -7
- package/dist/{client-7ZKtfXW-.d.cts → client-BGFn1VQh.d.cts} +34 -24
- package/dist/{client-Putxo-yi.d.ts → client-DrQZZ1js.d.ts} +34 -24
- package/dist/{cookieJar-Cw6Zdeec.d.ts → cookieJar-BTmpjXZe.d.ts} +9 -3
- package/dist/{cookieJar-DkGcIr-i.d.cts → cookieJar-BqYOnNN-.d.cts} +9 -3
- package/dist/{errors-DMIlw2lN.d.ts → errors-DZ3k8a8i.d.cts} +2 -1
- package/dist/{errors-DMIlw2lN.d.cts → errors-DZ3k8a8i.d.ts} +2 -1
- package/dist/{errors-VpViVRSx.d.ts → errors-RvGlTyUj.d.cts} +3 -2
- package/dist/{errors-CtP_lviy.d.cts → errors-dlGXAsbh.d.ts} +3 -2
- package/dist/grpc/index.d.cts +10 -9
- package/dist/grpc/index.d.ts +10 -9
- package/dist/grpc/index.js +68 -7
- package/dist/grpc/index.js.map +1 -1
- package/dist/grpc/index.mjs +68 -7
- package/dist/grpc/index.mjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +60 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +60 -7
- package/dist/index.mjs.map +1 -1
- package/dist/{jwks-BR55d7-Z.d.cts → jwks-CTVpOWzI.d.cts} +2 -1
- package/dist/{jwks-BR55d7-Z.d.ts → jwks-CTVpOWzI.d.ts} +2 -1
- package/dist/middleware/index.d.cts +13 -12
- package/dist/middleware/index.d.ts +13 -12
- package/dist/middleware/index.js +176 -31
- package/dist/middleware/index.js.map +1 -1
- package/dist/middleware/index.mjs +176 -31
- package/dist/middleware/index.mjs.map +1 -1
- package/dist/nestjs/index.d.cts +5 -4
- package/dist/nestjs/index.d.ts +5 -4
- package/dist/node/index.d.cts +10 -9
- package/dist/node/index.d.ts +10 -9
- package/dist/node/index.js +215 -29
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +215 -29
- package/dist/node/index.mjs.map +1 -1
- package/dist/{oidcState-Cz6erz0g.d.cts → oidcState-BaJ-SM_R.d.cts} +41 -9
- package/dist/{oidcState-zGt6VU6v.d.ts → oidcState-C3VLn3eD.d.ts} +41 -9
- package/dist/rest/index.d.cts +10 -9
- package/dist/rest/index.d.ts +10 -9
- package/dist/rest/index.js +60 -7
- package/dist/rest/index.js.map +1 -1
- package/dist/rest/index.mjs +60 -7
- package/dist/rest/index.mjs.map +1 -1
- package/dist/{revocationFeed-CDoD7Twr.d.cts → revocationFeed-KQhvMMl8.d.cts} +2 -1
- package/dist/{revocationFeed-CDoD7Twr.d.ts → revocationFeed-KQhvMMl8.d.ts} +2 -1
- package/dist/{session-CeG6P9GO.d.ts → session-B03NsqVs.d.ts} +19 -2
- package/dist/{session-BmjEMowX.d.cts → session-plDr4lFu.d.cts} +19 -2
- package/dist/{telemetry--0DwnNjV.d.cts → telemetry-Du0-zS5f.d.cts} +2 -1
- package/dist/{telemetry--0DwnNjV.d.ts → telemetry-Du0-zS5f.d.ts} +2 -1
- package/dist/{webauthnErrors-fLgfOflO.d.cts → webauthnErrors-m1LZiaRy.d.cts} +2 -1
- package/dist/{webauthnErrors-fLgfOflO.d.ts → webauthnErrors-m1LZiaRy.d.ts} +2 -1
- package/package.json +2 -2
package/dist/grpc/index.mjs
CHANGED
|
@@ -1073,6 +1073,24 @@ var SharedSession = class {
|
|
|
1073
1073
|
noCredentialsConfig() {
|
|
1074
1074
|
return { withCredentials: false };
|
|
1075
1075
|
}
|
|
1076
|
+
/**
|
|
1077
|
+
* Axios config for a request to an `/oauth2/*` endpoint (CONTRACT.md §12.1
|
|
1078
|
+
* rule 3, §14.6; C163-12): {@link noCredentialsConfig} and, in the browser
|
|
1079
|
+
* persona, the fetch adapter with `credentials: 'omit'`.
|
|
1080
|
+
*
|
|
1081
|
+
* `withCredentials: false` on axios's default XHR adapter is not enough: that
|
|
1082
|
+
* adapter sends a same-origin cookie regardless, so an app served from the
|
|
1083
|
+
* AXIAM origin would still present `axiam_*` on a token or device request.
|
|
1084
|
+
* The fetch adapter derives its `credentials` from `withCredentials: false`
|
|
1085
|
+
* (`'omit'`); `fetchOptions.credentials` is set as well for adapters that
|
|
1086
|
+
* read it.
|
|
1087
|
+
* `NodeSession` overrides this to {@link noCredentialsConfig}: its jar-free
|
|
1088
|
+
* agent pair is what keeps the cookies off there, and the fetch adapter
|
|
1089
|
+
* would bypass that pair.
|
|
1090
|
+
*/
|
|
1091
|
+
oauth2RequestConfig() {
|
|
1092
|
+
return { ...this.noCredentialsConfig(), adapter: "fetch", fetchOptions: { credentials: "omit" } };
|
|
1093
|
+
}
|
|
1076
1094
|
};
|
|
1077
1095
|
function resolveTenantHeaderValue(options) {
|
|
1078
1096
|
if (options.tenantSlug) {
|
|
@@ -1194,6 +1212,9 @@ function installCsrfInterceptor(axiosInstance, session) {
|
|
|
1194
1212
|
if (session.isForeignHost(config.url)) {
|
|
1195
1213
|
return config;
|
|
1196
1214
|
}
|
|
1215
|
+
if (isOAuth2Endpoint(config.url, session.baseUrl)) {
|
|
1216
|
+
return config;
|
|
1217
|
+
}
|
|
1197
1218
|
const method = (config.method ?? "get").toLowerCase();
|
|
1198
1219
|
const cookieString = typeof document !== "undefined" ? document.cookie : "";
|
|
1199
1220
|
const csrfToken = typeof document !== "undefined" ? csrfHeaderForMethod(method, cookieString) : csrfHeaderForMethod(method, session.csrfToken ? `axiam_csrf=${session.csrfToken}` : "");
|
|
@@ -1247,23 +1268,33 @@ function installRefreshInterceptor(axiosInstance, session) {
|
|
|
1247
1268
|
}
|
|
1248
1269
|
);
|
|
1249
1270
|
}
|
|
1250
|
-
function isOAuth2Endpoint(url) {
|
|
1271
|
+
function isOAuth2Endpoint(url, baseUrl) {
|
|
1251
1272
|
if (!url) {
|
|
1252
1273
|
return false;
|
|
1253
1274
|
}
|
|
1254
|
-
|
|
1255
|
-
|
|
1275
|
+
try {
|
|
1276
|
+
const base = new URL(baseUrl);
|
|
1277
|
+
let path = new URL(url, base).pathname;
|
|
1278
|
+
const prefix = base.pathname.replace(/\/+$/, "");
|
|
1279
|
+
if (prefix !== "" && path.startsWith(`${prefix}/`)) {
|
|
1280
|
+
path = path.slice(prefix.length);
|
|
1281
|
+
}
|
|
1282
|
+
return path.startsWith("/oauth2/");
|
|
1283
|
+
} catch {
|
|
1284
|
+
return false;
|
|
1285
|
+
}
|
|
1256
1286
|
}
|
|
1257
1287
|
function installDeviceTokenInterceptor(axiosInstance, session) {
|
|
1258
1288
|
axiosInstance.interceptors.request.use((config) => {
|
|
1259
1289
|
const deviceToken = session.deviceAccessToken;
|
|
1260
|
-
|
|
1290
|
+
const oauth2 = isOAuth2Endpoint(config.url, session.baseUrl);
|
|
1291
|
+
if (session.isForeignHost(config.url) || deviceToken === void 0 && !oauth2) {
|
|
1261
1292
|
return config;
|
|
1262
1293
|
}
|
|
1263
|
-
const noCred = session.noCredentialsConfig();
|
|
1294
|
+
const noCred = oauth2 ? session.oauth2RequestConfig() : session.noCredentialsConfig();
|
|
1264
1295
|
Object.assign(config, noCred);
|
|
1265
1296
|
config.headers = config.headers ?? {};
|
|
1266
|
-
if (
|
|
1297
|
+
if (oauth2) {
|
|
1267
1298
|
return config;
|
|
1268
1299
|
}
|
|
1269
1300
|
config.headers["Authorization"] = `Bearer ${deviceToken.expose()}`;
|
|
@@ -1754,6 +1785,7 @@ async function withRetry(fn, options) {
|
|
|
1754
1785
|
}
|
|
1755
1786
|
const retryAfterMs2 = isRetryAfterCarrier(err) ? err.retryAfterMs : void 0;
|
|
1756
1787
|
const delay = delayMs(attempt, retryAfterMs2, random());
|
|
1788
|
+
options.admit?.(delay);
|
|
1757
1789
|
options.telemetry?.emit({
|
|
1758
1790
|
type: "retry",
|
|
1759
1791
|
operation: options.operation ?? "unknown",
|
|
@@ -2283,7 +2315,10 @@ async function bareRequest(session, operation, config) {
|
|
|
2283
2315
|
// jar). Under the Node persona this is the jar-wrapped cookie agent, which
|
|
2284
2316
|
// `noCredentialsConfig()` below replaces with a plain one.
|
|
2285
2317
|
...defaults.httpsAgent !== void 0 ? { httpsAgent: defaults.httpsAgent } : {},
|
|
2286
|
-
|
|
2318
|
+
// The bare transport carries the RFC 7592 registration calls on `/oauth2/register/*`,
|
|
2319
|
+
// so it gets an `/oauth2/*` request's config: in the browser persona the fetch adapter
|
|
2320
|
+
// that omits credentials (C164-06; identical to `noCredentialsConfig()` under Node).
|
|
2321
|
+
...session.oauth2RequestConfig(),
|
|
2287
2322
|
withCredentials: false,
|
|
2288
2323
|
maxRedirects: 0,
|
|
2289
2324
|
validateStatus: () => true
|
|
@@ -3143,6 +3178,11 @@ function validateNetwork(network, problems) {
|
|
|
3143
3178
|
problems.push(`network segment ${q(profile.segment)} has more than one profile in the manifest`);
|
|
3144
3179
|
}
|
|
3145
3180
|
profiled.add(profile.segment);
|
|
3181
|
+
if (profile.terminationAction === null) {
|
|
3182
|
+
problems.push(
|
|
3183
|
+
`network profile of segment ${q(profile.segment)} states terminationAction as null; it has no "none" in a manifest (leave it out to keep the server default)`
|
|
3184
|
+
);
|
|
3185
|
+
}
|
|
3146
3186
|
}
|
|
3147
3187
|
}
|
|
3148
3188
|
function duplicates(kind, keys, problems) {
|
|
@@ -4100,11 +4140,24 @@ function profileDrifted(spec, read) {
|
|
|
4100
4140
|
if (spec.serviceType !== void 0 && !sameOptional(spec.serviceType, read.service_type)) return true;
|
|
4101
4141
|
return false;
|
|
4102
4142
|
}
|
|
4143
|
+
var KNOWN_TERMINATION_ACTIONS = ["default", "radius_request"];
|
|
4144
|
+
var KNOWN_SERVICE_TYPES = ["framed_user"];
|
|
4145
|
+
function refuseUnknownCarried(member, stated, read, known) {
|
|
4146
|
+
if (stated !== void 0 || read == null || known.includes(read)) return;
|
|
4147
|
+
throw new ValidationError(
|
|
4148
|
+
"manifest.plan",
|
|
4149
|
+
400,
|
|
4150
|
+
`network profile: ${member} was read as ${JSON.stringify(read)}, a value this SDK does not know, and the manifest does not state it; state ${member} to update this profile (CONTRACT.md \xA727.6.2 item 4)`,
|
|
4151
|
+
[{ field: member, message: `unknown value ${JSON.stringify(read)} on an unstated member` }]
|
|
4152
|
+
);
|
|
4153
|
+
}
|
|
4103
4154
|
function profileReplaceInput(spec, read) {
|
|
4104
4155
|
const profile = {
|
|
4105
4156
|
dictionary: read.dictionary,
|
|
4106
4157
|
session_timeout_secs: spec.sessionTimeoutSecs
|
|
4107
4158
|
};
|
|
4159
|
+
refuseUnknownCarried("termination_action", spec.terminationAction, read.termination_action, KNOWN_TERMINATION_ACTIONS);
|
|
4160
|
+
refuseUnknownCarried("service_type", spec.serviceType, read.service_type, KNOWN_SERVICE_TYPES);
|
|
4108
4161
|
const termination = spec.terminationAction === void 0 ? read.termination_action : spec.terminationAction;
|
|
4109
4162
|
if (termination != null) profile.termination_action = termination;
|
|
4110
4163
|
const idle = spec.idleTimeoutSecs === void 0 ? read.idle_timeout_secs : spec.idleTimeoutSecs;
|
|
@@ -8894,6 +8947,14 @@ var NodeSession = class extends SharedSession {
|
|
|
8894
8947
|
withCredentials: false
|
|
8895
8948
|
};
|
|
8896
8949
|
}
|
|
8950
|
+
/**
|
|
8951
|
+
* Overrides {@link SharedSession.oauth2RequestConfig}: under Node the
|
|
8952
|
+
* jar-free agent pair of {@link noCredentialsConfig} is what withholds the
|
|
8953
|
+
* cookies; the browser's fetch adapter (`credentials: 'omit'`) is not used.
|
|
8954
|
+
*/
|
|
8955
|
+
oauth2RequestConfig() {
|
|
8956
|
+
return this.noCredentialsConfig();
|
|
8957
|
+
}
|
|
8897
8958
|
/**
|
|
8898
8959
|
* Drives the actual `POST /api/v1/auth/refresh` HTTP call. Passed to this
|
|
8899
8960
|
* session's per-instance `refreshGuard` (inherited from SharedSession) by
|