@webex/webex-core 2.59.2 → 2.59.3-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.
Files changed (189) hide show
  1. package/.eslintrc.js +6 -6
  2. package/README.md +79 -79
  3. package/babel.config.js +3 -3
  4. package/dist/config.js +24 -24
  5. package/dist/config.js.map +1 -1
  6. package/dist/credentials-config.js +56 -56
  7. package/dist/credentials-config.js.map +1 -1
  8. package/dist/index.js.map +1 -1
  9. package/dist/interceptors/auth.js +28 -28
  10. package/dist/interceptors/auth.js.map +1 -1
  11. package/dist/interceptors/default-options.js +24 -24
  12. package/dist/interceptors/default-options.js.map +1 -1
  13. package/dist/interceptors/embargo.js +9 -9
  14. package/dist/interceptors/embargo.js.map +1 -1
  15. package/dist/interceptors/network-timing.js +19 -19
  16. package/dist/interceptors/network-timing.js.map +1 -1
  17. package/dist/interceptors/payload-transformer.js +19 -19
  18. package/dist/interceptors/payload-transformer.js.map +1 -1
  19. package/dist/interceptors/rate-limit.js +40 -40
  20. package/dist/interceptors/rate-limit.js.map +1 -1
  21. package/dist/interceptors/redirect.js +13 -13
  22. package/dist/interceptors/redirect.js.map +1 -1
  23. package/dist/interceptors/request-event.js +23 -23
  24. package/dist/interceptors/request-event.js.map +1 -1
  25. package/dist/interceptors/request-logger.js +13 -13
  26. package/dist/interceptors/request-logger.js.map +1 -1
  27. package/dist/interceptors/request-timing.js +23 -23
  28. package/dist/interceptors/request-timing.js.map +1 -1
  29. package/dist/interceptors/response-logger.js +19 -19
  30. package/dist/interceptors/response-logger.js.map +1 -1
  31. package/dist/interceptors/user-agent.js +29 -29
  32. package/dist/interceptors/user-agent.js.map +1 -1
  33. package/dist/interceptors/webex-tracking-id.js +15 -15
  34. package/dist/interceptors/webex-tracking-id.js.map +1 -1
  35. package/dist/interceptors/webex-user-agent.js +13 -13
  36. package/dist/interceptors/webex-user-agent.js.map +1 -1
  37. package/dist/lib/batcher.js +83 -83
  38. package/dist/lib/batcher.js.map +1 -1
  39. package/dist/lib/credentials/credentials.js +103 -103
  40. package/dist/lib/credentials/credentials.js.map +1 -1
  41. package/dist/lib/credentials/grant-errors.js +17 -17
  42. package/dist/lib/credentials/grant-errors.js.map +1 -1
  43. package/dist/lib/credentials/index.js +2 -2
  44. package/dist/lib/credentials/index.js.map +1 -1
  45. package/dist/lib/credentials/scope.js +11 -11
  46. package/dist/lib/credentials/scope.js.map +1 -1
  47. package/dist/lib/credentials/token-collection.js +2 -2
  48. package/dist/lib/credentials/token-collection.js.map +1 -1
  49. package/dist/lib/credentials/token.js +145 -145
  50. package/dist/lib/credentials/token.js.map +1 -1
  51. package/dist/lib/page.js +49 -49
  52. package/dist/lib/page.js.map +1 -1
  53. package/dist/lib/services/constants.js.map +1 -1
  54. package/dist/lib/services/index.js +2 -2
  55. package/dist/lib/services/index.js.map +1 -1
  56. package/dist/lib/services/interceptors/server-error.js +9 -9
  57. package/dist/lib/services/interceptors/server-error.js.map +1 -1
  58. package/dist/lib/services/interceptors/service.js +24 -24
  59. package/dist/lib/services/interceptors/service.js.map +1 -1
  60. package/dist/lib/services/metrics.js.map +1 -1
  61. package/dist/lib/services/service-catalog.js +104 -104
  62. package/dist/lib/services/service-catalog.js.map +1 -1
  63. package/dist/lib/services/service-fed-ramp.js.map +1 -1
  64. package/dist/lib/services/service-host.js +134 -134
  65. package/dist/lib/services/service-host.js.map +1 -1
  66. package/dist/lib/services/service-registry.js +175 -175
  67. package/dist/lib/services/service-registry.js.map +1 -1
  68. package/dist/lib/services/service-state.js +38 -38
  69. package/dist/lib/services/service-state.js.map +1 -1
  70. package/dist/lib/services/service-url.js +31 -31
  71. package/dist/lib/services/service-url.js.map +1 -1
  72. package/dist/lib/services/services.js +245 -245
  73. package/dist/lib/services/services.js.map +1 -1
  74. package/dist/lib/stateless-webex-plugin.js +28 -28
  75. package/dist/lib/stateless-webex-plugin.js.map +1 -1
  76. package/dist/lib/storage/decorators.js +27 -27
  77. package/dist/lib/storage/decorators.js.map +1 -1
  78. package/dist/lib/storage/errors.js +4 -4
  79. package/dist/lib/storage/errors.js.map +1 -1
  80. package/dist/lib/storage/index.js.map +1 -1
  81. package/dist/lib/storage/make-webex-plugin-store.js +44 -44
  82. package/dist/lib/storage/make-webex-plugin-store.js.map +1 -1
  83. package/dist/lib/storage/make-webex-store.js +40 -40
  84. package/dist/lib/storage/make-webex-store.js.map +1 -1
  85. package/dist/lib/storage/memory-store-adapter.js +9 -9
  86. package/dist/lib/storage/memory-store-adapter.js.map +1 -1
  87. package/dist/lib/webex-core-plugin-mixin.js +13 -13
  88. package/dist/lib/webex-core-plugin-mixin.js.map +1 -1
  89. package/dist/lib/webex-http-error.js +9 -9
  90. package/dist/lib/webex-http-error.js.map +1 -1
  91. package/dist/lib/webex-internal-core-plugin-mixin.js +13 -13
  92. package/dist/lib/webex-internal-core-plugin-mixin.js.map +1 -1
  93. package/dist/lib/webex-plugin.js +36 -36
  94. package/dist/lib/webex-plugin.js.map +1 -1
  95. package/dist/plugins/logger.js +9 -9
  96. package/dist/plugins/logger.js.map +1 -1
  97. package/dist/webex-core.js +104 -104
  98. package/dist/webex-core.js.map +1 -1
  99. package/dist/webex-internal-core.js +12 -12
  100. package/dist/webex-internal-core.js.map +1 -1
  101. package/jest.config.js +3 -3
  102. package/package.json +20 -19
  103. package/process +1 -1
  104. package/src/config.js +90 -90
  105. package/src/credentials-config.js +212 -212
  106. package/src/index.js +62 -62
  107. package/src/interceptors/auth.js +186 -186
  108. package/src/interceptors/default-options.js +55 -55
  109. package/src/interceptors/embargo.js +43 -43
  110. package/src/interceptors/network-timing.js +54 -54
  111. package/src/interceptors/payload-transformer.js +55 -55
  112. package/src/interceptors/rate-limit.js +169 -169
  113. package/src/interceptors/redirect.js +106 -106
  114. package/src/interceptors/request-event.js +93 -93
  115. package/src/interceptors/request-logger.js +78 -78
  116. package/src/interceptors/request-timing.js +65 -65
  117. package/src/interceptors/response-logger.js +98 -98
  118. package/src/interceptors/user-agent.js +77 -77
  119. package/src/interceptors/webex-tracking-id.js +73 -73
  120. package/src/interceptors/webex-user-agent.js +79 -79
  121. package/src/lib/batcher.js +307 -307
  122. package/src/lib/credentials/credentials.js +552 -552
  123. package/src/lib/credentials/grant-errors.js +92 -92
  124. package/src/lib/credentials/index.js +16 -16
  125. package/src/lib/credentials/scope.js +34 -34
  126. package/src/lib/credentials/token-collection.js +17 -17
  127. package/src/lib/credentials/token.js +559 -559
  128. package/src/lib/page.js +159 -159
  129. package/src/lib/services/constants.js +9 -9
  130. package/src/lib/services/index.js +26 -26
  131. package/src/lib/services/interceptors/server-error.js +48 -48
  132. package/src/lib/services/interceptors/service.js +101 -101
  133. package/src/lib/services/metrics.js +4 -4
  134. package/src/lib/services/service-catalog.js +435 -435
  135. package/src/lib/services/service-fed-ramp.js +4 -4
  136. package/src/lib/services/service-host.js +267 -267
  137. package/src/lib/services/service-registry.js +465 -465
  138. package/src/lib/services/service-state.js +78 -78
  139. package/src/lib/services/service-url.js +124 -124
  140. package/src/lib/services/services.js +1018 -1018
  141. package/src/lib/stateless-webex-plugin.js +98 -98
  142. package/src/lib/storage/decorators.js +220 -220
  143. package/src/lib/storage/errors.js +15 -15
  144. package/src/lib/storage/index.js +10 -10
  145. package/src/lib/storage/make-webex-plugin-store.js +211 -211
  146. package/src/lib/storage/make-webex-store.js +140 -140
  147. package/src/lib/storage/memory-store-adapter.js +79 -79
  148. package/src/lib/webex-core-plugin-mixin.js +114 -114
  149. package/src/lib/webex-http-error.js +61 -61
  150. package/src/lib/webex-internal-core-plugin-mixin.js +107 -107
  151. package/src/lib/webex-plugin.js +222 -222
  152. package/src/plugins/logger.js +60 -60
  153. package/src/webex-core.js +745 -745
  154. package/src/webex-internal-core.js +46 -46
  155. package/test/integration/spec/credentials/credentials.js +139 -139
  156. package/test/integration/spec/credentials/token.js +102 -102
  157. package/test/integration/spec/services/service-catalog.js +838 -838
  158. package/test/integration/spec/services/services.js +1221 -1221
  159. package/test/integration/spec/webex-core.js +178 -178
  160. package/test/unit/spec/_setup.js +44 -44
  161. package/test/unit/spec/credentials/credentials.js +1017 -1017
  162. package/test/unit/spec/credentials/token.js +441 -441
  163. package/test/unit/spec/interceptors/auth.js +521 -521
  164. package/test/unit/spec/interceptors/default-options.js +84 -84
  165. package/test/unit/spec/interceptors/embargo.js +144 -144
  166. package/test/unit/spec/interceptors/network-timing.js +49 -49
  167. package/test/unit/spec/interceptors/payload-transformer.js +155 -155
  168. package/test/unit/spec/interceptors/rate-limit.js +302 -302
  169. package/test/unit/spec/interceptors/redirect.js +102 -102
  170. package/test/unit/spec/interceptors/request-timing.js +92 -92
  171. package/test/unit/spec/interceptors/user-agent.js +76 -76
  172. package/test/unit/spec/interceptors/webex-tracking-id.js +76 -76
  173. package/test/unit/spec/interceptors/webex-user-agent.js +159 -159
  174. package/test/unit/spec/lib/batcher.js +330 -330
  175. package/test/unit/spec/lib/page.js +148 -148
  176. package/test/unit/spec/lib/webex-plugin.js +48 -48
  177. package/test/unit/spec/services/interceptors/server-error.js +204 -204
  178. package/test/unit/spec/services/interceptors/service.js +188 -188
  179. package/test/unit/spec/services/service-catalog.js +194 -194
  180. package/test/unit/spec/services/service-host.js +260 -260
  181. package/test/unit/spec/services/service-registry.js +747 -747
  182. package/test/unit/spec/services/service-state.js +60 -60
  183. package/test/unit/spec/services/service-url.js +258 -258
  184. package/test/unit/spec/services/services.js +348 -348
  185. package/test/unit/spec/storage/persist.js +50 -50
  186. package/test/unit/spec/storage/storage-adapter.js +12 -12
  187. package/test/unit/spec/storage/wait-for-value.js +81 -81
  188. package/test/unit/spec/webex-core.js +253 -253
  189. package/test/unit/spec/webex-internal-core.js +91 -91
