@webex/plugin-authorization-browser-first-party 3.12.0-webex-services-ready.4 → 3.13.0-next.1
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 +82 -17
- 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 +78 -15
- 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 +288 -16
package/dist/config.js
CHANGED
|
@@ -1,40 +1,69 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _Object$keys = require("@babel/runtime-corejs2/core-js/object/keys");
|
|
4
|
+
var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs2/core-js/object/get-own-property-symbols");
|
|
5
|
+
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptor");
|
|
6
|
+
var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptors");
|
|
7
|
+
var _Object$defineProperties = require("@babel/runtime-corejs2/core-js/object/define-properties");
|
|
3
8
|
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
9
|
+
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
4
10
|
_Object$defineProperty(exports, "__esModule", {
|
|
5
11
|
value: true
|
|
6
12
|
});
|
|
7
|
-
exports.default = void 0;
|
|
13
|
+
exports.getClientAuthenticationOptions = exports.default = void 0;
|
|
14
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
|
|
15
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/objectWithoutProperties"));
|
|
16
|
+
var _excluded = ["form"];
|
|
17
|
+
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
18
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
19
|
/*!
|
|
9
20
|
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
10
21
|
*/
|
|
22
|
+
|
|
23
|
+
var getClientAuthenticationOptions = exports.getClientAuthenticationOptions = function getClientAuthenticationOptions(config) {
|
|
24
|
+
if (config.clientType === 'public') {
|
|
25
|
+
return {
|
|
26
|
+
addAuthHeader: false,
|
|
27
|
+
form: {
|
|
28
|
+
client_id: config.client_id
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
auth: {
|
|
34
|
+
user: config.client_id,
|
|
35
|
+
pass: config.client_secret,
|
|
36
|
+
sendImmediately: true
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
};
|
|
11
40
|
var _default = exports.default = {
|
|
12
41
|
credentials: {
|
|
13
42
|
/**
|
|
14
|
-
* Controls
|
|
15
|
-
*
|
|
16
|
-
*
|
|
43
|
+
* Controls how the OAuth client authenticates with the token endpoint.
|
|
44
|
+
* Public clients send their client ID in the request form. Confidential
|
|
45
|
+
* clients use HTTP Basic authentication with their client secret.
|
|
17
46
|
* @private
|
|
18
47
|
* @type {string}
|
|
19
48
|
*/
|
|
20
49
|
clientType: 'public',
|
|
21
50
|
refreshCallback: function refreshCallback(webex, token) {
|
|
22
51
|
/* eslint-disable camelcase */
|
|
23
|
-
|
|
52
|
+
var _getClientAuthenticat = getClientAuthenticationOptions(token.config),
|
|
53
|
+
_getClientAuthenticat2 = _getClientAuthenticat.form,
|
|
54
|
+
clientForm = _getClientAuthenticat2 === void 0 ? {} : _getClientAuthenticat2,
|
|
55
|
+
clientAuthentication = (0, _objectWithoutProperties2.default)(_getClientAuthenticat, _excluded);
|
|
56
|
+
return webex.request(_objectSpread(_objectSpread({
|
|
24
57
|
method: 'POST',
|
|
25
58
|
uri: token.config.tokenUrl,
|
|
26
|
-
form: {
|
|
59
|
+
form: _objectSpread({
|
|
27
60
|
grant_type: 'refresh_token',
|
|
28
61
|
redirect_uri: token.config.redirect_uri,
|
|
29
62
|
refresh_token: token.refresh_token
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
user: token.config.client_id,
|
|
33
|
-
pass: token.config.client_secret,
|
|
34
|
-
sendImmediately: true
|
|
35
|
-
},
|
|
63
|
+
}, clientForm)
|
|
64
|
+
}, clientAuthentication), {}, {
|
|
36
65
|
shouldRefreshAccessToken: false
|
|
37
|
-
}).then(function (res) {
|
|
66
|
+
})).then(function (res) {
|
|
38
67
|
return res.body;
|
|
39
68
|
});
|
|
40
69
|
/* eslint-enable camelcase */
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["getClientAuthenticationOptions","exports","config","clientType","addAuthHeader","form","client_id","auth","user","pass","client_secret","sendImmediately","_default","default","credentials","refreshCallback","webex","token","_getClientAuthenticat","_getClientAuthenticat2","clientForm","clientAuthentication","_objectWithoutProperties2","_excluded","request","_objectSpread","method","uri","tokenUrl","grant_type","redirect_uri","refresh_token","shouldRefreshAccessToken","then","res","body"],"sources":["config.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nexport const getClientAuthenticationOptions = (config) => {\n if (config.clientType === 'public') {\n return {\n addAuthHeader: false,\n form: {\n client_id: config.client_id,\n },\n };\n }\n\n return {\n auth: {\n user: config.client_id,\n pass: config.client_secret,\n sendImmediately: true,\n },\n };\n};\n\nexport default {\n credentials: {\n /**\n * Controls how the OAuth client authenticates with the token endpoint.\n * Public clients send their client ID in the request form. Confidential\n * clients use HTTP Basic authentication with their client secret.\n * @private\n * @type {string}\n */\n clientType: 'public',\n\n refreshCallback(webex, token) {\n /* eslint-disable camelcase */\n const {form: clientForm = {}, ...clientAuthentication} = getClientAuthenticationOptions(\n token.config\n );\n\n return webex\n .request({\n method: 'POST',\n uri: token.config.tokenUrl,\n form: {\n grant_type: 'refresh_token',\n redirect_uri: token.config.redirect_uri,\n refresh_token: token.refresh_token,\n ...clientForm,\n },\n ...clientAuthentication,\n shouldRefreshAccessToken: false,\n })\n .then((res) => res.body);\n /* eslint-enable camelcase */\n },\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;;AAEO,IAAMA,8BAA8B,GAAAC,OAAA,CAAAD,8BAAA,GAAG,SAAjCA,8BAA8BA,CAAIE,MAAM,EAAK;EACxD,IAAIA,MAAM,CAACC,UAAU,KAAK,QAAQ,EAAE;IAClC,OAAO;MACLC,aAAa,EAAE,KAAK;MACpBC,IAAI,EAAE;QACJC,SAAS,EAAEJ,MAAM,CAACI;MACpB;IACF,CAAC;EACH;EAEA,OAAO;IACLC,IAAI,EAAE;MACJC,IAAI,EAAEN,MAAM,CAACI,SAAS;MACtBG,IAAI,EAAEP,MAAM,CAACQ,aAAa;MAC1BC,eAAe,EAAE;IACnB;EACF,CAAC;AACH,CAAC;AAAC,IAAAC,QAAA,GAAAX,OAAA,CAAAY,OAAA,GAEa;EACbC,WAAW,EAAE;IACX;AACJ;AACA;AACA;AACA;AACA;AACA;IACIX,UAAU,EAAE,QAAQ;IAEpBY,eAAe,WAAfA,eAAeA,CAACC,KAAK,EAAEC,KAAK,EAAE;MAC5B;MACA,IAAAC,qBAAA,GAAyDlB,8BAA8B,CACrFiB,KAAK,CAACf,MACR,CAAC;QAAAiB,sBAAA,GAAAD,qBAAA,CAFMb,IAAI;QAAEe,UAAU,GAAAD,sBAAA,cAAG,CAAC,CAAC,GAAAA,sBAAA;QAAKE,oBAAoB,OAAAC,yBAAA,CAAAT,OAAA,EAAAK,qBAAA,EAAAK,SAAA;MAIrD,OAAOP,KAAK,CACTQ,OAAO,CAAAC,aAAA,CAAAA,aAAA;QACNC,MAAM,EAAE,MAAM;QACdC,GAAG,EAAEV,KAAK,CAACf,MAAM,CAAC0B,QAAQ;QAC1BvB,IAAI,EAAAoB,aAAA;UACFI,UAAU,EAAE,eAAe;UAC3BC,YAAY,EAAEb,KAAK,CAACf,MAAM,CAAC4B,YAAY;UACvCC,aAAa,EAAEd,KAAK,CAACc;QAAa,GAC/BX,UAAU;MACd,GACEC,oBAAoB;QACvBW,wBAAwB,EAAE;MAAK,EAChC,CAAC,CACDC,IAAI,CAAC,UAACC,GAAG;QAAA,OAAKA,GAAG,CAACC,IAAI;MAAA,EAAC;MAC1B;IACF;EACF;AACF,CAAC","ignoreList":[]}
|
package/dist/index.js
CHANGED
|
@@ -14,6 +14,12 @@ _Object$defineProperty(exports, "Events", {
|
|
|
14
14
|
return _authorization.Events;
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
|
+
_Object$defineProperty(exports, "InitialAuthorizationCodeGrantOutcomes", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function get() {
|
|
20
|
+
return _authorization.InitialAuthorizationCodeGrantOutcomes;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
17
23
|
_Object$defineProperty(exports, "config", {
|
|
18
24
|
enumerable: true,
|
|
19
25
|
get: function get() {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_webexCore","require","_authorization","_interopRequireWildcard","_config","_interopRequireDefault","e","t","_WeakMap","r","n","__esModule","o","i","f","__proto__","default","_typeof","has","get","set","_t","hasOwnProperty","call","_Object$defineProperty","_Object$getOwnPropertyDescriptor","proxies","registerPlugin","Authorization","config"],"sources":["index.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {registerPlugin} from '@webex/webex-core';\n\nimport Authorization from './authorization';\nimport config from './config';\n\nconst proxies = ['isAuthorizing', 'isAuthenticating'];\n\nregisterPlugin('authorization', Authorization, {\n config,\n proxies,\n});\n\nexport {default, Events} from './authorization';\nexport {default as config} from './config';\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_webexCore","require","_authorization","_interopRequireWildcard","_config","_interopRequireDefault","e","t","_WeakMap","r","n","__esModule","o","i","f","__proto__","default","_typeof","has","get","set","_t","hasOwnProperty","call","_Object$defineProperty","_Object$getOwnPropertyDescriptor","proxies","registerPlugin","Authorization","config"],"sources":["index.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {registerPlugin} from '@webex/webex-core';\n\nimport Authorization from './authorization';\nimport config from './config';\n\nconst proxies = ['isAuthorizing', 'isAuthenticating'];\n\nregisterPlugin('authorization', Authorization, {\n config,\n proxies,\n});\n\nexport {default, Events, InitialAuthorizationCodeGrantOutcomes} from './authorization';\nexport {default as config} from './config';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,IAAAA,UAAA,GAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAA8B,SAAAE,wBAAAG,CAAA,EAAAC,CAAA,6BAAAC,QAAA,MAAAC,CAAA,OAAAD,QAAA,IAAAE,CAAA,OAAAF,QAAA,YAAAL,uBAAA,YAAAA,wBAAAG,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,gBAAAW,OAAA,CAAAX,CAAA,0BAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAM,GAAA,CAAAZ,CAAA,UAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,GAAAM,CAAA,CAAAQ,GAAA,CAAAd,CAAA,EAAAQ,CAAA,cAAAO,EAAA,IAAAf,CAAA,gBAAAe,EAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,EAAAe,EAAA,OAAAR,CAAA,IAAAD,CAAA,GAAAY,sBAAA,KAAAC,gCAAA,CAAAnB,CAAA,EAAAe,EAAA,OAAAR,CAAA,CAAAM,GAAA,IAAAN,CAAA,CAAAO,GAAA,IAAAR,CAAA,CAAAE,CAAA,EAAAO,EAAA,EAAAR,CAAA,IAAAC,CAAA,CAAAO,EAAA,IAAAf,CAAA,CAAAe,EAAA,WAAAP,CAAA,KAAAR,CAAA,EAAAC,CAAA;AAP9B;AACA;AACA;;AAOA,IAAMmB,OAAO,GAAG,CAAC,eAAe,EAAE,kBAAkB,CAAC;AAErD,IAAAC,yBAAc,EAAC,eAAe,EAAEC,sBAAa,EAAE;EAC7CC,MAAM,EAANA,eAAM;EACNH,OAAO,EAAPA;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: ADR
|
|
3
|
+
title: ADR-0001 - Retain the product README
|
|
4
|
+
description: SDD onboarding keeps README.md as product documentation and does not route it as a spec source.
|
|
5
|
+
tags: [adr]
|
|
6
|
+
timestamp: 2026-11-03T00:00:00Z
|
|
7
|
+
status: accepted
|
|
8
|
+
---
|
|
9
|
+
<!-- sdd-generated-metadata
|
|
10
|
+
doc_kind: standing-doc
|
|
11
|
+
generated_from: adr@0.3.0
|
|
12
|
+
generated_by: claude-code
|
|
13
|
+
approved_by: rarajes2@cisco.com
|
|
14
|
+
updated_at: 2026-11-03T06:25:15Z
|
|
15
|
+
validation_status: pass
|
|
16
|
+
-->
|
|
17
|
+
|
|
18
|
+
# ADR-0001 - Retain the product README
|
|
19
|
+
|
|
20
|
+
| Field | Value |
|
|
21
|
+
| ------------- | ----- |
|
|
22
|
+
| Status | Accepted |
|
|
23
|
+
| Decision date | 2026-11-03 |
|
|
24
|
+
| Deciders | rarajes2@cisco.com (bootstrap questionnaire) |
|
|
25
|
+
| Supersedes | N/A |
|
|
26
|
+
| Superseded by | N/A |
|
|
27
|
+
|
|
28
|
+
## Context
|
|
29
|
+
|
|
30
|
+
Onboarding found one existing document, `README.md`, the npm page for the package. Unlike a bare
|
|
31
|
+
usage stub, it carries behavioral claims: a feature table, usage examples, an events table, a method
|
|
32
|
+
and property reference, a security-controls table, and error-handling notes. No other intent, design,
|
|
33
|
+
or AI-authored spec exists in this package.
|
|
34
|
+
|
|
35
|
+
Checking those claims against `src/` and `test/` found these differences, where code is the referee:
|
|
36
|
+
|
|
37
|
+
| README claim | Code and test behavior | Evidence |
|
|
38
|
+
| ------------ | ---------------------- | -------- |
|
|
39
|
+
| "OAuth errors returned during redirect raise mapped `grantErrors`" | `initialize` throws, but the unit test pins a `TypeError` "Cannot convert object to primitive value" instead of a grant-error instance | `src/authorization.js`, `test/unit/spec/authorization.js` |
|
|
40
|
+
| Device flow handles `slow_down` by "exponential interval adjustment" | Only the next poll waits twice the base interval; the check reads `body.message` | `src/authorization.js`, `test/unit/spec/authorization.js` |
|
|
41
|
+
| `pollingCanceled` on "explicit cancel or internal timeout cleanup" | Also fires after `authorizationSuccess` and before a terminal `authorizationFailure`; does not fire on timeout | `src/authorization.js`, `test/unit/spec/authorization.js` |
|
|
42
|
+
| Method table lists five methods | Code also exposes `initiateThirdPartyLogin`, `initiateThirdPartyLoginRedirect`, `handleThirdPartyCallback`, and `logout` | `src/authorization.js` |
|
|
43
|
+
| Events table lists only `qRCodeLogin` event types | `Events.login` also emits `initiateLogin` and `redirectToLoginUrl` | `src/authorization.js`, `test/unit/spec/authorization.js` |
|
|
44
|
+
| The first usage example passes `client_secret` without `clientType` | `clientType` defaults to `public`, so that configuration uses form client authentication, not HTTP Basic | `src/config.js` |
|
|
45
|
+
| "Public-client device authorization ... not changed" | Device requests always send HTTP Basic with `client_secret`, whatever `clientType` is | `src/authorization.js` |
|
|
46
|
+
|
|
47
|
+
## Decision
|
|
48
|
+
|
|
49
|
+
Keep `README.md` unchanged. Do not migrate it into the module specification. Record
|
|
50
|
+
`spec_source_policy.mode` as `keep-separate` with `migrated_source_disposition` `retain` and an empty
|
|
51
|
+
`spec_sources` list.
|
|
52
|
+
|
|
53
|
+
The canonical behavior is `src/` plus `test/`, described in `src/docs/README.md`. Where the README is
|
|
54
|
+
silent or disagrees, code wins, and the differences above are recorded in the module specification's
|
|
55
|
+
Pitfalls and constraints.
|
|
56
|
+
|
|
57
|
+
## Why
|
|
58
|
+
|
|
59
|
+
The README is the npm-facing page and the developer chose to keep it separate from the SDD tree.
|
|
60
|
+
Rewriting it is a product-doc change, not a requirement of making the package SDD-ready.
|
|
61
|
+
|
|
62
|
+
## Alternatives considered
|
|
63
|
+
|
|
64
|
+
| Alternative | Why it was not selected |
|
|
65
|
+
| ----------- | ----------------------- |
|
|
66
|
+
| Reconcile the README into `src/docs/README.md`, marking stale claims | Not selected by the developer; the module spec is written from code and lists the differences instead |
|
|
67
|
+
| Migrate the README into the module spec as source text | Several claims are stale, and the README stays the npm page |
|
|
68
|
+
| Correct the README during onboarding | Onboarding writes the SDD tree only and does not edit `README.md` |
|
|
69
|
+
|
|
70
|
+
## Consequences
|
|
71
|
+
|
|
72
|
+
**Positive:**
|
|
73
|
+
|
|
74
|
+
- The npm page stays stable for consumers.
|
|
75
|
+
- The module specification is the single behavioral reference.
|
|
76
|
+
|
|
77
|
+
**Negative / tradeoffs:**
|
|
78
|
+
|
|
79
|
+
- Agents must not treat `README.md` as the method, event, or error reference.
|
|
80
|
+
- The stale claims stay until a maintainer makes a separate product-doc change.
|
|
81
|
+
|
|
82
|
+
## Constraint on future changes
|
|
83
|
+
|
|
84
|
+
Do not delete `README.md` as part of spec maintenance. If its usage text changes, keep the module
|
|
85
|
+
specification aligned with code rather than with the README.
|
|
86
|
+
|
|
87
|
+
## Follow-up
|
|
88
|
+
|
|
89
|
+
- [ ] Optional product-doc change: align the README with the differences listed above.
|
|
90
|
+
|
|
91
|
+
## Revisit when
|
|
92
|
+
|
|
93
|
+
- A maintainer chooses to make the README match the code, or to make the module spec the published
|
|
94
|
+
reference.
|
|
95
|
+
|
|
96
|
+
## References
|
|
97
|
+
|
|
98
|
+
- `README.md`
|
|
99
|
+
- `src/index.js`
|
|
100
|
+
- `src/authorization.js`
|
|
101
|
+
- `src/config.js`
|
|
102
|
+
- `.sdd/manifest.json` `spec_source_policy`
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<!-- sdd-generated-metadata
|
|
2
|
+
doc_kind: standing-doc
|
|
3
|
+
generated_from: adr-index@0.3.0
|
|
4
|
+
generated_by: claude-code
|
|
5
|
+
approved_by: rarajes2@cisco.com
|
|
6
|
+
updated_at: 2026-11-03T06:25:15Z
|
|
7
|
+
validation_status: pass
|
|
8
|
+
-->
|
|
9
|
+
|
|
10
|
+
# Architectural decision records
|
|
11
|
+
|
|
12
|
+
Numbered, append-only records of structural decisions affecting this package and its documentation.
|
|
13
|
+
Add a concrete ADR (for example, `0042-cache-policy.md`) when a decision is non-obvious, hard to
|
|
14
|
+
reverse, or worth explaining to a future contributor. Do not edit an accepted decision in place when
|
|
15
|
+
its outcome changes; supersede it with a new ADR and link both records.
|
|
16
|
+
|
|
17
|
+
## Index
|
|
18
|
+
|
|
19
|
+
- [ADR-0001 - Retain the product README](0001-retain-product-readme.md) — accepted 2026-11-03
|
|
20
|
+
|
|
21
|
+
Add new entries as ADRs are accepted. Keep this list in numeric order.
|
|
22
|
+
|
|
23
|
+
Each ADR should state its context, decision, alternatives, consequences, and the condition that would
|
|
24
|
+
cause the team to revisit it. Record the deciders, any superseded decision, and the constraint future
|
|
25
|
+
changes must preserve.
|
|
@@ -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.
|