@webex/webex-core 3.12.0 → 3.13.0-next.10
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/.repo-context.json +653 -0
- package/.sdd/manifest.json +615 -0
- package/AGENTS.md +209 -0
- package/README.md +6 -3
- package/dist/config.js +46 -1
- package/dist/config.js.map +1 -1
- package/dist/credentials-config.js +21 -1
- package/dist/credentials-config.js.map +1 -1
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -1
- package/dist/interceptors/auth.js +10 -1
- package/dist/interceptors/auth.js.map +1 -1
- package/dist/interceptors/catalog-url.js +87 -0
- package/dist/interceptors/catalog-url.js.map +1 -0
- package/dist/interceptors/payload-transformer.js +25 -4
- package/dist/interceptors/payload-transformer.js.map +1 -1
- package/dist/lib/batcher.js +23 -7
- package/dist/lib/batcher.js.map +1 -1
- package/dist/lib/credentials/credentials.js +117 -5
- package/dist/lib/credentials/credentials.js.map +1 -1
- package/dist/lib/credentials/token.js +23 -9
- package/dist/lib/credentials/token.js.map +1 -1
- package/dist/lib/domains.js +90 -0
- package/dist/lib/domains.js.map +1 -0
- package/dist/lib/interceptors/service.js +5 -1
- package/dist/lib/interceptors/service.js.map +1 -1
- package/dist/lib/services/catalog-auth.js +114 -0
- package/dist/lib/services/catalog-auth.js.map +1 -0
- package/dist/lib/services/service-catalog.js +108 -18
- package/dist/lib/services/service-catalog.js.map +1 -1
- package/dist/lib/services/services.js +287 -40
- package/dist/lib/services/services.js.map +1 -1
- package/dist/lib/services-v2/service-catalog.js +14 -13
- package/dist/lib/services-v2/service-catalog.js.map +1 -1
- package/dist/lib/services-v2/services-v2.js +294 -44
- package/dist/lib/services-v2/services-v2.js.map +1 -1
- package/dist/lib/static-asset-loader.js +153 -0
- package/dist/lib/static-asset-loader.js.map +1 -0
- package/dist/plugins/logger.js +1 -1
- package/dist/webex-core.js +11 -3
- package/dist/webex-core.js.map +1 -1
- package/docs/adr/index.md +32 -0
- package/docs/architecture.md +298 -0
- package/docs/getting-started.md +96 -0
- package/docs/index.md +55 -0
- package/docs/specs/README.md +76 -0
- package/package.json +13 -13
- package/schemas/repo-context.schema.json +796 -0
- package/src/config.js +50 -1
- package/src/credentials-config.js +22 -0
- package/src/docs/README.md +732 -0
- package/src/index.js +2 -0
- package/src/interceptors/auth.js +14 -1
- package/src/interceptors/catalog-url.js +66 -0
- package/src/interceptors/docs/README.md +658 -0
- package/src/interceptors/payload-transformer.js +23 -1
- package/src/lib/batcher.js +25 -10
- package/src/lib/credentials/credentials.js +106 -4
- package/src/lib/credentials/docs/README.md +847 -0
- package/src/lib/credentials/token.js +15 -8
- package/src/lib/domains.ts +94 -0
- package/src/lib/interceptors/service.js +11 -3
- package/src/lib/services/catalog-auth.js +112 -0
- package/src/lib/services/docs/README.md +737 -0
- package/src/lib/services/service-catalog.js +112 -16
- package/src/lib/services/services.js +274 -24
- package/src/lib/services-v2/docs/README.md +751 -0
- package/src/lib/services-v2/service-catalog.ts +16 -12
- package/src/lib/services-v2/services-v2.ts +282 -26
- package/src/lib/static-asset-loader.ts +128 -0
- package/src/lib/storage/docs/README.md +646 -0
- package/src/webex-core.js +8 -0
- package/test/fixtures/activation-email.ts +22 -0
- package/test/integration/spec/credentials/credentials.js +3 -1
- package/test/integration/spec/credentials/token.js +8 -0
- package/test/integration/spec/services/service-catalog.js +5 -0
- package/test/integration/spec/services/services.js +183 -112
- package/test/integration/spec/services-v2/services-v2.js +169 -98
- package/test/integration/spec/unit-browser/token.js +7 -2
- package/test/unit/spec/credentials/credentials.js +326 -3
- package/test/unit/spec/credentials/token.js +259 -6
- package/test/unit/spec/interceptors/auth.js +92 -1
- package/test/unit/spec/interceptors/catalog-url.js +224 -0
- package/test/unit/spec/interceptors/payload-transformer.js +119 -1
- package/test/unit/spec/lib/batcher.js +56 -0
- package/test/unit/spec/services/interceptors/service.js +35 -1
- package/test/unit/spec/services/service-catalog.js +368 -11
- package/test/unit/spec/services/services.js +783 -10
- package/test/unit/spec/services-v2/service-catalog.ts +134 -11
- package/test/unit/spec/services-v2/services-v2.ts +825 -10
- package/test/unit/spec/static-asset-loader.ts +224 -0
- package/test/unit/spec/webex-core.js +77 -1
package/AGENTS.md
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
<!-- sdd-generated-metadata
|
|
2
|
+
doc_kind: agent-entry
|
|
3
|
+
generated_from: agents@0.3.0
|
|
4
|
+
generated_by: claude-code
|
|
5
|
+
approved_by: rsarika@cisco.com
|
|
6
|
+
updated_at: 2026-10-07T13:20:21Z
|
|
7
|
+
validation_status: pass-with-warnings
|
|
8
|
+
-->
|
|
9
|
+
|
|
10
|
+
# AI Agent Instructions
|
|
11
|
+
|
|
12
|
+
Instructions for AI coding assistants working on `@webex/webex-core`, the core library of the Webex JS
|
|
13
|
+
SDK: the plugin host, request interceptors, credentials, service discovery and storage layer.
|
|
14
|
+
|
|
15
|
+
## Working Method
|
|
16
|
+
|
|
17
|
+
- Read the relevant repository files before editing. Do not edit blind.
|
|
18
|
+
- Understand the task and affected surfaces before writing code.
|
|
19
|
+
- Prefer focused edits over rewriting whole files.
|
|
20
|
+
- Do not invent commands, paths, exports, or behavior. Verify them from repository-local source.
|
|
21
|
+
- Test or validate before declaring done.
|
|
22
|
+
- Keep output concise. If something is uncertain, say so instead of guessing.
|
|
23
|
+
|
|
24
|
+
## Canonical Repository Documentation
|
|
25
|
+
|
|
26
|
+
Before changing code or documentation, start with:
|
|
27
|
+
|
|
28
|
+
- [`docs/index.md`](docs/index.md) for documentation navigation;
|
|
29
|
+
- [`docs/architecture.md`](docs/architecture.md) for package boundaries, dependencies and the contract index;
|
|
30
|
+
- [`docs/specs/README.md`](docs/specs/README.md) for the manifest-backed module and contract registry;
|
|
31
|
+
- the affected module's manifest-routed specification:
|
|
32
|
+
[`src`](src/docs/README.md), [`src/interceptors`](src/interceptors/docs/README.md),
|
|
33
|
+
[`src/lib/credentials`](src/lib/credentials/docs/README.md),
|
|
34
|
+
[`src/lib/services`](src/lib/services/docs/README.md),
|
|
35
|
+
[`src/lib/services-v2`](src/lib/services-v2/docs/README.md),
|
|
36
|
+
[`src/lib/storage`](src/lib/storage/docs/README.md); and
|
|
37
|
+
- [`docs/adr/index.md`](docs/adr/index.md) for durable decisions. None are registered yet.
|
|
38
|
+
|
|
39
|
+
Follow `.sdd/manifest.json` for each contract's publication state and canonical source. The package
|
|
40
|
+
publishes SDK contracts whose native source is the npm entry point declared in `package.json` and the
|
|
41
|
+
barrel `src/index.js`; there is no OpenAPI document because the package serves no HTTP. The manifest
|
|
42
|
+
remains authoritative for canonical paths and artifact decisions. Dependency packages that have their
|
|
43
|
+
own specifications (`@webex/http-core`, `@webex/common`, `@webex/common-timers`,
|
|
44
|
+
`@webex/storage-adapter-spec`) should be read through those specifications first.
|
|
45
|
+
|
|
46
|
+
## 1. Commands (Run First)
|
|
47
|
+
|
|
48
|
+
Run every command from the Webex JS SDK workspace root. Use only documented commands.
|
|
49
|
+
|
|
50
|
+
| Task | Command |
|
|
51
|
+
| --- | --- |
|
|
52
|
+
| Install dependencies | `yarn` |
|
|
53
|
+
| Start dev environment | N/A — the package is a library with no runnable entry point |
|
|
54
|
+
| Run tests | `yarn workspace @webex/webex-core test:unit` |
|
|
55
|
+
| Run linters | `yarn workspace @webex/webex-core test:style` |
|
|
56
|
+
| Build/release artifact | `yarn workspace @webex/webex-core build:src` |
|
|
57
|
+
| Format code | N/A — no package-local format command; Prettier configuration is owned at the workspace root |
|
|
58
|
+
| Integration tests (mocha) | `yarn workspace @webex/webex-core test:integration` |
|
|
59
|
+
| Browser tests (karma) | `yarn workspace @webex/webex-core test:browser` |
|
|
60
|
+
| Run one unit file | `yarn workspace @webex/webex-core test:unit --targets <path relative to test/unit/spec>` |
|
|
61
|
+
| Publish | `yarn workspace @webex/webex-core deploy:npm` |
|
|
62
|
+
|
|
63
|
+
The repository requires Node 22.14; the package itself declares
|
|
64
|
+
`engines.node >=18`. The aggregate `test` script chains lint, unit, integration and browser tiers, so it
|
|
65
|
+
needs provisioned test users and live services. `build` delegates to `build:src`; no command builds and
|
|
66
|
+
tests together. If a required command is unknown, stop and ask for the exact command.
|
|
67
|
+
|
|
68
|
+
## 2. Agent Persona and Scope
|
|
69
|
+
|
|
70
|
+
You are the engineering assistant for `@webex/webex-core`, the package every other Webex SDK plugin
|
|
71
|
+
registers into and sends requests through.
|
|
72
|
+
|
|
73
|
+
Primary outcomes:
|
|
74
|
+
|
|
75
|
+
- Deliver production-safe changes with passing tests.
|
|
76
|
+
- Preserve existing behavior unless a change request explicitly requires a behavior change.
|
|
77
|
+
- Keep docs and configuration aligned with code changes.
|
|
78
|
+
|
|
79
|
+
Definition of done:
|
|
80
|
+
|
|
81
|
+
1. Requested change is implemented.
|
|
82
|
+
2. Relevant tests/lint/build checks pass locally.
|
|
83
|
+
3. Updated docs/config cover new behavior.
|
|
84
|
+
4. PR summary includes risks and rollback notes.
|
|
85
|
+
|
|
86
|
+
## 3. Repository Knowledge
|
|
87
|
+
|
|
88
|
+
### Tech Stack
|
|
89
|
+
|
|
90
|
+
| Area | Tooling | Version |
|
|
91
|
+
| --- | --- | --- |
|
|
92
|
+
| Language runtime | Node.js | `>=18` (`package.json` engines) |
|
|
93
|
+
| Language | JavaScript with TypeScript in `src/lib/services-v2` and `src/lib/domains.ts` | `package.json` |
|
|
94
|
+
| Build tool | `@webex/legacy-tools` (`webex-legacy-tools build`) | workspace |
|
|
95
|
+
| Test framework | Jest (unit), Mocha (integration), Karma (browser) | `jest.config.js`, `package.json` |
|
|
96
|
+
| Lint/format | ESLint via `@webex/eslint-config-legacy`; Prettier | `^8.24.0` / `^2.7.1` (`package.json`) |
|
|
97
|
+
|
|
98
|
+
### Project Map
|
|
99
|
+
|
|
100
|
+
- `src/index.js`: package entry point and export barrel; its import order is load-bearing.
|
|
101
|
+
- `src/webex-core.js`, `src/webex-internal-core.js`: the `WebexCore` class, plugin registration and interceptor-chain assembly.
|
|
102
|
+
- `src/config.js`, `src/credentials-config.js`: default configuration; several defaults read environment variables at import time.
|
|
103
|
+
- `src/interceptors/`: sixteen request/response interceptors. Has its own specification.
|
|
104
|
+
- `src/lib/credentials/`: OAuth token lifecycle. Has its own specification.
|
|
105
|
+
- `src/lib/services/` and `src/lib/interceptors/`: v1 service discovery and its interceptors. Has its own specification.
|
|
106
|
+
- `src/lib/services-v2/`: opt-in v2 service discovery in TypeScript. Has its own specification.
|
|
107
|
+
- `src/lib/storage/`: `@persist` decorators, store factories and the in-memory adapter. Has its own specification.
|
|
108
|
+
- `src/lib/batcher.js`, `src/lib/page.js`, `src/lib/webex-http-error.js`, `src/lib/webex-plugin.js`: shared helpers and plugin base classes.
|
|
109
|
+
- `test/unit/`: Jest unit tests; `test/integration/`: Mocha and Karma tests needing test users and live services.
|
|
110
|
+
|
|
111
|
+
### Critical Constraints
|
|
112
|
+
|
|
113
|
+
- **Import order in `src/index.js` is load-bearing.** Services and credentials are loaded inside core so they initialize before consumer plugins; do not move them into outside plugins or reorder the imports.
|
|
114
|
+
- **Plugin registration is process-global and first-wins.** A duplicate `registerPlugin` name is silently ignored unless `replace` is set; v2 services only activates through such a replace.
|
|
115
|
+
- **`config.interceptors` replaces the whole interceptor chain**, including interceptors registered by plugins.
|
|
116
|
+
- **Tokens are persisted as plaintext JSON.** Never log tokens or weaken the allow-list that decides which hosts receive a bearer token.
|
|
117
|
+
- **Exported names, event names and config keys are public.** 49 workspace packages declare a dependency on this package; removing or renaming one is a breaking change.
|
|
118
|
+
- **Dependent packages resolve this package through `dist`.** Rebuild with `build:src` before trusting a dependent package's tests.
|
|
119
|
+
|
|
120
|
+
## 4. Testing Workflow
|
|
121
|
+
|
|
122
|
+
Run checks in this order:
|
|
123
|
+
|
|
124
|
+
1. `yarn workspace @webex/webex-core test:unit`
|
|
125
|
+
2. `yarn workspace @webex/webex-core test:style`
|
|
126
|
+
3. `yarn workspace @webex/webex-core test:integration` (requires provisioned test users and live services)
|
|
127
|
+
|
|
128
|
+
Testing rules:
|
|
129
|
+
|
|
130
|
+
- Add or update tests for every behavior change.
|
|
131
|
+
- Cover failure paths and edge cases, not only happy paths.
|
|
132
|
+
- Do not remove tests to make CI pass.
|
|
133
|
+
- Use sinon for stubs, `assert` from `@webex/test-helper-chai`, and fake timers for time-dependent code.
|
|
134
|
+
|
|
135
|
+
This package defines no coverage threshold; the repository owner confirmed there is no coverage gate
|
|
136
|
+
for it. Do not infer one from a platform or CI default.
|
|
137
|
+
|
|
138
|
+
## 5. Code Style and Patterns
|
|
139
|
+
|
|
140
|
+
Coding expectations:
|
|
141
|
+
|
|
142
|
+
- Follow repository style rules and static analysis output.
|
|
143
|
+
- Prefer small, composable functions over large procedural blocks.
|
|
144
|
+
- Make error handling explicit at system boundaries.
|
|
145
|
+
- Keep public interfaces stable unless a breaking change is requested.
|
|
146
|
+
- Before adding a literal path, filename, command, workflow identifier, status,
|
|
147
|
+
or other policy value, search the repository for exact and semantically
|
|
148
|
+
equivalent uses. When repeated production values represent one shared
|
|
149
|
+
contract, move them to the narrowest owning shared module or catalog as one
|
|
150
|
+
canonical named constant, enum, or type and update consumers. Keep incidental
|
|
151
|
+
similarities, one-off implementation details, and independent test fixtures
|
|
152
|
+
local.
|
|
153
|
+
- Do not import a default, named, object, or namespace binding and immediately
|
|
154
|
+
re-export it. Consumers should import from the owning module; package barrels
|
|
155
|
+
should use direct named re-exports.
|
|
156
|
+
- Do not write inline runtime `typeof` checks outside descriptively named guard
|
|
157
|
+
implementations. Import and reuse the owning guard instead; TypeScript
|
|
158
|
+
type-position `typeof` queries remain allowed.
|
|
159
|
+
|
|
160
|
+
Pattern example:
|
|
161
|
+
|
|
162
|
+
```text
|
|
163
|
+
Preferred:
|
|
164
|
+
- Validate external input close to the boundary.
|
|
165
|
+
- Return typed/structured results.
|
|
166
|
+
- Include actionable error messages.
|
|
167
|
+
|
|
168
|
+
Avoid:
|
|
169
|
+
- Passing unvalidated payloads deep into the system.
|
|
170
|
+
- Swallowing exceptions or returning ambiguous null values.
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## 6. Git Workflow
|
|
174
|
+
|
|
175
|
+
- Branch naming: no repository-enforced rule was found; use a short descriptive prefix such as `feature/`, `fix/` or `chore/`
|
|
176
|
+
- Commit format: conventional commits (`feat:`, `fix:`, `docs:`, `refactor:`, `test:`, `chore:`)
|
|
177
|
+
- Keep commits focused and reversible.
|
|
178
|
+
- Rebase on the target branch before opening PR.
|
|
179
|
+
|
|
180
|
+
PR checklist:
|
|
181
|
+
|
|
182
|
+
- What changed and why.
|
|
183
|
+
- Tests run and results.
|
|
184
|
+
- Risk/impact areas.
|
|
185
|
+
- Rollback approach.
|
|
186
|
+
|
|
187
|
+
## 7. Boundaries and Escalation
|
|
188
|
+
|
|
189
|
+
### Always
|
|
190
|
+
|
|
191
|
+
- Prefer existing patterns over introducing new architecture.
|
|
192
|
+
- Keep changes minimal for the requested scope.
|
|
193
|
+
- Call out assumptions and unknowns explicitly.
|
|
194
|
+
|
|
195
|
+
### Ask First
|
|
196
|
+
|
|
197
|
+
- Adding new dependencies or external services.
|
|
198
|
+
- Large refactors or schema migrations.
|
|
199
|
+
- Security-sensitive changes (auth, token handling, persistence, allowed-domain logic).
|
|
200
|
+
- Any change to exported names, event names, config keys or the interceptor order.
|
|
201
|
+
- Any destructive data or infrastructure operation.
|
|
202
|
+
|
|
203
|
+
### Never
|
|
204
|
+
|
|
205
|
+
- Commit secrets, keys, or credentials.
|
|
206
|
+
- Bypass required checks by disabling tests or linters.
|
|
207
|
+
- Rewrite history on shared branches.
|
|
208
|
+
- Change unrelated files "while here" without clear need.
|
|
209
|
+
- Edit `.sdd/templates/repo-standards` or `dist` by hand.
|
package/README.md
CHANGED
|
@@ -78,8 +78,11 @@ const webex = new WebexCore({
|
|
|
78
78
|
// Validate domains against the allowed domains
|
|
79
79
|
validateDomains: true,
|
|
80
80
|
|
|
81
|
-
// The allowed domains to validate domains against
|
|
82
|
-
|
|
81
|
+
// The allowed domains to validate domains against. Each entry is a
|
|
82
|
+
// hostname, matched on label boundaries: an entry allows that host and
|
|
83
|
+
// its subdomains, so 'example.com' covers 'api.example.com' but not
|
|
84
|
+
// 'notexample.com'.
|
|
85
|
+
allowedDomains: ['example.com']
|
|
83
86
|
}
|
|
84
87
|
}
|
|
85
88
|
});
|
|
@@ -89,7 +92,7 @@ const webex = new WebexCore({
|
|
|
89
92
|
|
|
90
93
|
The default configuration includes the following service urls:
|
|
91
94
|
|
|
92
|
-
- `U2C_SERVICE_URL` [U2C] - `https://u2c.
|
|
95
|
+
- `U2C_SERVICE_URL` [U2C] - `https://u2c.svc.webex.com/u2c/api/v1`
|
|
93
96
|
- `HYDRA_SERVICE_URL` [Hydra] - `https://webexapis.com/v1`
|
|
94
97
|
- `SQDISCOVERY_SERVICE_URL` [SQDISCOVERY] - `https://ds.ciscospark.com/v1/region`
|
|
95
98
|
|
package/dist/config.js
CHANGED
|
@@ -22,6 +22,13 @@ var _default = exports.default = {
|
|
|
22
22
|
trackingIdSuffix: '',
|
|
23
23
|
AlternateLogger: undefined,
|
|
24
24
|
credentials: new _credentialsConfig.default(),
|
|
25
|
+
/**
|
|
26
|
+
* Explicitly selects the Webex environment. When omitted, the environment is inferred from the
|
|
27
|
+
* U2C discovery URL.
|
|
28
|
+
*
|
|
29
|
+
* @type {'integration'|'production'|undefined}
|
|
30
|
+
*/
|
|
31
|
+
environment: undefined,
|
|
25
32
|
fedramp: process.env.ENABLE_FEDRAMP || false,
|
|
26
33
|
services: {
|
|
27
34
|
/**
|
|
@@ -31,6 +38,30 @@ var _default = exports.default = {
|
|
|
31
38
|
* @type {boolean}
|
|
32
39
|
*/
|
|
33
40
|
useUserOnboardingServiceForActivations: false,
|
|
41
|
+
/**
|
|
42
|
+
* When true, requests the U2C catalog override.
|
|
43
|
+
*
|
|
44
|
+
* @type {boolean}
|
|
45
|
+
*/
|
|
46
|
+
useCatalogOverride: false,
|
|
47
|
+
/**
|
|
48
|
+
* When true, skips fetching the preauth catalog during initialization
|
|
49
|
+
* while the user is unauthenticated (no existing token). The catalog is
|
|
50
|
+
* expected to be collected manually later instead. When false (default),
|
|
51
|
+
* the preauth catalog is collected automatically during init.
|
|
52
|
+
*
|
|
53
|
+
* @type {boolean}
|
|
54
|
+
*/
|
|
55
|
+
skipPreauthCatalogOnUnauthenticated: false,
|
|
56
|
+
/**
|
|
57
|
+
* Maximum time (in milliseconds) to wait for the initial service catalog
|
|
58
|
+
* collection when `waitForCatalogInit` is enabled, before letting
|
|
59
|
+
* `services.ready` (and therefore `webex.ready`) fire anyway. Prevents a
|
|
60
|
+
* hung catalog request from leaving the app on a permanent spinner.
|
|
61
|
+
*
|
|
62
|
+
* @type {number}
|
|
63
|
+
*/
|
|
64
|
+
catalogInitTimeout: 15000,
|
|
34
65
|
/**
|
|
35
66
|
* A list of services that are available prior to catalog collection.
|
|
36
67
|
*
|
|
@@ -52,7 +83,7 @@ var _default = exports.default = {
|
|
|
52
83
|
*
|
|
53
84
|
* @type {string}
|
|
54
85
|
*/
|
|
55
|
-
u2c: process.env.U2C_SERVICE_URL || 'https://u2c.
|
|
86
|
+
u2c: process.env.U2C_SERVICE_URL || 'https://u2c.svc.webex.com/u2c/api/v1'
|
|
56
87
|
},
|
|
57
88
|
/**
|
|
58
89
|
* When true, considers all urls in `allowedDomains` as safe for auth tokens
|
|
@@ -60,6 +91,15 @@ var _default = exports.default = {
|
|
|
60
91
|
* @type {boolean}
|
|
61
92
|
*/
|
|
62
93
|
validateDomains: true,
|
|
94
|
+
/**
|
|
95
|
+
* When true, enables the CatalogUrlInterceptor which validates that all
|
|
96
|
+
* outbound request URLs are in the service catalog or allowed domains.
|
|
97
|
+
* This prevents SSRF attacks where attacker-controlled URLs could be
|
|
98
|
+
* sent to the SDK.
|
|
99
|
+
*
|
|
100
|
+
* @type {boolean}
|
|
101
|
+
*/
|
|
102
|
+
validateCatalogUrls: false,
|
|
63
103
|
/**
|
|
64
104
|
* services that don't need auth validation
|
|
65
105
|
*/
|
|
@@ -90,6 +130,11 @@ var _default = exports.default = {
|
|
|
90
130
|
cacheU2C: false
|
|
91
131
|
},
|
|
92
132
|
payloadTransformer: {
|
|
133
|
+
/**
|
|
134
|
+
* When true, inbound payload transforms run at most once for the same successful response object.
|
|
135
|
+
* This supports request flows that pass a response through more than one interceptor pipeline.
|
|
136
|
+
*/
|
|
137
|
+
skipRepeatedInboundTransforms: false,
|
|
93
138
|
predicates: [],
|
|
94
139
|
transforms: []
|
|
95
140
|
},
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_storage","require","_credentialsConfig","_interopRequireDefault","_default","exports","default","maxAppLevelRedirects","maxLocusRedirects","maxAuthenticationReplays","maxReconnectAttempts","onBeforeLogout","trackingIdPrefix","trackingIdSuffix","AlternateLogger","undefined","credentials","CredentialsConfig","fedramp","process","env","ENABLE_FEDRAMP","services","useUserOnboardingServiceForActivations","discovery","hydra","HYDRA_SERVICE_URL","sqdiscovery","SQDISCOVERY_SERVICE_URL","u2c","U2C_SERVICE_URL","validateDomains","servicesNotNeedValidation","allowedDomains","device","preDiscoveryServices","hydraServiceUrl","metrics","type","calling","cacheU2C","payloadTransformer","predicates","transforms","storage","boundedAdapter","MemoryStoreAdapter","unboundedAdapter"],"sources":["config.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n/* eslint camelcase: [0] */\n\nimport {MemoryStoreAdapter} from './lib/storage';\nimport CredentialsConfig from './credentials-config';\n\nexport default {\n maxAppLevelRedirects: 10,\n maxLocusRedirects: 5,\n maxAuthenticationReplays: 1,\n maxReconnectAttempts: 1,\n onBeforeLogout: [],\n trackingIdPrefix: 'webex-js-sdk',\n trackingIdSuffix: '',\n AlternateLogger: undefined,\n credentials: new CredentialsConfig(),\n fedramp: process.env.ENABLE_FEDRAMP || false,\n services: {\n /**\n * When true, uses the user-onboarding service for user activation.\n * When false (default), uses the license service.\n *\n * @type {boolean}\n */\n useUserOnboardingServiceForActivations: false,\n\n /**\n * A list of services that are available prior to catalog collection.\n *\n * @type {Object}\n */\n discovery: {\n /**\n * The hydra discovery url.\n *\n * @type {string}\n */\n hydra: process.env.HYDRA_SERVICE_URL || 'https://api.ciscospark.com/v1',\n\n /**\n * load balanced region info url\n */\n sqdiscovery: process.env.SQDISCOVERY_SERVICE_URL || 'https://ds.ciscospark.com/v1/region',\n\n /**\n * The u2c discovery url\n *\n * @type {string}\n */\n u2c: process.env.U2C_SERVICE_URL || 'https://u2c.
|
|
1
|
+
{"version":3,"names":["_storage","require","_credentialsConfig","_interopRequireDefault","_default","exports","default","maxAppLevelRedirects","maxLocusRedirects","maxAuthenticationReplays","maxReconnectAttempts","onBeforeLogout","trackingIdPrefix","trackingIdSuffix","AlternateLogger","undefined","credentials","CredentialsConfig","environment","fedramp","process","env","ENABLE_FEDRAMP","services","useUserOnboardingServiceForActivations","useCatalogOverride","skipPreauthCatalogOnUnauthenticated","catalogInitTimeout","discovery","hydra","HYDRA_SERVICE_URL","sqdiscovery","SQDISCOVERY_SERVICE_URL","u2c","U2C_SERVICE_URL","validateDomains","validateCatalogUrls","servicesNotNeedValidation","allowedDomains","device","preDiscoveryServices","hydraServiceUrl","metrics","type","calling","cacheU2C","payloadTransformer","skipRepeatedInboundTransforms","predicates","transforms","storage","boundedAdapter","MemoryStoreAdapter","unboundedAdapter"],"sources":["config.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n/* eslint camelcase: [0] */\n\nimport {MemoryStoreAdapter} from './lib/storage';\nimport CredentialsConfig from './credentials-config';\n\nexport default {\n maxAppLevelRedirects: 10,\n maxLocusRedirects: 5,\n maxAuthenticationReplays: 1,\n maxReconnectAttempts: 1,\n onBeforeLogout: [],\n trackingIdPrefix: 'webex-js-sdk',\n trackingIdSuffix: '',\n AlternateLogger: undefined,\n credentials: new CredentialsConfig(),\n /**\n * Explicitly selects the Webex environment. When omitted, the environment is inferred from the\n * U2C discovery URL.\n *\n * @type {'integration'|'production'|undefined}\n */\n environment: undefined,\n fedramp: process.env.ENABLE_FEDRAMP || false,\n services: {\n /**\n * When true, uses the user-onboarding service for user activation.\n * When false (default), uses the license service.\n *\n * @type {boolean}\n */\n useUserOnboardingServiceForActivations: false,\n\n /**\n * When true, requests the U2C catalog override.\n *\n * @type {boolean}\n */\n useCatalogOverride: false,\n\n /**\n * When true, skips fetching the preauth catalog during initialization\n * while the user is unauthenticated (no existing token). The catalog is\n * expected to be collected manually later instead. When false (default),\n * the preauth catalog is collected automatically during init.\n *\n * @type {boolean}\n */\n skipPreauthCatalogOnUnauthenticated: false,\n\n /**\n * Maximum time (in milliseconds) to wait for the initial service catalog\n * collection when `waitForCatalogInit` is enabled, before letting\n * `services.ready` (and therefore `webex.ready`) fire anyway. Prevents a\n * hung catalog request from leaving the app on a permanent spinner.\n *\n * @type {number}\n */\n catalogInitTimeout: 15000,\n\n /**\n * A list of services that are available prior to catalog collection.\n *\n * @type {Object}\n */\n discovery: {\n /**\n * The hydra discovery url.\n *\n * @type {string}\n */\n hydra: process.env.HYDRA_SERVICE_URL || 'https://api.ciscospark.com/v1',\n\n /**\n * load balanced region info url\n */\n sqdiscovery: process.env.SQDISCOVERY_SERVICE_URL || 'https://ds.ciscospark.com/v1/region',\n\n /**\n * The u2c discovery url\n *\n * @type {string}\n */\n u2c: process.env.U2C_SERVICE_URL || 'https://u2c.svc.webex.com/u2c/api/v1',\n },\n\n /**\n * When true, considers all urls in `allowedDomains` as safe for auth tokens\n *\n * @type {boolean}\n */\n validateDomains: true,\n\n /**\n * When true, enables the CatalogUrlInterceptor which validates that all\n * outbound request URLs are in the service catalog or allowed domains.\n * This prevents SSRF attacks where attacker-controlled URLs could be\n * sent to the SDK.\n *\n * @type {boolean}\n */\n validateCatalogUrls: false,\n\n /**\n * services that don't need auth validation\n */\n\n servicesNotNeedValidation: ['webex-appapi-service'],\n\n /**\n * Contains a list of allowed domain host addresses.\n *\n * @type {Array<string>}\n */\n allowedDomains: [],\n },\n device: {\n preDiscoveryServices: {\n hydra: process.env.HYDRA_SERVICE_URL || 'https://api.ciscospark.com/v1',\n hydraServiceUrl: process.env.HYDRA_SERVICE_URL || 'https://api.ciscospark.com/v1',\n },\n validateDomains: true,\n },\n metrics: {\n type: ['behavioral', 'operational'],\n },\n calling: {\n /**\n * Controls whether U2C service catalogs should be cached and warmed from cache.\n * When false, the services layer will skip reading and writing the U2C cache.\n */\n cacheU2C: false,\n },\n payloadTransformer: {\n /**\n * When true, inbound payload transforms run at most once for the same successful response object.\n * This supports request flows that pass a response through more than one interceptor pipeline.\n */\n skipRepeatedInboundTransforms: false,\n predicates: [],\n transforms: [],\n },\n storage: {\n boundedAdapter: MemoryStoreAdapter,\n unboundedAdapter: MemoryStoreAdapter,\n },\n};\n"],"mappings":";;;;;;;;AAMA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAPA;AACA;AACA;AAEA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAKe;EACbC,oBAAoB,EAAE,EAAE;EACxBC,iBAAiB,EAAE,CAAC;EACpBC,wBAAwB,EAAE,CAAC;EAC3BC,oBAAoB,EAAE,CAAC;EACvBC,cAAc,EAAE,EAAE;EAClBC,gBAAgB,EAAE,cAAc;EAChCC,gBAAgB,EAAE,EAAE;EACpBC,eAAe,EAAEC,SAAS;EAC1BC,WAAW,EAAE,IAAIC,0BAAiB,CAAC,CAAC;EACpC;AACF;AACA;AACA;AACA;AACA;EACEC,WAAW,EAAEH,SAAS;EACtBI,OAAO,EAAEC,OAAO,CAACC,GAAG,CAACC,cAAc,IAAI,KAAK;EAC5CC,QAAQ,EAAE;IACR;AACJ;AACA;AACA;AACA;AACA;IACIC,sCAAsC,EAAE,KAAK;IAE7C;AACJ;AACA;AACA;AACA;IACIC,kBAAkB,EAAE,KAAK;IAEzB;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;IACIC,mCAAmC,EAAE,KAAK;IAE1C;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;IACIC,kBAAkB,EAAE,KAAK;IAEzB;AACJ;AACA;AACA;AACA;IACIC,SAAS,EAAE;MACT;AACN;AACA;AACA;AACA;MACMC,KAAK,EAAET,OAAO,CAACC,GAAG,CAACS,iBAAiB,IAAI,+BAA+B;MAEvE;AACN;AACA;MACMC,WAAW,EAAEX,OAAO,CAACC,GAAG,CAACW,uBAAuB,IAAI,qCAAqC;MAEzF;AACN;AACA;AACA;AACA;MACMC,GAAG,EAAEb,OAAO,CAACC,GAAG,CAACa,eAAe,IAAI;IACtC,CAAC;IAED;AACJ;AACA;AACA;AACA;IACIC,eAAe,EAAE,IAAI;IAErB;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;IACIC,mBAAmB,EAAE,KAAK;IAE1B;AACJ;AACA;;IAEIC,yBAAyB,EAAE,CAAC,sBAAsB,CAAC;IAEnD;AACJ;AACA;AACA;AACA;IACIC,cAAc,EAAE;EAClB,CAAC;EACDC,MAAM,EAAE;IACNC,oBAAoB,EAAE;MACpBX,KAAK,EAAET,OAAO,CAACC,GAAG,CAACS,iBAAiB,IAAI,+BAA+B;MACvEW,eAAe,EAAErB,OAAO,CAACC,GAAG,CAACS,iBAAiB,IAAI;IACpD,CAAC;IACDK,eAAe,EAAE;EACnB,CAAC;EACDO,OAAO,EAAE;IACPC,IAAI,EAAE,CAAC,YAAY,EAAE,aAAa;EACpC,CAAC;EACDC,OAAO,EAAE;IACP;AACJ;AACA;AACA;IACIC,QAAQ,EAAE;EACZ,CAAC;EACDC,kBAAkB,EAAE;IAClB;AACJ;AACA;AACA;IACIC,6BAA6B,EAAE,KAAK;IACpCC,UAAU,EAAE,EAAE;IACdC,UAAU,EAAE;EACd,CAAC;EACDC,OAAO,EAAE;IACPC,cAAc,EAAEC,2BAAkB;IAClCC,gBAAgB,EAAED;EACpB;AACF,CAAC","ignoreList":[]}
|
|
@@ -71,7 +71,15 @@ var CredentialsConfig = _ampersandState.default.extend({
|
|
|
71
71
|
* @private
|
|
72
72
|
* @type {string}
|
|
73
73
|
*/
|
|
74
|
-
cisService: ['string', false, 'webex']
|
|
74
|
+
cisService: ['string', false, 'webex'],
|
|
75
|
+
/**
|
|
76
|
+
* Whether the client is permitted to upgrade its refresh token scope
|
|
77
|
+
* Should only be set to true if client has extended feature 'refresh-token-scopes-upgrade-allowed'
|
|
78
|
+
* If true, the refresh token scope will be requested to be increased or decreased on refresh,
|
|
79
|
+
* to match the configured scope.
|
|
80
|
+
* @type {boolean}
|
|
81
|
+
*/
|
|
82
|
+
canUpgradeScope: ['boolean', false, false]
|
|
75
83
|
},
|
|
76
84
|
derived: {
|
|
77
85
|
/**
|
|
@@ -144,6 +152,18 @@ var CredentialsConfig = _ampersandState.default.extend({
|
|
|
144
152
|
},
|
|
145
153
|
cache: false
|
|
146
154
|
},
|
|
155
|
+
/**
|
|
156
|
+
* URL used to initiate the IdBroker third-party (social provider)
|
|
157
|
+
* sign-in flow.
|
|
158
|
+
* @type {string}
|
|
159
|
+
*/
|
|
160
|
+
thirdPartyLoginUrl: {
|
|
161
|
+
deps: ['idbroker.url'],
|
|
162
|
+
fn: function fn() {
|
|
163
|
+
return "".concat(this.idbroker.url, "/idb/ThirdPartyLogin");
|
|
164
|
+
},
|
|
165
|
+
cache: false
|
|
166
|
+
},
|
|
147
167
|
/**
|
|
148
168
|
* Set password URL
|
|
149
169
|
* @type {string}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_ampersandState","_interopRequireDefault","require","CredentialsConfig","AmpState","extend","extraProperties","props","idbroker","url","process","env","IDBROKER_BASE_URL","identity","IDENTITY_BASE_URL","authorizationString","WEBEX_AUTHORIZATION_STRING","AUTHORIZATION_STRING","authorizeUrl","WEBEX_AUTHORIZE_URL","concat","client_id","WEBEX_CLIENT_ID","COMMON_IDENTITY_CLIENT_ID","CLIENT_ID","client_secret","WEBEX_CLIENT_SECRET","COMMON_IDENTITY_CLIENT_SECRET","CLIENT_SECRET","redirect_uri","WEBEX_REDIRECT_URI","COMMON_IDENTITY_REDIRECT_URI","REDIRECT_URI","scope","WEBEX_SCOPE","WEBEX_SCOPES","COMMON_IDENTITY_SCOPE","SCOPE","cisService","derived","activationUrl","deps","fn","cache","generateOtpUrl","validateOtpUrl","tokenUrl","TOKEN_URL","revokeUrl","REVOKE_URL","logoutUrl","setPasswordUrl","_default","exports","default"],"sources":["credentials-config.js"],"sourcesContent":["import AmpState from 'ampersand-state';\n\n// The credentials config which includes the CI server info and derived\n// URL properties from them for the various CI services. The URL's\n// will be updated when the CI changes.\nconst CredentialsConfig = AmpState.extend({\n // we need to allow extra props for dynamic props like jwtRefreshCallback\n extraProperties: 'allow',\n\n props: {\n /**\n * The idbroker base host name\n * @returns {object}\n */\n idbroker: [\n 'object',\n false,\n () => ({\n url: process.env.IDBROKER_BASE_URL || 'https://idbroker.webex.com',\n }),\n ],\n\n /**\n * The identity base host name\n * @returns {object}\n */\n identity: [\n 'object',\n false,\n () => ({\n url: process.env.IDENTITY_BASE_URL || 'https://identity.webex.com',\n }),\n ],\n\n /**\n * This is the authorization url displayed on the\n * {@link developer portal|https://developer.webex.com}\n * @type {string}\n */\n authorizationString: [\n 'string',\n false,\n process.env.WEBEX_AUTHORIZATION_STRING || process.env.AUTHORIZATION_STRING,\n ],\n\n /**\n * Authorization URL which prompts for user's password. Inferred from\n * {@link config.credentials.authorizationString}. This config value will\n * be automatically set if `authorizationString` config value is specified.\n *\n * @type {string}\n */\n authorizeUrl: [\n 'string',\n false,\n process.env.WEBEX_AUTHORIZE_URL ||\n `${process.env.IDBROKER_BASE_URL || 'https://idbroker.webex.com'}/idb/oauth2/v1/authorize`,\n ],\n\n /**\n * {@see https://tools.ietf.org/html/rfc6749#section-4.1.4}\n * @type {string}\n */\n client_id: [\n 'string',\n false,\n process.env.WEBEX_CLIENT_ID || process.env.COMMON_IDENTITY_CLIENT_ID || process.env.CLIENT_ID,\n ],\n\n /**\n * {@see https://tools.ietf.org/html/rfc6749#section-4.1.4}\n * @type {string}\n */\n client_secret: [\n 'string',\n false,\n process.env.WEBEX_CLIENT_SECRET ||\n process.env.COMMON_IDENTITY_CLIENT_SECRET ||\n process.env.CLIENT_SECRET,\n ],\n\n /**\n * {@see https://tools.ietf.org/html/rfc6749#section-4.1.4}\n * @type {string}\n */\n redirect_uri: [\n 'string',\n false,\n process.env.WEBEX_REDIRECT_URI ||\n process.env.COMMON_IDENTITY_REDIRECT_URI ||\n process.env.REDIRECT_URI,\n ],\n\n /**\n * {@see https://tools.ietf.org/html/rfc6749#section-4.1.4}\n * @type {string}\n */\n scope: [\n 'string',\n false,\n process.env.WEBEX_SCOPE ||\n process.env.WEBEX_SCOPES ||\n process.env.COMMON_IDENTITY_SCOPE ||\n process.env.SCOPE,\n ],\n\n /**\n * Controls the UI of the CI login page.\n * @private\n * @type {string}\n */\n cisService: ['string', false, 'webex'],\n },\n\n derived: {\n /**\n * User activation URL\n * {@link config.credentials.activationUrl}\n * @type {string}\n */\n activationUrl: {\n deps: ['idbroker.url'],\n fn() {\n return `${\n this.idbroker.url || 'https://idbroker.webex.com'\n }/idb/token/v1/actions/UserActivation/invoke`;\n },\n cache: false,\n },\n\n /**\n * Generate OTP URL\n * {@link config.credentials.generateOtpUrl}\n * @type {string}\n */\n generateOtpUrl: {\n deps: ['idbroker.url'],\n fn() {\n return `${\n this.idbroker.url || 'https://idbroker.webex.com'\n }/idb/token/v1/actions/UserOTP/Generate/invoke`;\n },\n cache: false,\n },\n\n /**\n * Validate OTP URL\n * {@link config.credentials.validateOtpUrl}\n * @type {string}\n */\n validateOtpUrl: {\n deps: ['idbroker.url'],\n fn() {\n return `${\n this.idbroker.url || 'https://idbroker.webex.com'\n }/idb/token/v1/actions/UserOTP/Validate/invoke`;\n },\n cache: false,\n },\n\n // TODO does hydra also have an access_token endpoint?\n /**\n * Token URL used for token refresh and auth code exchange\n * @type {string}\n */\n tokenUrl: {\n deps: ['idbroker.url'],\n fn() {\n return process.env.TOKEN_URL || `${this.idbroker.url}/idb/oauth2/v1/access_token`;\n },\n cache: false,\n },\n\n /**\n * URL to revoke token\n * @type {string}\n */\n revokeUrl: {\n deps: ['idbroker.url'],\n fn() {\n return process.env.REVOKE_URL || `${this.idbroker.url}/idb/oauth2/v1/revoke`;\n },\n cache: false,\n },\n\n /**\n * URL to load when the app logs out\n * @type {string}\n */\n logoutUrl: {\n deps: ['idbroker.url'],\n fn() {\n return `${this.idbroker.url}/idb/oauth2/v1/logout`;\n },\n cache: false,\n },\n\n /**\n * Set password URL\n * @type {string}\n */\n setPasswordUrl: {\n deps: ['identity.url'],\n fn() {\n return `${this.identity.url || 'https://identity.webex.com'}/identity/scim/v1/Users`;\n },\n cache: false,\n },\n },\n});\n\nexport default CredentialsConfig;\n"],"mappings":";;;;;;;;AAAA,IAAAA,eAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA;AACA;AACA;AACA,IAAMC,iBAAiB,GAAGC,uBAAQ,CAACC,MAAM,CAAC;EACxC;EACAC,eAAe,EAAE,OAAO;EAExBC,KAAK,EAAE;IACL;AACJ;AACA;AACA;IACIC,QAAQ,EAAE,CACR,QAAQ,EACR,KAAK,EACL;MAAA,OAAO;QACLC,GAAG,EAAEC,OAAO,CAACC,GAAG,CAACC,iBAAiB,IAAI;MACxC,CAAC;IAAA,CAAC,CACH;IAED;AACJ;AACA;AACA;IACIC,QAAQ,EAAE,CACR,QAAQ,EACR,KAAK,EACL;MAAA,OAAO;QACLJ,GAAG,EAAEC,OAAO,CAACC,GAAG,CAACG,iBAAiB,IAAI;MACxC,CAAC;IAAA,CAAC,CACH;IAED;AACJ;AACA;AACA;AACA;IACIC,mBAAmB,EAAE,CACnB,QAAQ,EACR,KAAK,EACLL,OAAO,CAACC,GAAG,CAACK,0BAA0B,IAAIN,OAAO,CAACC,GAAG,CAACM,oBAAoB,CAC3E;IAED;AACJ;AACA;AACA;AACA;AACA;AACA;IACIC,YAAY,EAAE,CACZ,QAAQ,EACR,KAAK,EACLR,OAA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C;IAED;AACJ;AACA;AACA;IACIQ,cAAc,EAAE;MACdV,IAAI,EAAE,CAAC,cAAc,CAAC;MACtBC,EAAE,WAAFA,EAAEA,CAAA,EAAG;QACH,UAAAtB,MAAA,CAAU,IAAI,CAACP,QAAQ,CAACJ,GAAG,IAAI,4BAA4B;MAC7D,CAAC;MACDkC,KAAK,EAAE;IACT;EACF;AACF,CAAC,CAAC;AAAC,IAAAS,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEYnD,iBAAiB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_ampersandState","_interopRequireDefault","require","CredentialsConfig","AmpState","extend","extraProperties","props","idbroker","url","process","env","IDBROKER_BASE_URL","identity","IDENTITY_BASE_URL","authorizationString","WEBEX_AUTHORIZATION_STRING","AUTHORIZATION_STRING","authorizeUrl","WEBEX_AUTHORIZE_URL","concat","client_id","WEBEX_CLIENT_ID","COMMON_IDENTITY_CLIENT_ID","CLIENT_ID","client_secret","WEBEX_CLIENT_SECRET","COMMON_IDENTITY_CLIENT_SECRET","CLIENT_SECRET","redirect_uri","WEBEX_REDIRECT_URI","COMMON_IDENTITY_REDIRECT_URI","REDIRECT_URI","scope","WEBEX_SCOPE","WEBEX_SCOPES","COMMON_IDENTITY_SCOPE","SCOPE","cisService","canUpgradeScope","derived","activationUrl","deps","fn","cache","generateOtpUrl","validateOtpUrl","tokenUrl","TOKEN_URL","revokeUrl","REVOKE_URL","logoutUrl","thirdPartyLoginUrl","setPasswordUrl","_default","exports","default"],"sources":["credentials-config.js"],"sourcesContent":["import AmpState from 'ampersand-state';\n\n// The credentials config which includes the CI server info and derived\n// URL properties from them for the various CI services. The URL's\n// will be updated when the CI changes.\nconst CredentialsConfig = AmpState.extend({\n // we need to allow extra props for dynamic props like jwtRefreshCallback\n extraProperties: 'allow',\n\n props: {\n /**\n * The idbroker base host name\n * @returns {object}\n */\n idbroker: [\n 'object',\n false,\n () => ({\n url: process.env.IDBROKER_BASE_URL || 'https://idbroker.webex.com',\n }),\n ],\n\n /**\n * The identity base host name\n * @returns {object}\n */\n identity: [\n 'object',\n false,\n () => ({\n url: process.env.IDENTITY_BASE_URL || 'https://identity.webex.com',\n }),\n ],\n\n /**\n * This is the authorization url displayed on the\n * {@link developer portal|https://developer.webex.com}\n * @type {string}\n */\n authorizationString: [\n 'string',\n false,\n process.env.WEBEX_AUTHORIZATION_STRING || process.env.AUTHORIZATION_STRING,\n ],\n\n /**\n * Authorization URL which prompts for user's password. Inferred from\n * {@link config.credentials.authorizationString}. This config value will\n * be automatically set if `authorizationString` config value is specified.\n *\n * @type {string}\n */\n authorizeUrl: [\n 'string',\n false,\n process.env.WEBEX_AUTHORIZE_URL ||\n `${process.env.IDBROKER_BASE_URL || 'https://idbroker.webex.com'}/idb/oauth2/v1/authorize`,\n ],\n\n /**\n * {@see https://tools.ietf.org/html/rfc6749#section-4.1.4}\n * @type {string}\n */\n client_id: [\n 'string',\n false,\n process.env.WEBEX_CLIENT_ID || process.env.COMMON_IDENTITY_CLIENT_ID || process.env.CLIENT_ID,\n ],\n\n /**\n * {@see https://tools.ietf.org/html/rfc6749#section-4.1.4}\n * @type {string}\n */\n client_secret: [\n 'string',\n false,\n process.env.WEBEX_CLIENT_SECRET ||\n process.env.COMMON_IDENTITY_CLIENT_SECRET ||\n process.env.CLIENT_SECRET,\n ],\n\n /**\n * {@see https://tools.ietf.org/html/rfc6749#section-4.1.4}\n * @type {string}\n */\n redirect_uri: [\n 'string',\n false,\n process.env.WEBEX_REDIRECT_URI ||\n process.env.COMMON_IDENTITY_REDIRECT_URI ||\n process.env.REDIRECT_URI,\n ],\n\n /**\n * {@see https://tools.ietf.org/html/rfc6749#section-4.1.4}\n * @type {string}\n */\n scope: [\n 'string',\n false,\n process.env.WEBEX_SCOPE ||\n process.env.WEBEX_SCOPES ||\n process.env.COMMON_IDENTITY_SCOPE ||\n process.env.SCOPE,\n ],\n\n /**\n * Controls the UI of the CI login page.\n * @private\n * @type {string}\n */\n cisService: ['string', false, 'webex'],\n\n /**\n * Whether the client is permitted to upgrade its refresh token scope\n * Should only be set to true if client has extended feature 'refresh-token-scopes-upgrade-allowed'\n * If true, the refresh token scope will be requested to be increased or decreased on refresh,\n * to match the configured scope.\n * @type {boolean}\n */\n canUpgradeScope: ['boolean', false, false],\n },\n\n derived: {\n /**\n * User activation URL\n * {@link config.credentials.activationUrl}\n * @type {string}\n */\n activationUrl: {\n deps: ['idbroker.url'],\n fn() {\n return `${\n this.idbroker.url || 'https://idbroker.webex.com'\n }/idb/token/v1/actions/UserActivation/invoke`;\n },\n cache: false,\n },\n\n /**\n * Generate OTP URL\n * {@link config.credentials.generateOtpUrl}\n * @type {string}\n */\n generateOtpUrl: {\n deps: ['idbroker.url'],\n fn() {\n return `${\n this.idbroker.url || 'https://idbroker.webex.com'\n }/idb/token/v1/actions/UserOTP/Generate/invoke`;\n },\n cache: false,\n },\n\n /**\n * Validate OTP URL\n * {@link config.credentials.validateOtpUrl}\n * @type {string}\n */\n validateOtpUrl: {\n deps: ['idbroker.url'],\n fn() {\n return `${\n this.idbroker.url || 'https://idbroker.webex.com'\n }/idb/token/v1/actions/UserOTP/Validate/invoke`;\n },\n cache: false,\n },\n\n // TODO does hydra also have an access_token endpoint?\n /**\n * Token URL used for token refresh and auth code exchange\n * @type {string}\n */\n tokenUrl: {\n deps: ['idbroker.url'],\n fn() {\n return process.env.TOKEN_URL || `${this.idbroker.url}/idb/oauth2/v1/access_token`;\n },\n cache: false,\n },\n\n /**\n * URL to revoke token\n * @type {string}\n */\n revokeUrl: {\n deps: ['idbroker.url'],\n fn() {\n return process.env.REVOKE_URL || `${this.idbroker.url}/idb/oauth2/v1/revoke`;\n },\n cache: false,\n },\n\n /**\n * URL to load when the app logs out\n * @type {string}\n */\n logoutUrl: {\n deps: ['idbroker.url'],\n fn() {\n return `${this.idbroker.url}/idb/oauth2/v1/logout`;\n },\n cache: false,\n },\n\n /**\n * URL used to initiate the IdBroker third-party (social provider)\n * sign-in flow.\n * @type {string}\n */\n thirdPartyLoginUrl: {\n deps: ['idbroker.url'],\n fn() {\n return `${this.idbroker.url}/idb/ThirdPartyLogin`;\n },\n cache: false,\n },\n\n /**\n * Set password URL\n * @type {string}\n */\n setPasswordUrl: {\n deps: ['identity.url'],\n fn() {\n return `${this.identity.url || 'https://identity.webex.com'}/identity/scim/v1/Users`;\n },\n cache: false,\n },\n },\n});\n\nexport default CredentialsConfig;\n"],"mappings":";;;;;;;;AAAA,IAAAA,eAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA;AACA;AACA;AACA,IAAMC,iBAAiB,GAAGC,uBAAQ,CAACC,MAAM,CAAC;EACxC;EACAC,eAAe,EAAE,OAAO;EAExBC,KAAK,EAAE;IACL;AACJ;AACA;AACA;IACIC,QAAQ,EAAE,CACR,QAAQ,EACR,KAAK,EACL;MAAA,OAAO;QACLC,GAAG,EAAEC,OAAO,CAACC,GAAG,CAACC,iBAAiB,IAAI;MACxC,CAAC;IAAA,CAAC,CACH;IAED;AACJ;AACA;AACA;IACIC,QAAQ,EAAE,CACR,QAAQ,EACR,KAAK,EACL;MAAA,OAAO;QACLJ,GAAG,EAAEC,OAAO,CAACC,GAAG,CAACG,iBAAiB,IAAI;MACxC,CAAC;IAAA,CAAC,CACH;IAED;AACJ;AACA;AACA;AACA;IACIC,mBAAmB,EAAE,CACnB,QAAQ,EACR,KAAK,EACLL,OAAO,CAACC,GAAG,CAACK,0BAA0B,IAAIN,OAAO,CAACC,GAAG,CAACM,oBAAoB,CAC3E;IAED;AACJ;AACA;AACA;AACA;AACA;AACA;IACIC,YAAY,EAAE,CACZ,QAAQ,EACR,KAAK,EACLR,OAAO,CAACC,GAAG,CAACQ,mBAAmB,OAAAC,MAAA,CAC1BV,OAAO,CAACC,GAAG,CAACC,iBAAiB,IAAI,4BAA4B,6BAA0B,CAC7F;IAED;AACJ;AACA;AACA;IACIS,SAAS,EAAE,CACT,QAAQ,EACR,KAAK,EACLX,OAAO,CAACC,GAAG,CAACW,eAAe,IAAIZ,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AAG;QACH,UAAAvB,MAAA,CAAU,IAAI,CAACZ,QAAQ,CAACC,GAAG;MAC7B,CAAC;MACDmC,KAAK,EAAE;IACT,CAAC;IAED;AACJ;AACA;AACA;IACIS,cAAc,EAAE;MACdX,IAAI,EAAE,CAAC,cAAc,CAAC;MACtBC,EAAE,WAAFA,EAAEA,CAAA,EAAG;QACH,UAAAvB,MAAA,CAAU,IAAI,CAACP,QAAQ,CAACJ,GAAG,IAAI,4BAA4B;MAC7D,CAAC;MACDmC,KAAK,EAAE;IACT;EACF;AACF,CAAC,CAAC;AAAC,IAAAU,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEYrD,iBAAiB","ignoreList":[]}
|
package/dist/index.js
CHANGED
|
@@ -20,6 +20,12 @@ _Object$defineProperty(exports, "Batcher", {
|
|
|
20
20
|
return _batcher.default;
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
|
+
_Object$defineProperty(exports, "CatalogUrlInterceptor", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function get() {
|
|
26
|
+
return _catalogUrl.default;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
23
29
|
_Object$defineProperty(exports, "Credentials", {
|
|
24
30
|
enumerable: true,
|
|
25
31
|
get: function get() {
|
|
@@ -188,6 +194,12 @@ _Object$defineProperty(exports, "StatelessWebexPlugin", {
|
|
|
188
194
|
return _statelessWebexPlugin.default;
|
|
189
195
|
}
|
|
190
196
|
});
|
|
197
|
+
_Object$defineProperty(exports, "StaticAssetLoader", {
|
|
198
|
+
enumerable: true,
|
|
199
|
+
get: function get() {
|
|
200
|
+
return _staticAssetLoader.default;
|
|
201
|
+
}
|
|
202
|
+
});
|
|
191
203
|
_Object$defineProperty(exports, "StorageError", {
|
|
192
204
|
enumerable: true,
|
|
193
205
|
get: function get() {
|
|
@@ -314,7 +326,9 @@ var _webexCore = _interopRequireWildcard(require("./webex-core"));
|
|
|
314
326
|
var _webexHttpError = _interopRequireDefault(require("./lib/webex-http-error"));
|
|
315
327
|
var _statelessWebexPlugin = _interopRequireDefault(require("./lib/stateless-webex-plugin"));
|
|
316
328
|
var _webexPlugin = _interopRequireDefault(require("./lib/webex-plugin"));
|
|
329
|
+
var _staticAssetLoader = _interopRequireDefault(require("./lib/static-asset-loader"));
|
|
317
330
|
var _auth = _interopRequireDefault(require("./interceptors/auth"));
|
|
331
|
+
var _catalogUrl = _interopRequireDefault(require("./interceptors/catalog-url"));
|
|
318
332
|
var _networkTiming = _interopRequireDefault(require("./interceptors/network-timing"));
|
|
319
333
|
var _payloadTransformer = _interopRequireDefault(require("./interceptors/payload-transformer"));
|
|
320
334
|
var _redirect = _interopRequireDefault(require("./interceptors/redirect"));
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["require","_credentials","_services","_servicesV","_serviceConstants","_interopRequireWildcard","exports","serviceConstants","_storage","_webexCore","_webexHttpError","_interopRequireDefault","_statelessWebexPlugin","_webexPlugin","_auth","_networkTiming","_payloadTransformer","_redirect","_responseLogger","_requestEvent","_requestLogger","_requestTiming","_userAgent","_proxy","_webexTrackingId","_webexUserAgent","_rateLimit","_embargo","_defaultOptions","_hostmap","_service","_serverError","_batcher","_page","_config","e","t","_WeakMap","r","n","__esModule","o","i","f","__proto__","default","_typeof","has","get","set","_t","hasOwnProperty","call","_Object$defineProperty","_Object$getOwnPropertyDescriptor"],"sources":["index.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n *\n * Services is currently a part of webex-core due to how the contents of\n * the original internal-plugin-services needed to be accessed when webex-core\n * is initialized. As a plugin outside of webex-core, it would initialize after\n * credentials, causing all requests prior to its initialization to fail\n * federation requirements, and instead send requests to the environmentally-\n * assigned urls.\n */\n\nimport './plugins/logger';\nimport './lib/credentials';\nimport './lib/services';\n\nexport {Credentials, filterScope, grantErrors, sortScope, Token} from './lib/credentials';\n\nexport {\n ServiceCatalog,\n ServiceRegistry,\n ServiceState,\n Services,\n ServiceHost,\n ServiceUrl,\n} from './lib/services';\n\nexport {ServiceCatalogV2, ServicesV2, ServiceDetail} from './lib/services-v2';\nexport * as serviceConstants from './lib/constants';\nexport {\n makeWebexStore,\n makeWebexPluginStore,\n MemoryStoreAdapter,\n NotFoundError,\n persist,\n StorageError,\n waitForValue,\n} from './lib/storage';\n\nexport {default, registerPlugin, registerInternalPlugin} from './webex-core';\n\nexport {default as WebexHttpError} from './lib/webex-http-error';\nexport {default as StatelessWebexPlugin} from './lib/stateless-webex-plugin';\nexport {default as WebexPlugin} from './lib/webex-plugin';\nexport {default as AuthInterceptor} from './interceptors/auth';\nexport {default as NetworkTimingInterceptor} from './interceptors/network-timing';\nexport {default as PayloadTransformerInterceptor} from './interceptors/payload-transformer';\nexport {default as RedirectInterceptor} from './interceptors/redirect';\nexport {default as ResponseLoggerInterceptor} from './interceptors/response-logger';\nexport {default as RequestEventInterceptor} from './interceptors/request-event';\nexport {default as RequestLoggerInterceptor} from './interceptors/request-logger';\nexport {default as RequestTimingInterceptor} from './interceptors/request-timing';\nexport {default as UserAgentInterceptor} from './interceptors/user-agent';\nexport {default as ProxyInterceptor} from './interceptors/proxy';\nexport {default as WebexTrackingIdInterceptor} from './interceptors/webex-tracking-id';\nexport {sequenceNumbers as webexTrackingIdSequenceNumbers} from './interceptors/webex-tracking-id';\nexport {default as WebexUserAgentInterceptor} from './interceptors/webex-user-agent';\nexport {default as RateLimitInterceptor} from './interceptors/rate-limit';\nexport {default as EmbargoInterceptor} from './interceptors/embargo';\nexport {default as DefaultOptionsInterceptor} from './interceptors/default-options';\nexport {default as HostMapInterceptor} from './lib/interceptors/hostmap';\nexport {default as ServiceInterceptor} from './lib/interceptors/service';\nexport {default as ServerErrorInterceptor} from './lib/interceptors/server-error';\n\nexport {default as Batcher} from './lib/batcher';\nexport {default as Page} from './lib/page';\nexport {default as config} from './config';\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["require","_credentials","_services","_servicesV","_serviceConstants","_interopRequireWildcard","exports","serviceConstants","_storage","_webexCore","_webexHttpError","_interopRequireDefault","_statelessWebexPlugin","_webexPlugin","_staticAssetLoader","_auth","_catalogUrl","_networkTiming","_payloadTransformer","_redirect","_responseLogger","_requestEvent","_requestLogger","_requestTiming","_userAgent","_proxy","_webexTrackingId","_webexUserAgent","_rateLimit","_embargo","_defaultOptions","_hostmap","_service","_serverError","_batcher","_page","_config","e","t","_WeakMap","r","n","__esModule","o","i","f","__proto__","default","_typeof","has","get","set","_t","hasOwnProperty","call","_Object$defineProperty","_Object$getOwnPropertyDescriptor"],"sources":["index.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n *\n * Services is currently a part of webex-core due to how the contents of\n * the original internal-plugin-services needed to be accessed when webex-core\n * is initialized. As a plugin outside of webex-core, it would initialize after\n * credentials, causing all requests prior to its initialization to fail\n * federation requirements, and instead send requests to the environmentally-\n * assigned urls.\n */\n\nimport './plugins/logger';\nimport './lib/credentials';\nimport './lib/services';\n\nexport {Credentials, filterScope, grantErrors, sortScope, Token} from './lib/credentials';\n\nexport {\n ServiceCatalog,\n ServiceRegistry,\n ServiceState,\n Services,\n ServiceHost,\n ServiceUrl,\n} from './lib/services';\n\nexport {ServiceCatalogV2, ServicesV2, ServiceDetail} from './lib/services-v2';\nexport * as serviceConstants from './lib/constants';\nexport {\n makeWebexStore,\n makeWebexPluginStore,\n MemoryStoreAdapter,\n NotFoundError,\n persist,\n StorageError,\n waitForValue,\n} from './lib/storage';\n\nexport {default, registerPlugin, registerInternalPlugin} from './webex-core';\n\nexport {default as WebexHttpError} from './lib/webex-http-error';\nexport {default as StatelessWebexPlugin} from './lib/stateless-webex-plugin';\nexport {default as WebexPlugin} from './lib/webex-plugin';\nexport {default as StaticAssetLoader} from './lib/static-asset-loader';\nexport {default as AuthInterceptor} from './interceptors/auth';\nexport {default as CatalogUrlInterceptor} from './interceptors/catalog-url';\nexport {default as NetworkTimingInterceptor} from './interceptors/network-timing';\nexport {default as PayloadTransformerInterceptor} from './interceptors/payload-transformer';\nexport {default as RedirectInterceptor} from './interceptors/redirect';\nexport {default as ResponseLoggerInterceptor} from './interceptors/response-logger';\nexport {default as RequestEventInterceptor} from './interceptors/request-event';\nexport {default as RequestLoggerInterceptor} from './interceptors/request-logger';\nexport {default as RequestTimingInterceptor} from './interceptors/request-timing';\nexport {default as UserAgentInterceptor} from './interceptors/user-agent';\nexport {default as ProxyInterceptor} from './interceptors/proxy';\nexport {default as WebexTrackingIdInterceptor} from './interceptors/webex-tracking-id';\nexport {sequenceNumbers as webexTrackingIdSequenceNumbers} from './interceptors/webex-tracking-id';\nexport {default as WebexUserAgentInterceptor} from './interceptors/webex-user-agent';\nexport {default as RateLimitInterceptor} from './interceptors/rate-limit';\nexport {default as EmbargoInterceptor} from './interceptors/embargo';\nexport {default as DefaultOptionsInterceptor} from './interceptors/default-options';\nexport {default as HostMapInterceptor} from './lib/interceptors/hostmap';\nexport {default as ServiceInterceptor} from './lib/interceptors/service';\nexport {default as ServerErrorInterceptor} from './lib/interceptors/server-error';\n\nexport {default as Batcher} from './lib/batcher';\nexport {default as Page} from './lib/page';\nexport {default as config} from './config';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWAA,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAaA,IAAAG,UAAA,GAAAH,OAAA;AAA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.headers, 'authorization');
|
|
140
140
|
}
|
|
141
141
|
if (_this3.webex.credentials.canRefresh) {
|
|
142
|
-
return _this3.webex.credentials.refresh().
|
|
142
|
+
return _this3.webex.credentials.refresh().catch(function (error) {
|
|
143
|
+
var refreshStatus = error && (error.statusCode || error.status);
|
|
144
|
+
|
|
145
|
+
// A refresh 403 is not a catalog 403. Keep the original 401 for
|
|
146
|
+
// catalog auth reporting and leave statusCode unchanged.
|
|
147
|
+
if (reason.statusCode === 401 && refreshStatus === 403 && error) {
|
|
148
|
+
error.catalogAuthStatus = 401;
|
|
149
|
+
}
|
|
150
|
+
return _promise.default.reject(error);
|
|
151
|
+
}).then(function () {
|
|
143
152
|
return _this3.replay(options);
|
|
144
153
|
});
|
|
145
154
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_httpCore","require","_callSuper","t","o","e","_getPrototypeOf2","default","_possibleConstructorReturn2","_isNativeReflectConstruct","_Reflect$construct","constructor","apply","Boolean","prototype","valueOf","call","AuthInterceptor","exports","_Interceptor","_classCallCheck2","arguments","_inherits2","_createClass2","key","value","onRequest","options","_this","headers","authorization","_deleteProperty","_promise","resolve","requiresCredentials","then","requires","webex","credentials","getUserToken","token","toString","_this2","addAuthHeader","internal","services","details","getServiceFromUrl","uri","_ref","name","resource","service","api","includes","validateDomains","hasAllowedDomains","isAllowedDomainUrl","waitForService","url","detectedUrl","catch","error","logger","warn","onResponseError","reason","_this3","shouldAttemptReauth","info","canRefresh","refresh","replay","reject","replayCount","config","maxAuthenticationReplays","concat","Error","request","shouldRefreshAccessToken","statusCode","create","Interceptor"],"sources":["auth.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {Interceptor} from '@webex/http-core';\n\n/**\n * @class\n */\nexport default class AuthInterceptor extends Interceptor {\n /**\n * @returns {AuthInterceptor}\n */\n static create() {\n return new AuthInterceptor({webex: this});\n }\n\n /**\n * @see {@link Interceptor#onRequest}\n * @param {Object} options\n * @returns {Object}\n */\n onRequest(options) {\n options.headers = options.headers || {};\n\n // If Authorizations is already set, don't overwrite it\n if ('authorization' in options.headers || 'auth' in options) {\n // If Authorization is set to null, false, or undefined, delete it to\n // prevent a CORS preflight.\n if (!options.headers.authorization) {\n Reflect.deleteProperty(options.headers, 'authorization');\n }\n\n return Promise.resolve(options);\n }\n\n return this.requiresCredentials(options).then((requires) => {\n if (!requires) {\n return options;\n }\n\n return this.webex.credentials.getUserToken().then((token) => {\n options.headers.authorization = token.toString();\n\n return options;\n });\n });\n }\n\n /**\n * Determines if the provided options object needs an authorization header.\n *\n * @param {Object} options\n * @returns {Promise<boolean>}\n */\n requiresCredentials(options) {\n // Validate that authorization is necessary.\n if (options.addAuthHeader === false) {\n return Promise.resolve(false);\n }\n\n // Validate that the services plugin has been loaded before proceeding.\n if (!this.webex.internal.services) {\n return Promise.resolve(false);\n }\n\n // Destructure webex instance to isolate services plugin.\n const {services} = this.webex.internal;\n\n // Store the current service details if available and destructure details.\n const details = services.getServiceFromUrl(options.uri || '');\n const {name} = details || {};\n const {resource, uri} = options;\n const service = options.service || options.api;\n\n // Unique validation for the u2c service.\n if ((service && service === 'u2c') || (name && name === 'u2c')) {\n if ((resource && resource.includes('limited')) || (uri && uri.includes('limited'))) {\n return Promise.resolve(false);\n }\n\n return Promise.resolve(true);\n }\n\n // Validate that the allowed domains can be utilized.\n if (\n services.validateDomains &&\n services.hasAllowedDomains() &&\n uri &&\n services.isAllowedDomainUrl(uri)\n ) {\n return Promise.resolve(true);\n }\n\n // Perform an additional validation in case the service does not exist yet.\n return services\n .waitForService({name: service, url: uri})\n .then((detectedUrl) => {\n // Validate that the url exists in the catalog.\n if (services.getServiceFromUrl(detectedUrl)) {\n return true;\n }\n\n // Return false to indicate authentication is not required.\n return false;\n })\n .catch((error) => {\n this.webex.logger.warn(\n 'auth-interceptor: failed to validate service exists in catalog',\n error\n );\n\n return false;\n });\n }\n\n /**\n * @see {@link Interceptor#onResponseError}\n * @param {Object} options\n * @param {Error} reason\n * @returns {Object}\n */\n onResponseError(options, reason) {\n return this.shouldAttemptReauth(reason, options).then((shouldAttemptReauth) => {\n if (shouldAttemptReauth) {\n this.webex.logger.info('auth: received 401, attempting to reauthenticate');\n\n if (reason.options.headers) {\n Reflect.deleteProperty(reason.options.headers, 'authorization');\n }\n\n if (this.webex.credentials.canRefresh) {\n return this.webex.credentials.refresh().then(() => this.replay(options));\n }\n }\n\n return Promise.reject(reason);\n });\n }\n\n /**\n * Replays the request\n * @param {Object} options\n * @returns {Object}\n */\n replay(options) {\n if (options.replayCount) {\n options.replayCount += 1;\n } else {\n options.replayCount = 1;\n }\n\n if (options.replayCount > this.webex.config.maxAuthenticationReplays) {\n this.webex.logger.error(\n `auth: failed after ${this.webex.config.maxAuthenticationReplays} replay attempts`\n );\n\n return Promise.reject(\n new Error(`Failed after ${this.webex.config.maxAuthenticationReplays} replay attempts`)\n );\n }\n\n this.webex.logger.info(`auth: replaying request ${options.replayCount} time`);\n\n return this.webex.request(options);\n }\n\n /**\n * Indicates whether or not the current request should refresh its access\n * token in event of a 401\n * @param {Error} reason\n * @param {Object} options\n * @returns {Promise<boolean>}\n */\n shouldAttemptReauth(reason, options) {\n if (options && options.shouldRefreshAccessToken === false) {\n return Promise.resolve(false);\n }\n\n if (reason.statusCode === 401) {\n return Promise.resolve(true);\n }\n\n return Promise.resolve(false);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAIA,IAAAA,SAAA,GAAAC,OAAA;AAA6C,SAAAC,WAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,WAAAD,CAAA,OAAAE,gBAAA,CAAAC,OAAA,EAAAH,CAAA,OAAAI,2BAAA,CAAAD,OAAA,EAAAJ,CAAA,EAAAM,yBAAA,KAAAC,kBAAA,CAAAN,CAAA,EAAAC,CAAA,YAAAC,gBAAA,CAAAC,OAAA,EAAAJ,CAAA,EAAAQ,WAAA,IAAAP,CAAA,CAAAQ,KAAA,CAAA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;AACA;EANE;IAAAH,GAAA;IAAAC,KAAA,EAOA,SAAA2C,mBAAmBA,CAACF,MAAM,EAAEvC,OAAO,EAAE;MACnC,IAAIA,OAAO,IAAIA,OAAO,CAACqD,wBAAwB,KAAK,KAAK,EAAE;QACzD,OAAOhD,QAAA,CAAAzB,OAAA,CAAQ0B,OAAO,CAAC,KAAK,CAAC;MAC/B;MAEA,IAAIiC,MAAM,CAACe,UAAU,KAAK,GAAG,EAAE;QAC7B,OAAOjD,QAAA,CAAAzB,OAAA,CAAQ0B,OAAO,CAAC,IAAI,CAAC;MAC9B;MAEA,OAAOD,QAAA,CAAAzB,OAAA,CAAQ0B,OAAO,CAAC,KAAK,CAAC;IAC/B;EAAC;IAAAT,GAAA;IAAAC,KAAA;IA9KD;AACF;AACA;IACE,SAAOyD,MAAMA,CAAA,EAAG;MACd,OAAO,IAAIjE,eAAe,CAAC;QAACoB,KAAK,EAAE;MAAI,CAAC,CAAC;IAC3C;EAAC;AAAA,EAN0C8C,qBAAW","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_httpCore","require","_callSuper","t","o","e","_getPrototypeOf2","default","_possibleConstructorReturn2","_isNativeReflectConstruct","_Reflect$construct","constructor","apply","Boolean","prototype","valueOf","call","AuthInterceptor","exports","_Interceptor","_classCallCheck2","arguments","_inherits2","_createClass2","key","value","onRequest","options","_this","headers","authorization","_deleteProperty","_promise","resolve","requiresCredentials","then","requires","webex","credentials","getUserToken","token","toString","_this2","addAuthHeader","internal","services","details","getServiceFromUrl","uri","_ref","name","resource","service","api","includes","validateDomains","hasAllowedDomains","isAllowedDomainUrl","waitForService","url","detectedUrl","catch","error","logger","warn","onResponseError","reason","_this3","shouldAttemptReauth","info","canRefresh","refresh","refreshStatus","statusCode","status","catalogAuthStatus","reject","replay","replayCount","config","maxAuthenticationReplays","concat","Error","request","shouldRefreshAccessToken","create","Interceptor"],"sources":["auth.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {Interceptor} from '@webex/http-core';\n\n/**\n * @class\n */\nexport default class AuthInterceptor extends Interceptor {\n /**\n * @returns {AuthInterceptor}\n */\n static create() {\n return new AuthInterceptor({webex: this});\n }\n\n /**\n * @see {@link Interceptor#onRequest}\n * @param {Object} options\n * @returns {Object}\n */\n onRequest(options) {\n options.headers = options.headers || {};\n\n // If Authorizations is already set, don't overwrite it\n if ('authorization' in options.headers || 'auth' in options) {\n // If Authorization is set to null, false, or undefined, delete it to\n // prevent a CORS preflight.\n if (!options.headers.authorization) {\n Reflect.deleteProperty(options.headers, 'authorization');\n }\n\n return Promise.resolve(options);\n }\n\n return this.requiresCredentials(options).then((requires) => {\n if (!requires) {\n return options;\n }\n\n return this.webex.credentials.getUserToken().then((token) => {\n options.headers.authorization = token.toString();\n\n return options;\n });\n });\n }\n\n /**\n * Determines if the provided options object needs an authorization header.\n *\n * @param {Object} options\n * @returns {Promise<boolean>}\n */\n requiresCredentials(options) {\n // Validate that authorization is necessary.\n if (options.addAuthHeader === false) {\n return Promise.resolve(false);\n }\n\n // Validate that the services plugin has been loaded before proceeding.\n if (!this.webex.internal.services) {\n return Promise.resolve(false);\n }\n\n // Destructure webex instance to isolate services plugin.\n const {services} = this.webex.internal;\n\n // Store the current service details if available and destructure details.\n const details = services.getServiceFromUrl(options.uri || '');\n const {name} = details || {};\n const {resource, uri} = options;\n const service = options.service || options.api;\n\n // Unique validation for the u2c service.\n if ((service && service === 'u2c') || (name && name === 'u2c')) {\n if ((resource && resource.includes('limited')) || (uri && uri.includes('limited'))) {\n return Promise.resolve(false);\n }\n\n return Promise.resolve(true);\n }\n\n // Validate that the allowed domains can be utilized.\n if (\n services.validateDomains &&\n services.hasAllowedDomains() &&\n uri &&\n services.isAllowedDomainUrl(uri)\n ) {\n return Promise.resolve(true);\n }\n\n // Perform an additional validation in case the service does not exist yet.\n return services\n .waitForService({name: service, url: uri})\n .then((detectedUrl) => {\n // Validate that the url exists in the catalog.\n if (services.getServiceFromUrl(detectedUrl)) {\n return true;\n }\n\n // Return false to indicate authentication is not required.\n return false;\n })\n .catch((error) => {\n this.webex.logger.warn(\n 'auth-interceptor: failed to validate service exists in catalog',\n error\n );\n\n return false;\n });\n }\n\n /**\n * @see {@link Interceptor#onResponseError}\n * @param {Object} options\n * @param {Error} reason\n * @returns {Object}\n */\n onResponseError(options, reason) {\n return this.shouldAttemptReauth(reason, options).then((shouldAttemptReauth) => {\n if (shouldAttemptReauth) {\n this.webex.logger.info('auth: received 401, attempting to reauthenticate');\n\n if (reason.options.headers) {\n Reflect.deleteProperty(reason.options.headers, 'authorization');\n }\n\n if (this.webex.credentials.canRefresh) {\n return this.webex.credentials\n .refresh()\n .catch((error) => {\n const refreshStatus = error && (error.statusCode || error.status);\n\n // A refresh 403 is not a catalog 403. Keep the original 401 for\n // catalog auth reporting and leave statusCode unchanged.\n if (reason.statusCode === 401 && refreshStatus === 403 && error) {\n error.catalogAuthStatus = 401;\n }\n\n return Promise.reject(error);\n })\n .then(() => this.replay(options));\n }\n }\n\n return Promise.reject(reason);\n });\n }\n\n /**\n * Replays the request\n * @param {Object} options\n * @returns {Object}\n */\n replay(options) {\n if (options.replayCount) {\n options.replayCount += 1;\n } else {\n options.replayCount = 1;\n }\n\n if (options.replayCount > this.webex.config.maxAuthenticationReplays) {\n this.webex.logger.error(\n `auth: failed after ${this.webex.config.maxAuthenticationReplays} replay attempts`\n );\n\n return Promise.reject(\n new Error(`Failed after ${this.webex.config.maxAuthenticationReplays} replay attempts`)\n );\n }\n\n this.webex.logger.info(`auth: replaying request ${options.replayCount} time`);\n\n return this.webex.request(options);\n }\n\n /**\n * Indicates whether or not the current request should refresh its access\n * token in event of a 401\n * @param {Error} reason\n * @param {Object} options\n * @returns {Promise<boolean>}\n */\n shouldAttemptReauth(reason, options) {\n if (options && options.shouldRefreshAccessToken === false) {\n return Promise.resolve(false);\n }\n\n if (reason.statusCode === 401) {\n return Promise.resolve(true);\n }\n\n return Promise.resolve(false);\n }\n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