package/package.json CHANGED
@@ -1,6 +1,5 @@
1
1
  {
2
2
  "name": "@webex/webex-core",
3
- "version": "2.59.2",
4
3
  "description": "Plugin handling for Cisco Webex",
5
4
  "license": "MIT",
6
5
  "contributors": [
@@ -32,16 +31,16 @@
32
31
  "devDependencies": {
33
32
  "@babel/core": "^7.17.10",
34
33
  "@sinonjs/fake-timers": "^6.0.1",
35
- "@webex/babel-config-legacy": "2.59.2",
36
- "@webex/eslint-config-legacy": "2.59.2",
37
- "@webex/jest-config-legacy": "2.59.2",
38
- "@webex/legacy-tools": "2.59.2",
39
- "@webex/test-helper-chai": "2.59.2",
40
- "@webex/test-helper-make-local-url": "2.59.2",
41
- "@webex/test-helper-mocha": "2.59.2",
42
- "@webex/test-helper-mock-webex": "2.59.2",
43
- "@webex/test-helper-refresh-callback": "2.59.2",
44
- "@webex/test-helper-test-users": "2.59.2",
34
+ "@webex/babel-config-legacy": "^0.0.0",
35
+ "@webex/eslint-config-legacy": "^0.0.0",
36
+ "@webex/jest-config-legacy": "^0.0.0",
37
+ "@webex/legacy-tools": "^0.0.0",
38
+ "@webex/test-helper-chai": "^2.59.3-next.1",
39
+ "@webex/test-helper-make-local-url": "^2.59.3-next.1",
40
+ "@webex/test-helper-mocha": "^2.59.3-next.1",
41
+ "@webex/test-helper-mock-webex": "^2.59.3-next.1",
42
+ "@webex/test-helper-refresh-callback": "^2.59.3-next.1",
43
+ "@webex/test-helper-test-users": "^2.59.3-next.1",
45
44
  "chai": "^4.3.4",
46
45
  "chai-as-promised": "^7.1.1",
47
46
  "eslint": "^8.24.0",
@@ -49,12 +48,12 @@
49
48
  "sinon": "^9.2.4"
50
49
  },
51
50
  "dependencies": {
52
- "@webex/common": "2.59.2",
53
- "@webex/common-timers": "2.59.2",
54
- "@webex/http-core": "2.59.2",
55
- "@webex/internal-plugin-device": "2.59.2",
56
- "@webex/plugin-logger": "2.59.2",
57
- "@webex/storage-adapter-spec": "2.59.2",
51
+ "@webex/common": "^2.59.3-next.1",
52
+ "@webex/common-timers": "^2.59.3-next.1",
53
+ "@webex/http-core": "^2.59.3-next.1",
54
+ "@webex/internal-plugin-device": "^2.59.3-next.1",
55
+ "@webex/plugin-logger": "^2.59.3-next.1",
56
+ "@webex/storage-adapter-spec": "^2.59.3-next.1",
58
57
  "ampersand-collection": "^2.0.2",
59
58
  "ampersand-events": "^2.0.2",
60
59
  "ampersand-state": "^5.0.3",
@@ -67,10 +66,12 @@
67
66
  "scripts": {
68
67
  "build": "yarn build:src",
69
68
  "build:src": "webex-legacy-tools build -dest \"./dist\" -src \"./src\" -js -ts -maps",
69
+ "deploy:npm": "yarn npm publish",
70
70
  "test": "yarn test:style && yarn test:unit && yarn test:integration && yarn test:browser",
71
71
  "test:browser:broken": "webex-legacy-tools test --integration --unit --runner karma",
72
72
  "test:integration:broken": "webex-legacy-tools test --integration --runner mocha",
73
73
  "test:style": "eslint ./src/**/*.*",
74
74
  "test:unit": "webex-legacy-tools test --unit --runner jest"
75
- }
76
- }
75
+ },
76
+ "version": "2.59.3-next.1"
77
+ }
package/process CHANGED
@@ -1 +1 @@
1
- module.exports = {browser: true};
1
+ module.exports = {browser: true};
package/src/config.js CHANGED
@@ -1,90 +1,90 @@
1
- /*!
2
- * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
3
- */
4
-
5
- /* eslint camelcase: [0] */
6
-
7
- import {MemoryStoreAdapter} from './lib/storage';
8
- import CredentialsConfig from './credentials-config';
9
-
10
- export default {
11
- maxAppLevelRedirects: 10,
12
- maxLocusRedirects: 5,
13
- maxAuthenticationReplays: 1,
14
- maxReconnectAttempts: 1,
15
- onBeforeLogout: [],
16
- trackingIdPrefix: 'webex-js-sdk',
17
- trackingIdSuffix: '',
18
- AlternateLogger: undefined,
19
- credentials: new CredentialsConfig(),
20
- fedramp: process.env.ENABLE_FEDRAMP || false,
21
- services: {
22
- /**
23
- * A list of services that are available prior to catalog collection.
24
- *
25
- * @type {Object}
26
- */
27
- discovery: {
28
- /**
29
- * The hydra discovery url.
30
- *
31
- * @type {string}
32
- */
33
- hydra: process.env.HYDRA_SERVICE_URL || 'https://api.ciscospark.com/v1',
34
-
35
- /**
36
- * The u2c discovery url
37
- *
38
- * @type {string}
39
- */
40
- u2c: process.env.U2C_SERVICE_URL || 'https://u2c.wbx2.com/u2c/api/v1',
41
- },
42
-
43
- /**
44
- * When true, considers all urls in `allowedDomains` as safe for auth tokens
45
- *
46
- * @type {boolean}
47
- */
48
- validateDomains: true,
49
-
50
- /**
51
- * services that don't need auth validation
52
- */
53
-
54
- servicesNotNeedValidation: ['webex-appapi-service'],
55
-
56
- /**
57
- * Contains a list of allowed domain host addresses.
58
- *
59
- * @type {Array<string>}
60
- */
61
- allowedDomains: [
62
- 'wbx2.com',
63
- 'ciscospark.com',
64
- 'webex.com',
65
- 'webexapis.com',
66
- 'broadcloudpbx.com',
67
- 'broadcloud.eu',
68
- 'broadcloud.com.au',
69
- 'broadcloudpbx.net',
70
- ],
71
- },
72
- device: {
73
- preDiscoveryServices: {
74
- hydra: process.env.HYDRA_SERVICE_URL || 'https://api.ciscospark.com/v1',
75
- hydraServiceUrl: process.env.HYDRA_SERVICE_URL || 'https://api.ciscospark.com/v1',
76
- },
77
- validateDomains: true,
78
- },
79
- metrics: {
80
- type: ['behavioral', 'operational'],
81
- },
82
- payloadTransformer: {
83
- predicates: [],
84
- transforms: [],
85
- },
86
- storage: {
87
- boundedAdapter: MemoryStoreAdapter,
88
- unboundedAdapter: MemoryStoreAdapter,
89
- },
90
- };
1
+ /*!
2
+ * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
3
+ */
4
+
5
+ /* eslint camelcase: [0] */
6
+
7
+ import {MemoryStoreAdapter} from './lib/storage';
8
+ import CredentialsConfig from './credentials-config';
9
+
10
+ export default {
11
+ maxAppLevelRedirects: 10,
12
+ maxLocusRedirects: 5,
13
+ maxAuthenticationReplays: 1,
14
+ maxReconnectAttempts: 1,
15
+ onBeforeLogout: [],
16
+ trackingIdPrefix: 'webex-js-sdk',
17
+ trackingIdSuffix: '',
18
+ AlternateLogger: undefined,
19
+ credentials: new CredentialsConfig(),
20
+ fedramp: process.env.ENABLE_FEDRAMP || false,
21
+ services: {
22
+ /**
23
+ * A list of services that are available prior to catalog collection.
24
+ *
25
+ * @type {Object}
26
+ */
27
+ discovery: {
28
+ /**
29
+ * The hydra discovery url.
30
+ *
31
+ * @type {string}
32
+ */
33
+ hydra: process.env.HYDRA_SERVICE_URL || 'https://api.ciscospark.com/v1',
34
+
35
+ /**
36
+ * The u2c discovery url
37
+ *
38
+ * @type {string}
39
+ */
40
+ u2c: process.env.U2C_SERVICE_URL || 'https://u2c.wbx2.com/u2c/api/v1',
41
+ },
42
+
43
+ /**
44
+ * When true, considers all urls in `allowedDomains` as safe for auth tokens
45
+ *
46
+ * @type {boolean}
47
+ */
48
+ validateDomains: true,
49
+
50
+ /**
51
+ * services that don't need auth validation
52
+ */
53
+
54
+ servicesNotNeedValidation: ['webex-appapi-service'],
55
+
56
+ /**
57
+ * Contains a list of allowed domain host addresses.
58
+ *
59
+ * @type {Array<string>}
60
+ */
61
+ allowedDomains: [
62
+ 'wbx2.com',
63
+ 'ciscospark.com',
64
+ 'webex.com',
65
+ 'webexapis.com',
66
+ 'broadcloudpbx.com',
67
+ 'broadcloud.eu',
68
+ 'broadcloud.com.au',
69
+ 'broadcloudpbx.net',
70
+ ],
71
+ },
72
+ device: {
73
+ preDiscoveryServices: {
74
+ hydra: process.env.HYDRA_SERVICE_URL || 'https://api.ciscospark.com/v1',
75
+ hydraServiceUrl: process.env.HYDRA_SERVICE_URL || 'https://api.ciscospark.com/v1',
76
+ },
77
+ validateDomains: true,
78
+ },
79
+ metrics: {
80
+ type: ['behavioral', 'operational'],
81
+ },
82
+ payloadTransformer: {
83
+ predicates: [],
84
+ transforms: [],
85
+ },
86
+ storage: {
87
+ boundedAdapter: MemoryStoreAdapter,
88
+ unboundedAdapter: MemoryStoreAdapter,
89
+ },
90
+ };
@@ -1,212 +1,212 @@
1
- import AmpState from 'ampersand-state';
2
-
3
- // The credentials config which includes the CI server info and derived
4
- // URL properties from them for the various CI services. The URL's
5
- // will be updated when the CI changes.
6
- const CredentialsConfig = AmpState.extend({
7
- // we need to allow extra props for dynamic props like jwtRefreshCallback
8
- extraProperties: 'allow',
9
-
10
- props: {
11
- /**
12
- * The idbroker base host name
13
- * @returns {object}
14
- */
15
- idbroker: [
16
- 'object',
17
- false,
18
- () => ({
19
- url: process.env.IDBROKER_BASE_URL || 'https://idbroker.webex.com',
20
- }),
21
- ],
22
-
23
- /**
24
- * The identity base host name
25
- * @returns {object}
26
- */
27
- identity: [
28
- 'object',
29
- false,
30
- () => ({
31
- url: process.env.IDENTITY_BASE_URL || 'https://identity.webex.com',
32
- }),
33
- ],
34
-
35
- /**
36
- * This is the authorization url displayed on the
37
- * {@link developer portal|https://developer.webex.com}
38
- * @type {string}
39
- */
40
- authorizationString: [
41
- 'string',
42
- false,
43
- process.env.WEBEX_AUTHORIZATION_STRING || process.env.AUTHORIZATION_STRING,
44
- ],
45
-
46
- /**
47
- * Authorization URL which prompts for user's password. Inferred from
48
- * {@link config.credentials.authorizationString}. This config value will
49
- * be automatically set if `authorizationString` config value is specified.
50
- *
51
- * @type {string}
52
- */
53
- authorizeUrl: [
54
- 'string',
55
- false,
56
- process.env.WEBEX_AUTHORIZE_URL ||
57
- `${process.env.IDBROKER_BASE_URL || 'https://idbroker.webex.com'}/idb/oauth2/v1/authorize`,
58
- ],
59
-
60
- /**
61
- * {@see https://tools.ietf.org/html/rfc6749#section-4.1.4}
62
- * @type {string}
63
- */
64
- client_id: [
65
- 'string',
66
- false,
67
- process.env.WEBEX_CLIENT_ID || process.env.COMMON_IDENTITY_CLIENT_ID || process.env.CLIENT_ID,
68
- ],
69
-
70
- /**
71
- * {@see https://tools.ietf.org/html/rfc6749#section-4.1.4}
72
- * @type {string}
73
- */
74
- client_secret: [
75
- 'string',
76
- false,
77
- process.env.WEBEX_CLIENT_SECRET ||
78
- process.env.COMMON_IDENTITY_CLIENT_SECRET ||
79
- process.env.CLIENT_SECRET,
80
- ],
81
-
82
- /**
83
- * {@see https://tools.ietf.org/html/rfc6749#section-4.1.4}
84
- * @type {string}
85
- */
86
- redirect_uri: [
87
- 'string',
88
- false,
89
- process.env.WEBEX_REDIRECT_URI ||
90
- process.env.COMMON_IDENTITY_REDIRECT_URI ||
91
- process.env.REDIRECT_URI,
92
- ],
93
-
94
- /**
95
- * {@see https://tools.ietf.org/html/rfc6749#section-4.1.4}
96
- * @type {string}
97
- */
98
- scope: [
99
- 'string',
100
- false,
101
- process.env.WEBEX_SCOPE ||
102
- process.env.WEBEX_SCOPES ||
103
- process.env.COMMON_IDENTITY_SCOPE ||
104
- process.env.SCOPE,
105
- ],
106
-
107
- /**
108
- * Controls the UI of the CI login page.
109
- * @private
110
- * @type {string}
111
- */
112
- cisService: ['string', false, 'webex'],
113
- },
114
-
115
- derived: {
116
- /**
117
- * User activation URL
118
- * {@link config.credentials.activationUrl}
119
- * @type {string}
120
- */
121
- activationUrl: {
122
- deps: ['idbroker.url'],
123
- fn() {
124
- return `${
125
- this.idbroker.url || 'https://idbroker.webex.com'
126
- }/idb/token/v1/actions/UserActivation/invoke`;
127
- },
128
- cache: false,
129
- },
130
-
131
- /**
132
- * Generate OTP URL
133
- * {@link config.credentials.generateOtpUrl}
134
- * @type {string}
135
- */
136
- generateOtpUrl: {
137
- deps: ['idbroker.url'],
138
- fn() {
139
- return `${
140
- this.idbroker.url || 'https://idbroker.webex.com'
141
- }/idb/token/v1/actions/UserOTP/Generate/invoke`;
142
- },
143
- cache: false,
144
- },
145
-
146
- /**
147
- * Validate OTP URL
148
- * {@link config.credentials.validateOtpUrl}
149
- * @type {string}
150
- */
151
- validateOtpUrl: {
152
- deps: ['idbroker.url'],
153
- fn() {
154
- return `${
155
- this.idbroker.url || 'https://idbroker.webex.com'
156
- }/idb/token/v1/actions/UserOTP/Validate/invoke`;
157
- },
158
- cache: false,
159
- },
160
-
161
- // TODO does hydra also have an access_token endpoint?
162
- /**
163
- * Token URL used for token refresh and auth code exchange
164
- * @type {string}
165
- */
166
- tokenUrl: {
167
- deps: ['idbroker.url'],
168
- fn() {
169
- return process.env.TOKEN_URL || `${this.idbroker.url}/idb/oauth2/v1/access_token`;
170
- },
171
- cache: false,
172
- },
173
-
174
- /**
175
- * URL to revoke token
176
- * @type {string}
177
- */
178
- revokeUrl: {
179
- deps: ['idbroker.url'],
180
- fn() {
181
- return process.env.REVOKE_URL || `${this.idbroker.url}/idb/oauth2/v1/revoke`;
182
- },
183
- cache: false,
184
- },
185
-
186
- /**
187
- * URL to load when the app logs out
188
- * @type {string}
189
- */
190
- logoutUrl: {
191
- deps: ['idbroker.url'],
192
- fn() {
193
- return `${this.idbroker.url}/idb/oauth2/v1/logout`;
194
- },
195
- cache: false,
196
- },
197
-
198
- /**
199
- * Set password URL
200
- * @type {string}
201
- */
202
- setPasswordUrl: {
203
- deps: ['identity.url'],
204
- fn() {
205
- return `${this.identity.url || 'https://identity.webex.com'}/identity/scim/v1/Users`;
206
- },
207
- cache: false,
208
- },
209
- },
210
- });
211
-
212
- export default CredentialsConfig;
1
+ import AmpState from 'ampersand-state';
2
+
3
+ // The credentials config which includes the CI server info and derived
4
+ // URL properties from them for the various CI services. The URL's
5
+ // will be updated when the CI changes.
6
+ const CredentialsConfig = AmpState.extend({
7
+ // we need to allow extra props for dynamic props like jwtRefreshCallback
8
+ extraProperties: 'allow',
9
+
10
+ props: {
11
+ /**
12
+ * The idbroker base host name
13
+ * @returns {object}
14
+ */
15
+ idbroker: [
16
+ 'object',
17
+ false,
18
+ () => ({
19
+ url: process.env.IDBROKER_BASE_URL || 'https://idbroker.webex.com',
20
+ }),
21
+ ],
22
+
23
+ /**
24
+ * The identity base host name
25
+ * @returns {object}
26
+ */
27
+ identity: [
28
+ 'object',
29
+ false,
30
+ () => ({
31
+ url: process.env.IDENTITY_BASE_URL || 'https://identity.webex.com',
32
+ }),
33
+ ],
34
+
35
+ /**
36
+ * This is the authorization url displayed on the
37
+ * {@link developer portal|https://developer.webex.com}
38
+ * @type {string}
39
+ */
40
+ authorizationString: [
41
+ 'string',
42
+ false,
43
+ process.env.WEBEX_AUTHORIZATION_STRING || process.env.AUTHORIZATION_STRING,
44
+ ],
45
+
46
+ /**
47
+ * Authorization URL which prompts for user's password. Inferred from
48
+ * {@link config.credentials.authorizationString}. This config value will
49
+ * be automatically set if `authorizationString` config value is specified.
50
+ *
51
+ * @type {string}
52
+ */
53
+ authorizeUrl: [
54
+ 'string',
55
+ false,
56
+ process.env.WEBEX_AUTHORIZE_URL ||
57
+ `${process.env.IDBROKER_BASE_URL || 'https://idbroker.webex.com'}/idb/oauth2/v1/authorize`,
58
+ ],
59
+
60
+ /**
61
+ * {@see https://tools.ietf.org/html/rfc6749#section-4.1.4}
62
+ * @type {string}
63
+ */
64
+ client_id: [
65
+ 'string',
66
+ false,
67
+ process.env.WEBEX_CLIENT_ID || process.env.COMMON_IDENTITY_CLIENT_ID || process.env.CLIENT_ID,
68
+ ],
69
+
70
+ /**
71
+ * {@see https://tools.ietf.org/html/rfc6749#section-4.1.4}
72
+ * @type {string}
73
+ */
74
+ client_secret: [
75
+ 'string',
76
+ false,
77
+ process.env.WEBEX_CLIENT_SECRET ||
78
+ process.env.COMMON_IDENTITY_CLIENT_SECRET ||
79
+ process.env.CLIENT_SECRET,
80
+ ],
81
+
82
+ /**
83
+ * {@see https://tools.ietf.org/html/rfc6749#section-4.1.4}
84
+ * @type {string}
85
+ */
86
+ redirect_uri: [
87
+ 'string',
88
+ false,
89
+ process.env.WEBEX_REDIRECT_URI ||
90
+ process.env.COMMON_IDENTITY_REDIRECT_URI ||
91
+ process.env.REDIRECT_URI,
92
+ ],
93
+
94
+ /**
95
+ * {@see https://tools.ietf.org/html/rfc6749#section-4.1.4}
96
+ * @type {string}
97
+ */
98
+ scope: [
99
+ 'string',
100
+ false,
101
+ process.env.WEBEX_SCOPE ||
102
+ process.env.WEBEX_SCOPES ||
103
+ process.env.COMMON_IDENTITY_SCOPE ||
104
+ process.env.SCOPE,
105
+ ],
106
+
107
+ /**
108
+ * Controls the UI of the CI login page.
109
+ * @private
110
+ * @type {string}
111
+ */
112
+ cisService: ['string', false, 'webex'],
113
+ },
114
+
115
+ derived: {
116
+ /**
117
+ * User activation URL
118
+ * {@link config.credentials.activationUrl}
119
+ * @type {string}
120
+ */
121
+ activationUrl: {
122
+ deps: ['idbroker.url'],
123
+ fn() {
124
+ return `${
125
+ this.idbroker.url || 'https://idbroker.webex.com'
126
+ }/idb/token/v1/actions/UserActivation/invoke`;
127
+ },
128
+ cache: false,
129
+ },
130
+
131
+ /**
132
+ * Generate OTP URL
133
+ * {@link config.credentials.generateOtpUrl}
134
+ * @type {string}
135
+ */
136
+ generateOtpUrl: {
137
+ deps: ['idbroker.url'],
138
+ fn() {
139
+ return `${
140
+ this.idbroker.url || 'https://idbroker.webex.com'
141
+ }/idb/token/v1/actions/UserOTP/Generate/invoke`;
142
+ },
143
+ cache: false,
144
+ },
145
+
146
+ /**
147
+ * Validate OTP URL
148
+ * {@link config.credentials.validateOtpUrl}
149
+ * @type {string}
150
+ */
151
+ validateOtpUrl: {
152
+ deps: ['idbroker.url'],
153
+ fn() {
154
+ return `${
155
+ this.idbroker.url || 'https://idbroker.webex.com'
156
+ }/idb/token/v1/actions/UserOTP/Validate/invoke`;
157
+ },
158
+ cache: false,
159
+ },
160
+
161
+ // TODO does hydra also have an access_token endpoint?
162
+ /**
163
+ * Token URL used for token refresh and auth code exchange
164
+ * @type {string}
165
+ */
166
+ tokenUrl: {
167
+ deps: ['idbroker.url'],
168
+ fn() {
169
+ return process.env.TOKEN_URL || `${this.idbroker.url}/idb/oauth2/v1/access_token`;
170
+ },
171
+ cache: false,
172
+ },
173
+
174
+ /**
175
+ * URL to revoke token
176
+ * @type {string}
177
+ */
178
+ revokeUrl: {
179
+ deps: ['idbroker.url'],
180
+ fn() {
181
+ return process.env.REVOKE_URL || `${this.idbroker.url}/idb/oauth2/v1/revoke`;
182
+ },
183
+ cache: false,
184
+ },
185
+
186
+ /**
187
+ * URL to load when the app logs out
188
+ * @type {string}
189
+ */
190
+ logoutUrl: {
191
+ deps: ['idbroker.url'],
192
+ fn() {
193
+ return `${this.idbroker.url}/idb/oauth2/v1/logout`;
194
+ },
195
+ cache: false,
196
+ },
197
+
198
+ /**
199
+ * Set password URL
200
+ * @type {string}
201
+ */
202
+ setPasswordUrl: {
203
+ deps: ['identity.url'],
204
+ fn() {
205
+ return `${this.identity.url || 'https://identity.webex.com'}/identity/scim/v1/Users`;
206
+ },
207
+ cache: false,
208
+ },
209
+ },
210
+ });
211
+
212
+ export default CredentialsConfig;