@webex/plugin-authorization-browser-first-party 3.12.0 → 3.13.0-next.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/.repo-context.json +426 -0
- package/.sdd/manifest.json +395 -0
- package/AGENTS.md +214 -0
- package/README.md +70 -7
- package/dist/authorization.js +185 -30
- package/dist/authorization.js.map +1 -1
- package/dist/config.js +42 -13
- package/dist/config.js.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/docs/adr/0001-retain-product-readme.md +102 -0
- package/docs/adr/index.md +25 -0
- package/docs/architecture.md +301 -0
- package/docs/getting-started.md +98 -0
- package/docs/index.md +42 -0
- package/docs/specs/README.md +69 -0
- package/package.json +13 -13
- package/schemas/repo-context.schema.json +796 -0
- package/src/authorization.js +183 -35
- package/src/config.js +28 -8
- package/src/docs/README.md +657 -0
- package/src/index.js +1 -1
- package/test/unit/spec/authorization.js +660 -90
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: Architecture
|
|
3
|
+
title: '@webex/plugin-authorization-browser-first-party architecture'
|
|
4
|
+
description: Package-wide boundaries, resources, interactions, dependencies, and cross-cutting architecture.
|
|
5
|
+
tags: [architecture]
|
|
6
|
+
---
|
|
7
|
+
<!-- sdd-generated-metadata
|
|
8
|
+
doc_kind: standing-doc
|
|
9
|
+
generated_from: architecture@0.3.0
|
|
10
|
+
generated_by: claude-code
|
|
11
|
+
approved_by: rarajes2@cisco.com
|
|
12
|
+
updated_at: 2026-11-03T06:25:15Z
|
|
13
|
+
validation_status: pass
|
|
14
|
+
-->
|
|
15
|
+
|
|
16
|
+
# @webex/plugin-authorization-browser-first-party architecture
|
|
17
|
+
|
|
18
|
+
Canonical architecture for this package. Flow behavior lives in the
|
|
19
|
+
[first-party browser authorization plugin specification](../src/docs/README.md). This page owns
|
|
20
|
+
package boundaries, the plugin registration, the contract index, and how the package meets the rest of
|
|
21
|
+
the SDK.
|
|
22
|
+
|
|
23
|
+
Related context: [specification registry](specs/README.md) ·
|
|
24
|
+
[package agent instructions](../AGENTS.md)
|
|
25
|
+
|
|
26
|
+
## Applicability
|
|
27
|
+
|
|
28
|
+
| Condition ID | Status | Evidence or reason | Owned section |
|
|
29
|
+
| ------------------------------------ | ---------- | ------------------ | ------------- |
|
|
30
|
+
| `repo.owns_datastore` | N/A | No database, file store, or migration in `src/authorization.js`; two transient sessionStorage keys are client state | Repository data and schema |
|
|
31
|
+
| `repo.holds_client_state` | Applicable | Session properties, polling timers, and sessionStorage secrets in `src/authorization.js` | Client state model |
|
|
32
|
+
| `repo.components_interact` | Applicable | `src/authorization.js` calls webex-core credentials and services, and webex-core calls its logout method | Dependency and interaction topology |
|
|
33
|
+
| `repo.domain_data_across_components` | Applicable | Token responses obtained in `src/authorization.js` are stored by webex-core credentials | Object and data ownership |
|
|
34
|
+
| `repo.caches_data` | N/A | `src/authorization.js` keeps no cache | Caching catalog |
|
|
35
|
+
| `repo.observability_convention` | Applicable | `src/authorization.js` logs with an authorization: prefix and emits login events | Observability patterns |
|
|
36
|
+
| `repo.deploys_to_infra` | N/A | Library published to npm (`package.json`). No service runtime | Runtime and infrastructure |
|
|
37
|
+
| `repo.shared_base_libs` | Applicable | Extends WebexPlugin from webex-core and uses the legacy build, lint, and test stack (`babel.config.js`, `jest.config.js`, `.eslintrc.js`) | Shared and base libraries |
|
|
38
|
+
| `repo.is_monorepo` | N/A | This SDD root is one package. The workspace around it is out of scope | Package map and inter-package dependencies |
|
|
39
|
+
| `repo.multi_platform` | N/A | Browser only: `src/authorization.js` uses window, history, sessionStorage, and crypto; `process` exports {browser: true} | Platform matrix |
|
|
40
|
+
| `repo.published_package` | Applicable | `package.json` name is @webex/plugin-authorization-browser-first-party and deploy:npm publishes it | Release and versioning |
|
|
41
|
+
| `repo.embedded_in_host` | N/A | No host theme or embed API in `src/authorization.js` | Host integration and theming |
|
|
42
|
+
| `repo.exposes_commands_or_artifacts` | Applicable | build:src in `package.json` writes dist | Commands and generated artifacts |
|
|
43
|
+
| `repo.cross_repo_deps_material` | Applicable | Behavior depends on webex-core credentials, services, and the identity broker and oauth-helper services (`src/authorization.js`) | Cross-repository topology |
|
|
44
|
+
| `repo.security_arch_warranted` | Applicable | OAuth codes, PKCE, CSRF tokens, client secrets, and supertokens pass through `src/authorization.js` and `src/config.js` | Security architecture |
|
|
45
|
+
|
|
46
|
+
## Design overview
|
|
47
|
+
|
|
48
|
+
`@webex/plugin-authorization-browser-first-party` is a published browser library with one module.
|
|
49
|
+
Importing it registers `Authorization` as the public plugin `authorization`, which replaces the
|
|
50
|
+
standard browser authorization plugin when it is imported first, as `webex-first-party.js` in the
|
|
51
|
+
`webex` package does. The plugin starts logins, finishes authorization-code logins automatically when
|
|
52
|
+
the page loads with `?code=`, runs device (QR) login, handles the third-party login callback, and
|
|
53
|
+
redirects on logout.
|
|
54
|
+
|
|
55
|
+
The plugin owns flows, not tokens. A successful authorization-code exchange or device poll ends with
|
|
56
|
+
`webex.credentials.set({supertoken})`; the third-party callback returns its values to the caller and
|
|
57
|
+
logout only navigates. URL builders, token refresh scheduling, and OAuth error
|
|
58
|
+
classes stay in webex-core credentials. The package adds the browser `refreshCallback` and the
|
|
59
|
+
`clientType` default to the shared `credentials` configuration.
|
|
60
|
+
|
|
61
|
+
The package makes outbound HTTP calls and browser navigations only. It serves no routes and persists
|
|
62
|
+
nothing beyond two single-use `sessionStorage` entries.
|
|
63
|
+
|
|
64
|
+
## Resource inventory and responsibilities
|
|
65
|
+
|
|
66
|
+
| Resource | Kind | Responsibility | Owner | Source | Detailed specification |
|
|
67
|
+
| -------- | ---- | -------------- | ----- | ------ | ---------------------- |
|
|
68
|
+
| First-party browser authorization plugin | package (one module) | Code login with PKCE and CSRF, startup completion, token exchange and refresh callback, third-party callback, QR device login, logout redirect | @webex/web-client | `src` | [`src/docs/README.md`](../src/docs/README.md) |
|
|
69
|
+
|
|
70
|
+
## Interaction and execution flows
|
|
71
|
+
|
|
72
|
+
Representative end-to-end flow: the web client starts a login, the identity broker redirects back with
|
|
73
|
+
a code, the plugin exchanges it on the next page load, and credentials hold the supertoken.
|
|
74
|
+
|
|
75
|
+
```mermaid
|
|
76
|
+
flowchart LR
|
|
77
|
+
Client[Web client] -->|initiateLogin| Auth[Authorization plugin]
|
|
78
|
+
Auth -->|buildLoginUrl| Cred[webex-core credentials]
|
|
79
|
+
Auth -->|window.location| IdB[Identity broker]
|
|
80
|
+
IdB -->|redirect with code| Auth
|
|
81
|
+
Auth -->|collectPreauthCatalog| Svc[webex-core services]
|
|
82
|
+
Auth -->|POST token form| Token[Token endpoint]
|
|
83
|
+
Token -->|supertoken| Auth
|
|
84
|
+
Auth -->|set supertoken| Cred
|
|
85
|
+
Auth -->|qRCodeLogin events| Client
|
|
86
|
+
Auth -->|device authorize and token| Helper[oauth-helper service]
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
| From | To | Interaction or transport | Purpose | Failure or compatibility behavior |
|
|
90
|
+
| ---- | -- | ------------------------ | ------- | --------------------------------- |
|
|
91
|
+
| Web client | Authorization plugin | In-process calls and `eventEmitter` events | Start logins, observe QR progress | Redirect and CSRF failures throw during `initialize` |
|
|
92
|
+
| Authorization plugin | Identity broker | Browser navigation | Login and logout pages | No retry; user restarts login |
|
|
93
|
+
| Authorization plugin | Token endpoint | HTTPS POST form through `webex.request` | Code exchange and refresh | 400 maps to grant errors; others propagate |
|
|
94
|
+
| Authorization plugin | `oauth-helper` service | HTTPS POST form, timer polling | Device authorization | Reported through `qRCodeLogin` events |
|
|
95
|
+
| Authorization plugin | webex-core services | In-process call | Preauth catalog before the exchange | Failure ignored |
|
|
96
|
+
| webex-core | Authorization plugin | `logout()` call | Logout redirect | `noRedirect` skips navigation |
|
|
97
|
+
|
|
98
|
+
## Dependency topology
|
|
99
|
+
|
|
100
|
+
| Dependency | Type | Used by | Purpose | Version, failure, or fallback policy |
|
|
101
|
+
| ---------- | ---- | ------- | ------- | ------------------------------------ |
|
|
102
|
+
| `@webex/webex-core` | Internal | `src/index.js`, `src/authorization.js` | Plugin base, registration, request, credentials, services, grant errors | Workspace version (`workspace:*` in `package.json`) |
|
|
103
|
+
| `@webex/common` | Internal | `src/authorization.js` | `oneFlight`, `whileInFlight`, `encodeState`, `decodeState` | Workspace version |
|
|
104
|
+
| `crypto-js` | External | `src/authorization.js` | SHA-256 and base64url | `^4.1.1` in `package.json` |
|
|
105
|
+
| `uuid` | External | `src/authorization.js` | CSRF token | `^3.3.2` in `package.json` |
|
|
106
|
+
| `lodash` | External | `src/authorization.js` | Object helpers | `^4.17.21` in `package.json` |
|
|
107
|
+
| Identity broker and token endpoint | External service | `src/authorization.js`, `src/config.js` | Login pages and token grants | URLs come from credentials config |
|
|
108
|
+
| `oauth-helper` service | External service | `src/authorization.js` | Device authorization | Reached by service name through the services catalog |
|
|
109
|
+
|
|
110
|
+
`package.json` also lists `@webex/storage-adapter-local-storage` and several `@webex/test-helper-*`
|
|
111
|
+
packages under `dependencies`; `src/` imports none of them. No import cycle exists: this package
|
|
112
|
+
imports webex-core and common, and webex-core reaches this plugin only through the registered child.
|
|
113
|
+
|
|
114
|
+
## Public and consumer surfaces
|
|
115
|
+
|
|
116
|
+
| Surface | Type | Owner | Consumers | Compatibility policy | Source |
|
|
117
|
+
| ------- | ---- | ----- | --------- | -------------------- | ------ |
|
|
118
|
+
| `authorization-browser-first-party-sdk` — package @webex/plugin-authorization-browser-first-party, the `webex.authorization` API, and the `credentials` config defaults | SDK, published to npm, internal by intent | First-party browser authorization plugin | `webex` first-party entry, `recipe-private-web-client`, Webex web client | Class JSDoc marks it private and discourages other use; no versioning rule in the package | `package.json`, `src/index.js`, `src/authorization.js`, `src/config.js` |
|
|
119
|
+
| `authorization-plugin-events` — `login` and `qRCodeLogin` on `webex.authorization.eventEmitter` | Event | First-party browser authorization plugin | Webex web client | Hosts switch on `eventType` | `src/authorization.js` |
|
|
120
|
+
|
|
121
|
+
The token-endpoint and `oauth-helper` requests are internal protocols, described under *Protocol and
|
|
122
|
+
wire format* in the [module specification](../src/docs/README.md#protocol-and-wire-format), not
|
|
123
|
+
published contracts of this package.
|
|
124
|
+
|
|
125
|
+
## Client state model
|
|
126
|
+
|
|
127
|
+
| State or slice | Owner | Transition triggers | Persistence or reset boundary |
|
|
128
|
+
| -------------- | ----- | ------------------- | ----------------------------- |
|
|
129
|
+
| `isAuthorizing`, `ready`, `initialAuthorizationCodeGrantOutcome` | Authorization plugin | Login initiation, code exchange, startup completion | In memory for the instance; the outcome is not reset by logout |
|
|
130
|
+
| QR polling timers and poll id | Authorization plugin | `initQRCodeLogin`, poll responses, timeout, cancel | In memory |
|
|
131
|
+
| `oauth2-csrf-token`, `oauth2-code-verifier` | Authorization plugin | Written at login initiation; removed on first read | Browser `sessionStorage`; single use |
|
|
132
|
+
| Supertoken | webex-core credentials | Set by this plugin after a code exchange or device poll | Owned by credentials |
|
|
133
|
+
|
|
134
|
+
## Cross-cutting architecture
|
|
135
|
+
|
|
136
|
+
### Security
|
|
137
|
+
|
|
138
|
+
- Trust boundaries and identity flow: see [Security architecture](#security-architecture). The plugin
|
|
139
|
+
builds requests and navigations; credentials stores tokens, and webex-core adds transport.
|
|
140
|
+
- Sensitive surfaces and data classes: authorization codes, PKCE verifiers, CSRF tokens, client
|
|
141
|
+
secrets, supertokens, third-party `id_token` values, and email addresses (hashed in `initiateLogin`;
|
|
142
|
+
returned raw by `handleThirdPartyCallback`).
|
|
143
|
+
- Encryption and secret boundaries: the CSRF token travels in the `state` of the authorize and
|
|
144
|
+
third-party login URLs; the PKCE verifier travels only in the token-exchange form; `client_secret`
|
|
145
|
+
travels only in the HTTP Basic `Authorization` header (confidential token requests and every
|
|
146
|
+
`oauth-helper` request), while a public client sends only `client_id` in the form; the QR token
|
|
147
|
+
response is also emitted on `eventEmitter`; the logout URL carries the refresh or access token that
|
|
148
|
+
`WebexCore#logout` places in `options.token`. The raw email is replaced by its SHA-256 in
|
|
149
|
+
`initiateLogin`.
|
|
150
|
+
|
|
151
|
+
### Observability and operations
|
|
152
|
+
|
|
153
|
+
- Logging and correlation: `this.logger.info` messages prefixed `authorization:` and one
|
|
154
|
+
`this.logger.warn` when the startup exchange fails.
|
|
155
|
+
- Metrics, traces, and audit signals: none emitted here; the `login` events give hosts a hook.
|
|
156
|
+
- Ownership and operational entry points: `.github/CODEOWNERS` at the workspace root routes the package
|
|
157
|
+
to `@webex/web-client`. No dashboards or runbooks are recorded in this package.
|
|
158
|
+
|
|
159
|
+
### Quality attributes
|
|
160
|
+
|
|
161
|
+
- Compatibility: the web client relies on method names, the `eventType` vocabulary, and the
|
|
162
|
+
`sessionStorage` key names across page loads.
|
|
163
|
+
- Footprint: three source files; runtime imports are webex-core, common, crypto-js, uuid, and lodash.
|
|
164
|
+
- Test confidence: one unit spec covers most flows; registration, the 400 mapping, and the logout
|
|
165
|
+
redirect are untested. No coverage threshold is enforced.
|
|
166
|
+
|
|
167
|
+
## Dependency and interaction topology
|
|
168
|
+
|
|
169
|
+
```mermaid
|
|
170
|
+
flowchart LR
|
|
171
|
+
Index[src/index.js] -->|registerPlugin authorization| Core[webex-core]
|
|
172
|
+
Index --> AuthClass[src/authorization.js]
|
|
173
|
+
Index --> Config[src/config.js]
|
|
174
|
+
AuthClass -->|extends WebexPlugin, request| Core
|
|
175
|
+
AuthClass -->|URL builders, set supertoken| Cred[webex-core credentials]
|
|
176
|
+
AuthClass -->|collectPreauthCatalog, get| Svc[webex-core services]
|
|
177
|
+
AuthClass -->|decorators, state codec| Common[common]
|
|
178
|
+
Cred -->|refreshCallback| Config
|
|
179
|
+
Core -->|logout| AuthClass
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
| From | To | Kind | Purpose | Ordering or failure boundary |
|
|
183
|
+
| ---- | -- | ---- | ------- | ---------------------------- |
|
|
184
|
+
| `src/index.js` | `src/authorization.js`, `src/config.js` | Import | Build and register the plugin | Registration happens at import time; first registration wins |
|
|
185
|
+
| `src/authorization.js` | webex-core credentials | Call | URLs, token storage, grant errors | Builder throws propagate |
|
|
186
|
+
| `src/authorization.js` | webex-core services | Call | Preauth catalog, `oauth-helper` URL | Catalog failure ignored |
|
|
187
|
+
| `src/authorization.js` | `@webex/common` | Import | Decorators and state encoding | Malformed state throws |
|
|
188
|
+
| webex-core credentials | `src/config.js` | Call | Browser token refresh | Rejection propagates to credentials |
|
|
189
|
+
| webex-core | `src/authorization.js` | Call | `logout` at the end of `WebexCore#logout` | Runs after credentials are invalidated |
|
|
190
|
+
|
|
191
|
+
## Object and data ownership
|
|
192
|
+
|
|
193
|
+
| Object or state | System of record | May write | May read | Movement or lifecycle |
|
|
194
|
+
| --------------- | ---------------- | --------- | -------- | --------------------- |
|
|
195
|
+
| Supertoken (access and refresh token bundle) | webex-core credentials | This plugin (after an exchange or device poll), credentials (refresh) | Credentials and every plugin through it | Created here, refreshed through `refreshCallback`, invalidated on logout |
|
|
196
|
+
| CSRF token and PKCE verifier | Browser `sessionStorage` | This plugin | This plugin | Written at initiation, removed at the next read |
|
|
197
|
+
| OAuth `state` payload | The authorize URL and the redirect URL | This plugin through credentials `buildLoginUrl` | This plugin on return | base64url JSON; `csrf_token` removed from the URL after use |
|
|
198
|
+
|
|
199
|
+
## Observability patterns
|
|
200
|
+
|
|
201
|
+
| Signal | Convention or required fields | Propagation or naming rule | Primary evidence |
|
|
202
|
+
| ------- | ----------------------------- | -------------------------- | ---------------- |
|
|
203
|
+
| Logs | `info` messages describe the step; the failed startup exchange logs `warn` with the error | Messages start with `authorization:` (the exchange logs `credentials:`); no token values are logged | `src/authorization.js` |
|
|
204
|
+
| Metrics | None | N/A | `src/authorization.js` |
|
|
205
|
+
| Traces | None | N/A | `src/authorization.js` |
|
|
206
|
+
| Audit | `login` events `initiateLogin` and `redirectToLoginUrl` on `eventEmitter` | `{eventType, data}`; `initiateLogin` carries booleans only, not the email | `src/authorization.js` |
|
|
207
|
+
|
|
208
|
+
## Shared and base libraries
|
|
209
|
+
|
|
210
|
+
| Library | Inherited responsibility | Consumers | Version floor | Compatibility rule |
|
|
211
|
+
| ------- | ------------------------ | --------- | ------------- | ------------------ |
|
|
212
|
+
| `@webex/webex-core` `WebexPlugin` | `webex`, `request`, namespaced `config`, `logger`, `initialize` hook, session and derived props | `Authorization` | `workspace:*` | Keep `initialize` delegating to `WebexPlugin.prototype.initialize` first |
|
|
213
|
+
| `@webex/common` decorators | `oneFlight`, `whileInFlight` | `Authorization` | `workspace:*` | Keep decorator order on `requestAuthorizationCodeGrant` |
|
|
214
|
+
| `@webex/babel-config-legacy`, `@webex/eslint-config-legacy`, `@webex/jest-config-legacy`, `@webex/legacy-tools` | Build, lint, and test stack through one-line config files | Package tooling | `workspace:*` | Do not fork the config locally |
|
|
215
|
+
|
|
216
|
+
## Release and versioning
|
|
217
|
+
|
|
218
|
+
| Artifact | Publish target | Versioning rule | Deprecation window | Changelog or migration obligation |
|
|
219
|
+
| -------- | -------------- | --------------- | ------------------ | --------------------------------- |
|
|
220
|
+
| @webex/plugin-authorization-browser-first-party | npm through `deploy:npm` | None declared in the package; the README and class JSDoc describe it as internal to the Webex web client | None declared | None declared in the package; the workspace owns changelog generation |
|
|
221
|
+
|
|
222
|
+
## Commands and generated artifacts
|
|
223
|
+
|
|
224
|
+
| Command or artifact | Owner | Inputs | Output or side effect | Compatibility boundary |
|
|
225
|
+
| ------------------- | ----- | ------ | --------------------- | ---------------------- |
|
|
226
|
+
| `yarn workspace @webex/plugin-authorization-browser-first-party build:src` | Package scripts | `src` | Writes `dist/` through `webex-legacy-tools` (JavaScript, TypeScript, source maps) | `dist/` is generated and never edited by hand; unit tests load it |
|
|
227
|
+
| `yarn workspace @webex/plugin-authorization-browser-first-party test:unit` | Package scripts | `test/unit/spec` | Jest run | Requires a current `dist/` |
|
|
228
|
+
| `yarn workspace @webex/plugin-authorization-browser-first-party test:style` | Package scripts | `src` | ESLint run | Markdown under `src/` is ignored by the root `.eslintignore` |
|
|
229
|
+
|
|
230
|
+
## Cross-repository topology
|
|
231
|
+
|
|
232
|
+
| Repository or external system | Relationship | Exchanged contract or artifact | Owner | Sequencing constraint |
|
|
233
|
+
| ----------------------------- | ------------ | ------------------------------ | ----- | --------------------- |
|
|
234
|
+
| `@webex/webex-core` (workspace sibling; module specs consulted) | Consumes | `WebexPlugin`, `registerPlugin`, credentials, services, grant errors | @webex/web-sdk | Registration before any other `authorization` plugin |
|
|
235
|
+
| `@webex/common` (workspace sibling; module spec consulted) | Consumes | Decorators and OAuth state codec | @webex/web-sdk | None |
|
|
236
|
+
| `webex` and `recipe-private-web-client` (workspace siblings) | Provides to | Import side effect registering `authorization` | @webex/web-client | `webex-first-party.js` imports this package before `./webex` |
|
|
237
|
+
| Identity broker and token endpoint | Consumes | Authorize, logout, and token endpoints from credentials config | Not recorded in this repository | Redirect URI must match `redirect_uri` |
|
|
238
|
+
| `oauth-helper` service | Consumes | `/actions/device/authorize` and `/actions/device/token` | Not recorded in this repository | Catalog must resolve `oauth-helper` |
|
|
239
|
+
|
|
240
|
+
## Security architecture
|
|
241
|
+
|
|
242
|
+
```mermaid
|
|
243
|
+
flowchart LR
|
|
244
|
+
User[User in browser] -->|login page| IdB[Identity broker]
|
|
245
|
+
Auth[Authorization plugin] -->|state with csrf_token, code_challenge, emailHash| IdB
|
|
246
|
+
IdB -->|code and state on redirect| Auth
|
|
247
|
+
Store[sessionStorage single-use csrf and verifier] --> Auth
|
|
248
|
+
Auth -->|code, code_verifier, client auth| Token[Token endpoint]
|
|
249
|
+
Token -->|token body| Auth
|
|
250
|
+
Auth -->|device_code, Basic client auth| Helper[oauth-helper]
|
|
251
|
+
Helper -->|token body| Auth
|
|
252
|
+
Auth -->|set supertoken| Cred[webex-core credentials]
|
|
253
|
+
Auth -->|qRCodeLogin authorizationSuccess with token body| Listeners[eventEmitter listeners]
|
|
254
|
+
Auth -->|login redirectToLoginUrl with full login URL| Listeners
|
|
255
|
+
Auth -->|handleThirdPartyCallback returns idToken and email| Caller[Callback caller]
|
|
256
|
+
Auth -->|logout URL query with token| IdB
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
- The browser tab holds the stored copies of the CSRF token and the PKCE verifier in `sessionStorage`,
|
|
260
|
+
and each is removed when first read. The CSRF token also travels in the base64url `state` of the
|
|
261
|
+
authorize and third-party login URLs and returns in the redirect. The verifier is sent only in the
|
|
262
|
+
token-exchange form; the authorize URL carries only its S256 `code_challenge`.
|
|
263
|
+
- Before navigating, `initiateAuthorizationCodeGrant` emits the full login URL, with the CSRF token,
|
|
264
|
+
caller state, and email hash in `state`, as the `login` `redirectToLoginUrl` event. Every `login`
|
|
265
|
+
listener on the shared `eventEmitter` receives it, a trust boundary inside the page.
|
|
266
|
+
- The redirect is checked against the stored CSRF token when one exists; the third-party callback
|
|
267
|
+
requires one. Only after that check passes are the authorization code, `id_token`, email, and CSRF
|
|
268
|
+
token scrubbed from the visible URL, and only when `history.replaceState` exists. A missing or
|
|
269
|
+
mismatched token, or a malformed `state`, throws first and leaves those values in the URL.
|
|
270
|
+
- Client authentication is public (`client_id` in the form) by default and HTTP Basic for confidential
|
|
271
|
+
clients; the device flow always uses HTTP Basic with `client_secret`. Under HTTP Basic the secret is
|
|
272
|
+
in the `Authorization` header, never in the form body.
|
|
273
|
+
- Tokens leave this module through `webex.credentials.set`, and for QR login also through the
|
|
274
|
+
`qRCodeLogin` `authorizationSuccess` event, whose `data` is the token response body. That event is
|
|
275
|
+
emitted before the supertoken is set and reaches every listener on the shared `eventEmitter`. After a
|
|
276
|
+
successful CSRF check, `handleThirdPartyCallback` also returns the raw `id_token` and email from the
|
|
277
|
+
redirect URL directly to its caller, outside credentials. On logout without `noRedirect`, the token
|
|
278
|
+
that `WebexCore#logout` defaults into `options.token` (refresh token, else access token) is spread
|
|
279
|
+
into the logout URL query by `buildLogoutUrl` and sent to the identity broker as a browser
|
|
280
|
+
navigation, so it also appears in the URL. The authoritative credential policy is the webex-core
|
|
281
|
+
credentials specification.
|
|
282
|
+
|
|
283
|
+
## Domain language
|
|
284
|
+
|
|
285
|
+
| Term | Repository-specific meaning | Authoritative source |
|
|
286
|
+
| ---- | --------------------------- | -------------------- |
|
|
287
|
+
| First party | The Webex web client, the only intended consumer | `src/authorization.js` |
|
|
288
|
+
| Supertoken | The access and refresh token bundle stored by credentials | webex-core credentials (sibling package) |
|
|
289
|
+
| Startup completion | The automatic code exchange in `initialize` when the page URL has `code` | `src/authorization.js` |
|
|
290
|
+
| Initial authorization-code grant outcome | The retained `not_attempted`, `success`, or `failure` of startup completion | `src/authorization.js` |
|
|
291
|
+
| Preauth catalog | A limited service catalog fetched with an `emailhash` or `orgId` hint before the exchange | `src/authorization.js` |
|
|
292
|
+
| QR code login | The OAuth device authorization flow through `oauth-helper` | `src/authorization.js` |
|
|
293
|
+
| Client type | `public` (client id in the form) or any other value (HTTP Basic with secret) | `src/config.js` |
|
|
294
|
+
|
|
295
|
+
## References and maintenance
|
|
296
|
+
|
|
297
|
+
- Decisions: [adr/](adr/index.md)
|
|
298
|
+
- Instantiated specifications and routing: [specs/README.md](specs/README.md)
|
|
299
|
+
- Repository rules and patterns: [package agent instructions](../AGENTS.md)
|
|
300
|
+
- Update this document in the same change that alters package boundaries, resource ownership,
|
|
301
|
+
cross-resource interaction, or cross-cutting architecture.
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: Getting Started
|
|
3
|
+
title: Getting started
|
|
4
|
+
description: Local setup, build, run, and test routing for @webex/plugin-authorization-browser-first-party.
|
|
5
|
+
tags: [onboarding]
|
|
6
|
+
---
|
|
7
|
+
<!-- sdd-generated-metadata
|
|
8
|
+
doc_kind: standing-doc
|
|
9
|
+
generated_from: getting-started@0.3.0
|
|
10
|
+
generated_by: claude-code
|
|
11
|
+
approved_by: rarajes2@cisco.com
|
|
12
|
+
updated_at: 2026-11-03T06:25:15Z
|
|
13
|
+
validation_status: pass
|
|
14
|
+
-->
|
|
15
|
+
|
|
16
|
+
# Getting started
|
|
17
|
+
|
|
18
|
+
Onboarding for **@webex/plugin-authorization-browser-first-party**, a package inside the
|
|
19
|
+
`webex-js-sdk` Yarn workspace. Run every command from the workspace root.
|
|
20
|
+
|
|
21
|
+
## Prerequisites
|
|
22
|
+
|
|
23
|
+
| Tool or access | Version or requirement |
|
|
24
|
+
| -------------- | ---------------------- |
|
|
25
|
+
| Node.js | `>=8` per this package's `engines`; the workspace `.nvmrc` selects `lts/jod` and the root `AGENTS.md` asks for 22.14 |
|
|
26
|
+
| Yarn | `yarn@3.4.1` (`packageManager` in the workspace root `package.json`) |
|
|
27
|
+
| Registry or account access | N/A for building and unit tests; the skipped automation suite needs test users and a redirect URI |
|
|
28
|
+
|
|
29
|
+
## Install
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
yarn
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The workspace `deploy.yml` workflow installs with the same command.
|
|
36
|
+
|
|
37
|
+
## Build
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
yarn workspace @webex/plugin-authorization-browser-first-party build
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`build` runs `build:src`, which writes `dist/` through `webex-legacy-tools`. `dist/` is ignored by Git.
|
|
44
|
+
|
|
45
|
+
## Run
|
|
46
|
+
|
|
47
|
+
N/A — this is a browser library with no start script. Import
|
|
48
|
+
`@webex/plugin-authorization-browser-first-party` before any other authorization plugin and create a
|
|
49
|
+
webex instance; the plugin is then `webex.authorization`.
|
|
50
|
+
|
|
51
|
+
## Tests
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
yarn workspace @webex/plugin-authorization-browser-first-party build:src
|
|
55
|
+
yarn workspace @webex/plugin-authorization-browser-first-party test:unit
|
|
56
|
+
yarn workspace @webex/plugin-authorization-browser-first-party test:style
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
| Tier | Command | Test location | Framework | External dependencies |
|
|
60
|
+
| ---- | ------- | ------------- | --------- | --------------------- |
|
|
61
|
+
| Unit | `yarn workspace @webex/plugin-authorization-browser-first-party test:unit` | `test/unit/spec` | jest runner through `webex-legacy-tools`, with chai, sinon, and `@webex/test-helper-mock-webex` | A current `dist/` (the spec imports the package by name) |
|
|
62
|
+
| Browser | None runnable: `test:browser` collects `test/integration/spec`, which does not exist | — | karma through `webex-legacy-tools` | — |
|
|
63
|
+
| Automation | None runnable from the package: `test/automation/spec/authorization-code-grant.js` is `describe.skip` | `test/automation/spec` | mocha-style spec with `@webex/test-helper-automation` | Live Webex services, test users, `WEBEX_REDIRECT_URI` |
|
|
64
|
+
|
|
65
|
+
- Coverage or quality gate: none; the legacy Jest configuration sets `collectCoverage: false`
|
|
66
|
+
- Enforcement source: N/A
|
|
67
|
+
- Test environment or QA dependencies: none for unit tests
|
|
68
|
+
|
|
69
|
+
Do not run `yarn workspace @webex/plugin-authorization-browser-first-party test`: it chains the
|
|
70
|
+
undefined `test:integration` script.
|
|
71
|
+
|
|
72
|
+
## Configuration and secrets
|
|
73
|
+
|
|
74
|
+
- Required configuration: `credentials.client_id`, `redirect_uri`, and `scope`; `client_secret` only
|
|
75
|
+
with `clientType: 'confidential'` or for the device flow; `clientType` defaults to `public` in
|
|
76
|
+
`src/config.js`
|
|
77
|
+
- Secret source: N/A for unit tests, which use fake values
|
|
78
|
+
- Package or artifact access: N/A
|
|
79
|
+
- Required neighboring packages: `@webex/webex-core` and `@webex/common` resolve through the workspace
|
|
80
|
+
- Platform, simulator, device, or SDK setup: a browser window (`location`, `history`, `sessionStorage`,
|
|
81
|
+
`crypto`); unit tests supply a mock window
|
|
82
|
+
- Never commit credentials or copy production secrets into a local config.
|
|
83
|
+
|
|
84
|
+
## First-run verification
|
|
85
|
+
|
|
86
|
+
1. Run `yarn workspace @webex/plugin-authorization-browser-first-party build:src`.
|
|
87
|
+
2. Run `yarn workspace @webex/plugin-authorization-browser-first-party test:unit` and check that the
|
|
88
|
+
`plugin-authorization-browser-first-party` suite lists the `#initialize()`, `#initiateLogin()`,
|
|
89
|
+
`#handleThirdPartyCallback()`, and `#initQRCodeLogin()` cases.
|
|
90
|
+
3. Run `yarn workspace @webex/plugin-authorization-browser-first-party test:style`.
|
|
91
|
+
|
|
92
|
+
Expected result: all three commands exit zero.
|
|
93
|
+
|
|
94
|
+
## Next steps
|
|
95
|
+
|
|
96
|
+
- [Package architecture](architecture.md)
|
|
97
|
+
- [Specification registry](specs/README.md)
|
|
98
|
+
- [Documentation index](index.md)
|
package/docs/index.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
okf_version: '0.1'
|
|
3
|
+
---
|
|
4
|
+
<!-- sdd-generated-metadata
|
|
5
|
+
doc_kind: standing-doc
|
|
6
|
+
generated_from: docs-index@0.3.0
|
|
7
|
+
generated_by: claude-code
|
|
8
|
+
approved_by: rarajes2@cisco.com
|
|
9
|
+
updated_at: 2026-11-03T06:25:15Z
|
|
10
|
+
validation_status: pass
|
|
11
|
+
-->
|
|
12
|
+
|
|
13
|
+
# @webex/plugin-authorization-browser-first-party documentation
|
|
14
|
+
|
|
15
|
+
Doc map for developers and agents working on the first-party browser authorization plugin.
|
|
16
|
+
|
|
17
|
+
## Start here
|
|
18
|
+
|
|
19
|
+
- [Getting started](getting-started.md)
|
|
20
|
+
- [Package architecture](architecture.md)
|
|
21
|
+
|
|
22
|
+
## Decisions
|
|
23
|
+
|
|
24
|
+
- [adr/](adr/index.md) — architectural decision records
|
|
25
|
+
|
|
26
|
+
## Specifications and contracts
|
|
27
|
+
|
|
28
|
+
- [architecture.md](architecture.md) — canonical package architecture and contract index
|
|
29
|
+
- [specs/README.md](specs/README.md) — manifest-backed module and contract registry
|
|
30
|
+
- [`src/docs/README.md`](../src/docs/README.md) — the first-party browser authorization plugin
|
|
31
|
+
specification beside its code
|
|
32
|
+
- [adr/](adr/index.md) — concrete architectural decisions; blank ADR templates remain under the
|
|
33
|
+
monorepo root `.sdd/`
|
|
34
|
+
|
|
35
|
+
This package is a library, so there is no service specification and no OpenAPI document. Exact
|
|
36
|
+
contract details live in the native sources linked from the architecture index: `package.json` and
|
|
37
|
+
`src/index.js` for the package, and `src/authorization.js` for the plugin API and events.
|
|
38
|
+
|
|
39
|
+
## Related repository resources
|
|
40
|
+
|
|
41
|
+
- [`README.md`](../README.md) — retained npm usage page; see [ADR-0001](adr/0001-retain-product-readme.md)
|
|
42
|
+
- [`AGENTS.md`](../AGENTS.md) — agent instructions for this package
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: Reference
|
|
3
|
+
title: Specification registry
|
|
4
|
+
description: Canonical specification registry and change-routing guide.
|
|
5
|
+
tags: [specifications, registry]
|
|
6
|
+
---
|
|
7
|
+
<!-- sdd-generated-metadata
|
|
8
|
+
doc_kind: standing-doc
|
|
9
|
+
generated_from: spec-index@0.3.0
|
|
10
|
+
generated_by: claude-code
|
|
11
|
+
approved_by: rarajes2@cisco.com
|
|
12
|
+
updated_at: 2026-11-03T06:25:15Z
|
|
13
|
+
validation_status: pass
|
|
14
|
+
-->
|
|
15
|
+
|
|
16
|
+
# Specification registry
|
|
17
|
+
|
|
18
|
+
Use this page to find the canonical package architecture and every instantiated module specification
|
|
19
|
+
plus native contract. Keep technical facts in one owning document and use this page only for
|
|
20
|
+
navigation, ownership, status, and change/test routing.
|
|
21
|
+
|
|
22
|
+
Start with the [package architecture](../architecture.md). No service specification exists because this
|
|
23
|
+
package is a library.
|
|
24
|
+
|
|
25
|
+
## Document roles
|
|
26
|
+
|
|
27
|
+
| Document | Canonical ownership |
|
|
28
|
+
| -------- | ------------------- |
|
|
29
|
+
| [Package architecture](../architecture.md) | Package boundaries, resource inventory, interactions, dependency topology, and cross-cutting architecture |
|
|
30
|
+
| Module specifications | Stable behavior and design at each manifest-routed `<module-path>/docs/README.md` |
|
|
31
|
+
| [ADR](../adr/index.md) | A durable decision, its deciders, rationale, consequences, and supersession lineage |
|
|
32
|
+
|
|
33
|
+
## Instantiated specification registry
|
|
34
|
+
|
|
35
|
+
| Resource | Role | Canonical path | Owner | Status | Last verified |
|
|
36
|
+
| -------- | ---- | -------------- | ----- | ------ | ------------- |
|
|
37
|
+
| Package | Architecture | `docs/architecture.md` | @webex/web-client | Draft | 2026-11-03 |
|
|
38
|
+
| First-party browser authorization plugin | Module | `src/docs/README.md` | @webex/web-client | Draft | 2026-11-03 |
|
|
39
|
+
| Retain the product README | ADR | `docs/adr/0001-retain-product-readme.md` | @webex/web-client | Accepted | 2026-11-03 |
|
|
40
|
+
|
|
41
|
+
### Module registry
|
|
42
|
+
|
|
43
|
+
| Module | Responsibility | Manifest coverage state | Start here |
|
|
44
|
+
| --- | --- | --- | --- |
|
|
45
|
+
| `src/` | `webex.authorization` for the Webex web client: code login with PKCE and CSRF, startup completion, token exchange and refresh callback, third-party callback, QR device login, and logout redirect | Partial | `src/docs/README.md` |
|
|
46
|
+
|
|
47
|
+
Generator-side field measurement for the module is complete (93.3%, assessed 2026-11-03). Independent
|
|
48
|
+
semantic validation by runtime Codex Desktop, session `01a1a00a-3708-7d11-9bad-6309010d8dfb`, passed on
|
|
49
|
+
2026-11-03 with no findings. Drift recording, a characterization baseline, and promotion past Partial
|
|
50
|
+
remain pending.
|
|
51
|
+
|
|
52
|
+
## Change and verification routing
|
|
53
|
+
|
|
54
|
+
| Change affects | Load and update | Verification route |
|
|
55
|
+
| -------------- | --------------- | ------------------ |
|
|
56
|
+
| Package boundaries or cross-cutting architecture | `docs/architecture.md` and applicable ADRs | `yarn workspace @webex/plugin-authorization-browser-first-party test:unit` after `build:src`, and the module spec |
|
|
57
|
+
| A stable code, package, or component boundary | `src/docs/README.md` | Module tests plus affected contracts |
|
|
58
|
+
| A public API, event, or package contract | The owning architecture section, `src/docs/README.md`, and the native definition in `src/authorization.js`, `src/config.js`, or `package.json` | Unit tests; check the `webex` first-party entry and the Webex web client login, QR, and logout flows |
|
|
59
|
+
|
|
60
|
+
## Module and contract registration
|
|
61
|
+
|
|
62
|
+
The module specification is generated at the exact `modules[].canonical_spec` path recorded in
|
|
63
|
+
`.sdd/manifest.json`. Register every module and submodule in the Module registry above in manifest tree
|
|
64
|
+
order.
|
|
65
|
+
|
|
66
|
+
Contracts are registered in `.sdd/manifest.json` `contract_catalog` and indexed in
|
|
67
|
+
[`docs/architecture.md`](../architecture.md#public-and-consumer-surfaces) with a stable ID, publication
|
|
68
|
+
state, native source, and owning module. This page provides navigation and ownership rather than a copied
|
|
69
|
+
contract.
|
package/package.json
CHANGED
|
@@ -26,23 +26,23 @@
|
|
|
26
26
|
"@webex/eslint-config-legacy": "0.0.0",
|
|
27
27
|
"@webex/jest-config-legacy": "0.0.0",
|
|
28
28
|
"@webex/legacy-tools": "0.0.0",
|
|
29
|
-
"@webex/test-helper-chai": "3.12.0",
|
|
30
|
-
"@webex/test-helper-mocha": "3.12.0",
|
|
31
|
-
"@webex/test-helper-mock-webex": "3.12.0",
|
|
32
|
-
"@webex/test-helper-test-users": "3.12.0",
|
|
29
|
+
"@webex/test-helper-chai": "3.12.0-next.13",
|
|
30
|
+
"@webex/test-helper-mocha": "3.12.0-next.13",
|
|
31
|
+
"@webex/test-helper-mock-webex": "3.12.0-next.13",
|
|
32
|
+
"@webex/test-helper-test-users": "3.12.0-next.13",
|
|
33
33
|
"eslint": "^8.24.0",
|
|
34
34
|
"prettier": "^2.7.1",
|
|
35
35
|
"sinon": "^9.2.4"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@webex/common": "3.12.0",
|
|
39
|
-
"@webex/storage-adapter-local-storage": "3.
|
|
40
|
-
"@webex/test-helper-automation": "3.12.0",
|
|
41
|
-
"@webex/test-helper-chai": "3.12.0",
|
|
42
|
-
"@webex/test-helper-mocha": "3.12.0",
|
|
43
|
-
"@webex/test-helper-mock-webex": "3.12.0",
|
|
44
|
-
"@webex/test-helper-test-users": "3.12.0",
|
|
45
|
-
"@webex/webex-core": "3.
|
|
38
|
+
"@webex/common": "3.12.0-next.13",
|
|
39
|
+
"@webex/storage-adapter-local-storage": "3.13.0-next.1",
|
|
40
|
+
"@webex/test-helper-automation": "3.12.0-next.13",
|
|
41
|
+
"@webex/test-helper-chai": "3.12.0-next.13",
|
|
42
|
+
"@webex/test-helper-mocha": "3.12.0-next.13",
|
|
43
|
+
"@webex/test-helper-mock-webex": "3.12.0-next.13",
|
|
44
|
+
"@webex/test-helper-test-users": "3.12.0-next.13",
|
|
45
|
+
"@webex/webex-core": "3.13.0-next.1",
|
|
46
46
|
"crypto-js": "^4.1.1",
|
|
47
47
|
"lodash": "^4.17.21",
|
|
48
48
|
"uuid": "^3.3.2"
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"test:style": "eslint ./src/**/*.*",
|
|
57
57
|
"test:unit": "webex-legacy-tools test --unit --runner jest"
|
|
58
58
|
},
|
|
59
|
-
"version": "3.
|
|
59
|
+
"version": "3.13.0-next.2"
|
|
60
60
|
}
|