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.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import * as grpc from '@grpc/grpc-js';
|
|
2
2
|
import { Interceptor } from '@grpc/grpc-js';
|
|
3
|
-
import { N as NodeSession } from '../cookieJar-
|
|
4
|
-
export { A as ACCESS_COOKIE, C as CSRF_COOKIE, R as REFRESH_COOKIE, T as TokenManager, c as createJar, a as createNodeClient, b as createNodeSession, e as extractCookieValue, w as wrapAxios } from '../cookieJar-
|
|
5
|
-
import {
|
|
3
|
+
import { N as NodeSession } from '../cookieJar-BTmpjXZe.js';
|
|
4
|
+
export { A as ACCESS_COOKIE, C as CSRF_COOKIE, R as REFRESH_COOKIE, T as TokenManager, c as createJar, a as createNodeClient, b as createNodeSession, e as extractCookieValue, w as wrapAxios } from '../cookieJar-BTmpjXZe.js';
|
|
5
|
+
import { Sensitive } from '../amqp/index.js';
|
|
6
6
|
import { a as AccessDecision } from '../types-BOX-6Srv.js';
|
|
7
|
-
import {
|
|
8
|
-
export { A as AxiamClaims, J as JWKS_PATH, V as Verifier, c as createVerifier } from '../jwks-
|
|
7
|
+
import { CnfClaim } from '../middleware/index.js';
|
|
8
|
+
export { A as AxiamClaims, J as JWKS_PATH, V as Verifier, c as createVerifier } from '../jwks-CTVpOWzI.js';
|
|
9
9
|
import 'axios';
|
|
10
10
|
import 'tough-cookie';
|
|
11
|
-
import '../session-
|
|
12
|
-
import '../telemetry
|
|
13
|
-
import '../client-
|
|
11
|
+
import '../session-B03NsqVs.js';
|
|
12
|
+
import '../telemetry-Du0-zS5f.js';
|
|
13
|
+
import '../client-DrQZZ1js.js';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Injects `authorization: Bearer <token>` (when a token is available) and
|
|
@@ -438,4 +438,5 @@ declare class TokenGrpcClient {
|
|
|
438
438
|
close(): void;
|
|
439
439
|
}
|
|
440
440
|
|
|
441
|
-
export { AccessDecision,
|
|
441
|
+
export { AccessDecision, AuthzGrpcClient, NodeSession, TokenGrpcClient, UserInfoGrpcClient, authInterceptor, buildAuthorizationServiceClient, buildTokenServiceClient, buildUserInfoServiceClient, callWithRefresh };
|
|
442
|
+
export type { AuthorizationServiceClientFactory, CheckAccessRequest, TokenIntrospection, TokenServiceClientFactory, TokenValidation, UserInfo, UserInfoServiceClientFactory, WireAuthorizationServiceClient, WireBatchCheckAccessRequest, WireBatchCheckAccessResponse, WireCheckAccessRequest, WireCheckAccessResponse, WireCnfClaim, WireGetUserInfoRequest, WireGetUserInfoResponse, WireIntrospectTokenRequest, WireIntrospectTokenResponse, WireRptPermission, WireTokenServiceClient, WireUserInfoServiceClient, WireValidateTokenRequest, WireValidateTokenResponse };
|
package/dist/grpc/index.js
CHANGED
|
@@ -1098,6 +1098,24 @@ var SharedSession = class {
|
|
|
1098
1098
|
noCredentialsConfig() {
|
|
1099
1099
|
return { withCredentials: false };
|
|
1100
1100
|
}
|
|
1101
|
+
/**
|
|
1102
|
+
* Axios config for a request to an `/oauth2/*` endpoint (CONTRACT.md §12.1
|
|
1103
|
+
* rule 3, §14.6; C163-12): {@link noCredentialsConfig} and, in the browser
|
|
1104
|
+
* persona, the fetch adapter with `credentials: 'omit'`.
|
|
1105
|
+
*
|
|
1106
|
+
* `withCredentials: false` on axios's default XHR adapter is not enough: that
|
|
1107
|
+
* adapter sends a same-origin cookie regardless, so an app served from the
|
|
1108
|
+
* AXIAM origin would still present `axiam_*` on a token or device request.
|
|
1109
|
+
* The fetch adapter derives its `credentials` from `withCredentials: false`
|
|
1110
|
+
* (`'omit'`); `fetchOptions.credentials` is set as well for adapters that
|
|
1111
|
+
* read it.
|
|
1112
|
+
* `NodeSession` overrides this to {@link noCredentialsConfig}: its jar-free
|
|
1113
|
+
* agent pair is what keeps the cookies off there, and the fetch adapter
|
|
1114
|
+
* would bypass that pair.
|
|
1115
|
+
*/
|
|
1116
|
+
oauth2RequestConfig() {
|
|
1117
|
+
return { ...this.noCredentialsConfig(), adapter: "fetch", fetchOptions: { credentials: "omit" } };
|
|
1118
|
+
}
|
|
1101
1119
|
};
|
|
1102
1120
|
function resolveTenantHeaderValue(options) {
|
|
1103
1121
|
if (options.tenantSlug) {
|
|
@@ -1219,6 +1237,9 @@ function installCsrfInterceptor(axiosInstance, session) {
|
|
|
1219
1237
|
if (session.isForeignHost(config.url)) {
|
|
1220
1238
|
return config;
|
|
1221
1239
|
}
|
|
1240
|
+
if (isOAuth2Endpoint(config.url, session.baseUrl)) {
|
|
1241
|
+
return config;
|
|
1242
|
+
}
|
|
1222
1243
|
const method = (config.method ?? "get").toLowerCase();
|
|
1223
1244
|
const cookieString = typeof document !== "undefined" ? document.cookie : "";
|
|
1224
1245
|
const csrfToken = typeof document !== "undefined" ? csrfHeaderForMethod(method, cookieString) : csrfHeaderForMethod(method, session.csrfToken ? `axiam_csrf=${session.csrfToken}` : "");
|
|
@@ -1272,23 +1293,33 @@ function installRefreshInterceptor(axiosInstance, session) {
|
|
|
1272
1293
|
}
|
|
1273
1294
|
);
|
|
1274
1295
|
}
|
|
1275
|
-
function isOAuth2Endpoint(url) {
|
|
1296
|
+
function isOAuth2Endpoint(url, baseUrl) {
|
|
1276
1297
|
if (!url) {
|
|
1277
1298
|
return false;
|
|
1278
1299
|
}
|
|
1279
|
-
|
|
1280
|
-
|
|
1300
|
+
try {
|
|
1301
|
+
const base = new URL(baseUrl);
|
|
1302
|
+
let path = new URL(url, base).pathname;
|
|
1303
|
+
const prefix = base.pathname.replace(/\/+$/, "");
|
|
1304
|
+
if (prefix !== "" && path.startsWith(`${prefix}/`)) {
|
|
1305
|
+
path = path.slice(prefix.length);
|
|
1306
|
+
}
|
|
1307
|
+
return path.startsWith("/oauth2/");
|
|
1308
|
+
} catch {
|
|
1309
|
+
return false;
|
|
1310
|
+
}
|
|
1281
1311
|
}
|
|
1282
1312
|
function installDeviceTokenInterceptor(axiosInstance, session) {
|
|
1283
1313
|
axiosInstance.interceptors.request.use((config) => {
|
|
1284
1314
|
const deviceToken = session.deviceAccessToken;
|
|
1285
|
-
|
|
1315
|
+
const oauth2 = isOAuth2Endpoint(config.url, session.baseUrl);
|
|
1316
|
+
if (session.isForeignHost(config.url) || deviceToken === void 0 && !oauth2) {
|
|
1286
1317
|
return config;
|
|
1287
1318
|
}
|
|
1288
|
-
const noCred = session.noCredentialsConfig();
|
|
1319
|
+
const noCred = oauth2 ? session.oauth2RequestConfig() : session.noCredentialsConfig();
|
|
1289
1320
|
Object.assign(config, noCred);
|
|
1290
1321
|
config.headers = config.headers ?? {};
|
|
1291
|
-
if (
|
|
1322
|
+
if (oauth2) {
|
|
1292
1323
|
return config;
|
|
1293
1324
|
}
|
|
1294
1325
|
config.headers["Authorization"] = `Bearer ${deviceToken.expose()}`;
|
|
@@ -1779,6 +1810,7 @@ async function withRetry(fn, options) {
|
|
|
1779
1810
|
}
|
|
1780
1811
|
const retryAfterMs2 = isRetryAfterCarrier(err) ? err.retryAfterMs : void 0;
|
|
1781
1812
|
const delay = delayMs(attempt, retryAfterMs2, random());
|
|
1813
|
+
options.admit?.(delay);
|
|
1782
1814
|
options.telemetry?.emit({
|
|
1783
1815
|
type: "retry",
|
|
1784
1816
|
operation: options.operation ?? "unknown",
|
|
@@ -2308,7 +2340,10 @@ async function bareRequest(session, operation, config) {
|
|
|
2308
2340
|
// jar). Under the Node persona this is the jar-wrapped cookie agent, which
|
|
2309
2341
|
// `noCredentialsConfig()` below replaces with a plain one.
|
|
2310
2342
|
...defaults.httpsAgent !== void 0 ? { httpsAgent: defaults.httpsAgent } : {},
|
|
2311
|
-
|
|
2343
|
+
// The bare transport carries the RFC 7592 registration calls on `/oauth2/register/*`,
|
|
2344
|
+
// so it gets an `/oauth2/*` request's config: in the browser persona the fetch adapter
|
|
2345
|
+
// that omits credentials (C164-06; identical to `noCredentialsConfig()` under Node).
|
|
2346
|
+
...session.oauth2RequestConfig(),
|
|
2312
2347
|
withCredentials: false,
|
|
2313
2348
|
maxRedirects: 0,
|
|
2314
2349
|
validateStatus: () => true
|
|
@@ -3168,6 +3203,11 @@ function validateNetwork(network, problems) {
|
|
|
3168
3203
|
problems.push(`network segment ${q(profile.segment)} has more than one profile in the manifest`);
|
|
3169
3204
|
}
|
|
3170
3205
|
profiled.add(profile.segment);
|
|
3206
|
+
if (profile.terminationAction === null) {
|
|
3207
|
+
problems.push(
|
|
3208
|
+
`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)`
|
|
3209
|
+
);
|
|
3210
|
+
}
|
|
3171
3211
|
}
|
|
3172
3212
|
}
|
|
3173
3213
|
function duplicates(kind, keys, problems) {
|
|
@@ -4125,11 +4165,24 @@ function profileDrifted(spec, read) {
|
|
|
4125
4165
|
if (spec.serviceType !== void 0 && !sameOptional(spec.serviceType, read.service_type)) return true;
|
|
4126
4166
|
return false;
|
|
4127
4167
|
}
|
|
4168
|
+
var KNOWN_TERMINATION_ACTIONS = ["default", "radius_request"];
|
|
4169
|
+
var KNOWN_SERVICE_TYPES = ["framed_user"];
|
|
4170
|
+
function refuseUnknownCarried(member, stated, read, known) {
|
|
4171
|
+
if (stated !== void 0 || read == null || known.includes(read)) return;
|
|
4172
|
+
throw new ValidationError(
|
|
4173
|
+
"manifest.plan",
|
|
4174
|
+
400,
|
|
4175
|
+
`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)`,
|
|
4176
|
+
[{ field: member, message: `unknown value ${JSON.stringify(read)} on an unstated member` }]
|
|
4177
|
+
);
|
|
4178
|
+
}
|
|
4128
4179
|
function profileReplaceInput(spec, read) {
|
|
4129
4180
|
const profile = {
|
|
4130
4181
|
dictionary: read.dictionary,
|
|
4131
4182
|
session_timeout_secs: spec.sessionTimeoutSecs
|
|
4132
4183
|
};
|
|
4184
|
+
refuseUnknownCarried("termination_action", spec.terminationAction, read.termination_action, KNOWN_TERMINATION_ACTIONS);
|
|
4185
|
+
refuseUnknownCarried("service_type", spec.serviceType, read.service_type, KNOWN_SERVICE_TYPES);
|
|
4133
4186
|
const termination = spec.terminationAction === void 0 ? read.termination_action : spec.terminationAction;
|
|
4134
4187
|
if (termination != null) profile.termination_action = termination;
|
|
4135
4188
|
const idle = spec.idleTimeoutSecs === void 0 ? read.idle_timeout_secs : spec.idleTimeoutSecs;
|
|
@@ -8919,6 +8972,14 @@ var NodeSession = class extends SharedSession {
|
|
|
8919
8972
|
withCredentials: false
|
|
8920
8973
|
};
|
|
8921
8974
|
}
|
|
8975
|
+
/**
|
|
8976
|
+
* Overrides {@link SharedSession.oauth2RequestConfig}: under Node the
|
|
8977
|
+
* jar-free agent pair of {@link noCredentialsConfig} is what withholds the
|
|
8978
|
+
* cookies; the browser's fetch adapter (`credentials: 'omit'`) is not used.
|
|
8979
|
+
*/
|
|
8980
|
+
oauth2RequestConfig() {
|
|
8981
|
+
return this.noCredentialsConfig();
|
|
8982
|
+
}
|
|
8922
8983
|
/**
|
|
8923
8984
|
* Drives the actual `POST /api/v1/auth/refresh` HTTP call. Passed to this
|
|
8924
8985
|
* session's per-instance `refreshGuard` (inherited from SharedSession) by
|