@webex/plugin-authorization-browser 2.59.3-next.1 → 2.59.4
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/.eslintrc.js +6 -6
- package/README.md +53 -53
- package/babel.config.js +3 -3
- package/dist/authorization.js +109 -109
- package/dist/authorization.js.map +1 -1
- package/dist/config.js +8 -8
- package/dist/config.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/jest.config.js +3 -3
- package/package.json +19 -20
- package/process +1 -1
- package/src/authorization.js +394 -394
- package/src/config.js +16 -16
- package/src/index.js +19 -19
- package/test/automation/fixtures/app.js +76 -76
- package/test/automation/fixtures/index.html +27 -27
- package/test/automation/spec/authorization-code-grant.js +123 -123
- package/test/automation/spec/implicit-grant.js +90 -90
- package/test/integration/spec/authorization.js +76 -76
- package/test/unit/spec/authorization.js +430 -430
package/.eslintrc.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const config = {
|
|
2
|
-
root: true,
|
|
3
|
-
extends: ['@webex/eslint-config-legacy'],
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
module.exports = config;
|
|
1
|
+
const config = {
|
|
2
|
+
root: true,
|
|
3
|
+
extends: ['@webex/eslint-config-legacy'],
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
module.exports = config;
|
package/README.md
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
# @webex/plugin-authorization-browser
|
|
2
|
-
|
|
3
|
-
[](https://github.com/RichardLitt/standard-readme)
|
|
4
|
-
|
|
5
|
-
> Authorization plugin loaded when the Cisco Webex JS SDK is used in a web browser.
|
|
6
|
-
|
|
7
|
-
- [Install](#install)
|
|
8
|
-
- [Usage](#usage)
|
|
9
|
-
- [Contribute](#contribute)
|
|
10
|
-
- [Maintainers](#maintainers)
|
|
11
|
-
- [License](#license)
|
|
12
|
-
|
|
13
|
-
## Install
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
npm install --save @webex/plugin-authorization-browser
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Usage
|
|
20
|
-
|
|
21
|
-
This is a plugin for the Cisco Webex JS SDK . Please see our [developer portal](https://developer.webex.com/) and the [API docs](https://webex.github.io/webex-js-sdk/api/) for full details.
|
|
22
|
-
|
|
23
|
-
## Install
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
npm install --save @webex/plugin-authorization-browser
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
## Usage
|
|
30
|
-
|
|
31
|
-
```js
|
|
32
|
-
|
|
33
|
-
const Webex = require('webex');
|
|
34
|
-
|
|
35
|
-
const webex = Webex.init();
|
|
36
|
-
webex.authorization-browser.get(id)
|
|
37
|
-
.then((authorization-browser) => {
|
|
38
|
-
console.log(authorization-browser);
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
## Maintainers
|
|
44
|
-
|
|
45
|
-
This package is maintained by [Cisco Webex for Developers](https://developer.webex.com/).
|
|
46
|
-
|
|
47
|
-
## Contribute
|
|
48
|
-
|
|
49
|
-
Pull requests welcome. Please see [CONTRIBUTING.md](https://github.com/webex/webex-js-sdk/blob/master/CONTRIBUTING.md) for more details.
|
|
50
|
-
|
|
51
|
-
## License
|
|
52
|
-
|
|
53
|
-
© 2016-2020 Cisco and/or its affiliates. All Rights Reserved.
|
|
1
|
+
# @webex/plugin-authorization-browser
|
|
2
|
+
|
|
3
|
+
[](https://github.com/RichardLitt/standard-readme)
|
|
4
|
+
|
|
5
|
+
> Authorization plugin loaded when the Cisco Webex JS SDK is used in a web browser.
|
|
6
|
+
|
|
7
|
+
- [Install](#install)
|
|
8
|
+
- [Usage](#usage)
|
|
9
|
+
- [Contribute](#contribute)
|
|
10
|
+
- [Maintainers](#maintainers)
|
|
11
|
+
- [License](#license)
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install --save @webex/plugin-authorization-browser
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
This is a plugin for the Cisco Webex JS SDK . Please see our [developer portal](https://developer.webex.com/) and the [API docs](https://webex.github.io/webex-js-sdk/api/) for full details.
|
|
22
|
+
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install --save @webex/plugin-authorization-browser
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
```js
|
|
32
|
+
|
|
33
|
+
const Webex = require('webex');
|
|
34
|
+
|
|
35
|
+
const webex = Webex.init();
|
|
36
|
+
webex.authorization-browser.get(id)
|
|
37
|
+
.then((authorization-browser) => {
|
|
38
|
+
console.log(authorization-browser);
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Maintainers
|
|
44
|
+
|
|
45
|
+
This package is maintained by [Cisco Webex for Developers](https://developer.webex.com/).
|
|
46
|
+
|
|
47
|
+
## Contribute
|
|
48
|
+
|
|
49
|
+
Pull requests welcome. Please see [CONTRIBUTING.md](https://github.com/webex/webex-js-sdk/blob/master/CONTRIBUTING.md) for more details.
|
|
50
|
+
|
|
51
|
+
## License
|
|
52
|
+
|
|
53
|
+
© 2016-2020 Cisco and/or its affiliates. All Rights Reserved.
|
package/babel.config.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const babelConfigLegacy = require('@webex/babel-config-legacy');
|
|
2
|
-
|
|
3
|
-
module.exports = babelConfigLegacy;
|
|
1
|
+
const babelConfigLegacy = require('@webex/babel-config-legacy');
|
|
2
|
+
|
|
3
|
+
module.exports = babelConfigLegacy;
|
package/dist/authorization.js
CHANGED
|
@@ -34,19 +34,19 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
34
34
|
var OAUTH2_CSRF_TOKEN = 'oauth2-csrf-token';
|
|
35
35
|
var EMPTY_OBJECT_STRING = _common.base64.encode((0, _stringify.default)({}));
|
|
36
36
|
|
|
37
|
-
/**
|
|
38
|
-
* Browser support for OAuth2. Automatically parses the URL hash for an access
|
|
39
|
-
* token
|
|
40
|
-
* @class
|
|
41
|
-
* @name AuthorizationBrowser
|
|
37
|
+
/**
|
|
38
|
+
* Browser support for OAuth2. Automatically parses the URL hash for an access
|
|
39
|
+
* token
|
|
40
|
+
* @class
|
|
41
|
+
* @name AuthorizationBrowser
|
|
42
42
|
*/
|
|
43
43
|
var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFlight)('isAuthorizing'), _dec2 = (0, _common.whileInFlight)('isAuthorizing'), (_obj = {
|
|
44
44
|
derived: {
|
|
45
|
-
/**
|
|
46
|
-
* Alias of {@link AuthorizationBrowser#isAuthorizing}
|
|
47
|
-
* @instance
|
|
48
|
-
* @memberof AuthorizationBrowser
|
|
49
|
-
* @type {boolean}
|
|
45
|
+
/**
|
|
46
|
+
* Alias of {@link AuthorizationBrowser#isAuthorizing}
|
|
47
|
+
* @instance
|
|
48
|
+
* @memberof AuthorizationBrowser
|
|
49
|
+
* @type {boolean}
|
|
50
50
|
*/
|
|
51
51
|
isAuthenticating: {
|
|
52
52
|
deps: ['isAuthorizing'],
|
|
@@ -56,11 +56,11 @@ var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFli
|
|
|
56
56
|
}
|
|
57
57
|
},
|
|
58
58
|
session: {
|
|
59
|
-
/**
|
|
60
|
-
* Indicates if an Authorization Code exchange is inflight
|
|
61
|
-
* @instance
|
|
62
|
-
* @memberof AuthorizationBrowser
|
|
63
|
-
* @type {boolean}
|
|
59
|
+
/**
|
|
60
|
+
* Indicates if an Authorization Code exchange is inflight
|
|
61
|
+
* @instance
|
|
62
|
+
* @memberof AuthorizationBrowser
|
|
63
|
+
* @type {boolean}
|
|
64
64
|
*/
|
|
65
65
|
isAuthorizing: {
|
|
66
66
|
default: false,
|
|
@@ -72,15 +72,15 @@ var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFli
|
|
|
72
72
|
}
|
|
73
73
|
},
|
|
74
74
|
namespace: 'Credentials',
|
|
75
|
-
/**
|
|
76
|
-
* Initializer
|
|
77
|
-
* @instance
|
|
78
|
-
* @memberof AuthorizationBrowser
|
|
79
|
-
* @param {Object} attrs {@link AmpersandState}
|
|
80
|
-
* @param {boolean} attrs.parse Controls whether or not the the url should get
|
|
81
|
-
* parsed for an access token
|
|
82
|
-
* @private
|
|
83
|
-
* @returns {Authorization}
|
|
75
|
+
/**
|
|
76
|
+
* Initializer
|
|
77
|
+
* @instance
|
|
78
|
+
* @memberof AuthorizationBrowser
|
|
79
|
+
* @param {Object} attrs {@link AmpersandState}
|
|
80
|
+
* @param {boolean} attrs.parse Controls whether or not the the url should get
|
|
81
|
+
* parsed for an access token
|
|
82
|
+
* @private
|
|
83
|
+
* @returns {Authorization}
|
|
84
84
|
*/
|
|
85
85
|
// eslint-disable-next-line complexity
|
|
86
86
|
initialize: function initialize(attrs, options) {
|
|
@@ -123,12 +123,12 @@ var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFli
|
|
|
123
123
|
});
|
|
124
124
|
return ret;
|
|
125
125
|
},
|
|
126
|
-
/**
|
|
127
|
-
* Kicks off an oauth flow
|
|
128
|
-
* @instance
|
|
129
|
-
* @memberof AuthorizationBrowser
|
|
130
|
-
* @param {Object} options
|
|
131
|
-
* @returns {Promise}
|
|
126
|
+
/**
|
|
127
|
+
* Kicks off an oauth flow
|
|
128
|
+
* @instance
|
|
129
|
+
* @memberof AuthorizationBrowser
|
|
130
|
+
* @param {Object} options
|
|
131
|
+
* @returns {Promise}
|
|
132
132
|
*/
|
|
133
133
|
initiateLogin: function initiateLogin() {
|
|
134
134
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -142,13 +142,13 @@ var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFli
|
|
|
142
142
|
}
|
|
143
143
|
return this.initiateImplicitGrant(options);
|
|
144
144
|
},
|
|
145
|
-
/**
|
|
146
|
-
* Kicks off the Authorization Code grant flow. Typically called via
|
|
147
|
-
* {@link AuthorizationBrowser#initiateLogin}
|
|
148
|
-
* @instance
|
|
149
|
-
* @memberof AuthorizationBrowser
|
|
150
|
-
* @param {Object} options
|
|
151
|
-
* @returns {Promise}
|
|
145
|
+
/**
|
|
146
|
+
* Kicks off the Authorization Code grant flow. Typically called via
|
|
147
|
+
* {@link AuthorizationBrowser#initiateLogin}
|
|
148
|
+
* @instance
|
|
149
|
+
* @memberof AuthorizationBrowser
|
|
150
|
+
* @param {Object} options
|
|
151
|
+
* @returns {Promise}
|
|
152
152
|
*/
|
|
153
153
|
initiateImplicitGrant: function initiateImplicitGrant(options) {
|
|
154
154
|
this.logger.info('authorization: initiating implicit grant flow');
|
|
@@ -157,13 +157,13 @@ var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFli
|
|
|
157
157
|
}, options));
|
|
158
158
|
return _promise.default.resolve();
|
|
159
159
|
},
|
|
160
|
-
/**
|
|
161
|
-
* Kicks off the Implicit Code grant flow. Typically called via
|
|
162
|
-
* {@link AuthorizationBrowser#initiateLogin}
|
|
163
|
-
* @instance
|
|
164
|
-
* @memberof AuthorizationBrowser
|
|
165
|
-
* @param {Object} options
|
|
166
|
-
* @returns {Promise}
|
|
160
|
+
/**
|
|
161
|
+
* Kicks off the Implicit Code grant flow. Typically called via
|
|
162
|
+
* {@link AuthorizationBrowser#initiateLogin}
|
|
163
|
+
* @instance
|
|
164
|
+
* @memberof AuthorizationBrowser
|
|
165
|
+
* @param {Object} options
|
|
166
|
+
* @returns {Promise}
|
|
167
167
|
*/
|
|
168
168
|
initiateAuthorizationCodeGrant: function initiateAuthorizationCodeGrant(options) {
|
|
169
169
|
this.logger.info('authorization: initiating authorization code grant flow');
|
|
@@ -172,20 +172,20 @@ var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFli
|
|
|
172
172
|
}, options));
|
|
173
173
|
return _promise.default.resolve();
|
|
174
174
|
},
|
|
175
|
-
/**
|
|
176
|
-
* Requests a Webex access token for a user already authenticated into
|
|
177
|
-
* your product.
|
|
178
|
-
*
|
|
179
|
-
* Note: You'll need to supply a jwtRefreshCallback of the form
|
|
180
|
-
* `Promise<jwt> = jwtRefreshCallback(webex)` for automatic token refresh to
|
|
181
|
-
* work.
|
|
182
|
-
*
|
|
183
|
-
* @instance
|
|
184
|
-
* @memberof AuthorizationBrowser
|
|
185
|
-
* @param {Object} options
|
|
186
|
-
* @param {Object} options.jwt This is a jwt generated by your backend that
|
|
187
|
-
* identifies a user in your system
|
|
188
|
-
* @returns {Promise}
|
|
175
|
+
/**
|
|
176
|
+
* Requests a Webex access token for a user already authenticated into
|
|
177
|
+
* your product.
|
|
178
|
+
*
|
|
179
|
+
* Note: You'll need to supply a jwtRefreshCallback of the form
|
|
180
|
+
* `Promise<jwt> = jwtRefreshCallback(webex)` for automatic token refresh to
|
|
181
|
+
* work.
|
|
182
|
+
*
|
|
183
|
+
* @instance
|
|
184
|
+
* @memberof AuthorizationBrowser
|
|
185
|
+
* @param {Object} options
|
|
186
|
+
* @param {Object} options.jwt This is a jwt generated by your backend that
|
|
187
|
+
* identifies a user in your system
|
|
188
|
+
* @returns {Promise}
|
|
189
189
|
*/
|
|
190
190
|
requestAccessTokenFromJwt: function requestAccessTokenFromJwt(_ref) {
|
|
191
191
|
var _this2 = this;
|
|
@@ -218,13 +218,13 @@ var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFli
|
|
|
218
218
|
return _this2.webex.internal.services.initServiceCatalogs();
|
|
219
219
|
});
|
|
220
220
|
},
|
|
221
|
-
/**
|
|
222
|
-
* Called by {@link WebexCore#logout()}. Redirects to the logout page
|
|
223
|
-
* @instance
|
|
224
|
-
* @memberof AuthorizationBrowser
|
|
225
|
-
* @param {Object} options
|
|
226
|
-
* @param {boolean} options.noRedirect if true, does not redirect
|
|
227
|
-
* @returns {Promise}
|
|
221
|
+
/**
|
|
222
|
+
* Called by {@link WebexCore#logout()}. Redirects to the logout page
|
|
223
|
+
* @instance
|
|
224
|
+
* @memberof AuthorizationBrowser
|
|
225
|
+
* @param {Object} options
|
|
226
|
+
* @param {boolean} options.noRedirect if true, does not redirect
|
|
227
|
+
* @returns {Promise}
|
|
228
228
|
*/
|
|
229
229
|
logout: function logout() {
|
|
230
230
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -232,14 +232,14 @@ var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFli
|
|
|
232
232
|
this.webex.getWindow().location = this.webex.credentials.buildLogoutUrl(options);
|
|
233
233
|
}
|
|
234
234
|
},
|
|
235
|
-
/**
|
|
236
|
-
* Creates a jwt user token
|
|
237
|
-
* @param {object} options
|
|
238
|
-
* @param {String} options.issuer Guest Issuer ID
|
|
239
|
-
* @param {String} options.secretId Guest Secret ID
|
|
240
|
-
* @param {String} options.displayName Guest Display Name | optional
|
|
241
|
-
* @param {String} options.expiresIn
|
|
242
|
-
* @returns {Promise<object>}
|
|
235
|
+
/**
|
|
236
|
+
* Creates a jwt user token
|
|
237
|
+
* @param {object} options
|
|
238
|
+
* @param {String} options.issuer Guest Issuer ID
|
|
239
|
+
* @param {String} options.secretId Guest Secret ID
|
|
240
|
+
* @param {String} options.displayName Guest Display Name | optional
|
|
241
|
+
* @param {String} options.expiresIn
|
|
242
|
+
* @returns {Promise<object>}
|
|
243
243
|
*/
|
|
244
244
|
createJwt: function createJwt(_ref3) {
|
|
245
245
|
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
@@ -276,13 +276,13 @@ var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFli
|
|
|
276
276
|
}, _callee, null, [[4, 11]]);
|
|
277
277
|
}))();
|
|
278
278
|
},
|
|
279
|
-
/**
|
|
280
|
-
* Checks if the result of the login redirect contains an error string
|
|
281
|
-
* @instance
|
|
282
|
-
* @memberof AuthorizationBrowser
|
|
283
|
-
* @param {Object} location
|
|
284
|
-
* @private
|
|
285
|
-
* @returns {Promise}
|
|
279
|
+
/**
|
|
280
|
+
* Checks if the result of the login redirect contains an error string
|
|
281
|
+
* @instance
|
|
282
|
+
* @memberof AuthorizationBrowser
|
|
283
|
+
* @param {Object} location
|
|
284
|
+
* @private
|
|
285
|
+
* @returns {Promise}
|
|
286
286
|
*/
|
|
287
287
|
_checkForErrors: function _checkForErrors(location) {
|
|
288
288
|
var query = location.query;
|
|
@@ -291,13 +291,13 @@ var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFli
|
|
|
291
291
|
throw new ErrorConstructor(query);
|
|
292
292
|
}
|
|
293
293
|
},
|
|
294
|
-
/**
|
|
295
|
-
* Removes no-longer needed values from the url (access token, csrf token, etc)
|
|
296
|
-
* @instance
|
|
297
|
-
* @memberof AuthorizationBrowser
|
|
298
|
-
* @param {Object} location
|
|
299
|
-
* @private
|
|
300
|
-
* @returns {Promise}
|
|
294
|
+
/**
|
|
295
|
+
* Removes no-longer needed values from the url (access token, csrf token, etc)
|
|
296
|
+
* @instance
|
|
297
|
+
* @memberof AuthorizationBrowser
|
|
298
|
+
* @param {Object} location
|
|
299
|
+
* @private
|
|
300
|
+
* @returns {Promise}
|
|
301
301
|
*/
|
|
302
302
|
_cleanUrl: function _cleanUrl(location) {
|
|
303
303
|
location = (0, _cloneDeep2.default)(location);
|
|
@@ -317,12 +317,12 @@ var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFli
|
|
|
317
317
|
this.webex.getWindow().history.replaceState({}, null, _url.default.format(location));
|
|
318
318
|
}
|
|
319
319
|
},
|
|
320
|
-
/**
|
|
321
|
-
* Generates a CSRF token and sticks in in sessionStorage
|
|
322
|
-
* @instance
|
|
323
|
-
* @memberof AuthorizationBrowser
|
|
324
|
-
* @private
|
|
325
|
-
* @returns {Promise}
|
|
320
|
+
/**
|
|
321
|
+
* Generates a CSRF token and sticks in in sessionStorage
|
|
322
|
+
* @instance
|
|
323
|
+
* @memberof AuthorizationBrowser
|
|
324
|
+
* @private
|
|
325
|
+
* @returns {Promise}
|
|
326
326
|
*/
|
|
327
327
|
_generateSecurityToken: function _generateSecurityToken() {
|
|
328
328
|
this.logger.info('authorization: generating csrf token');
|
|
@@ -330,13 +330,13 @@ var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFli
|
|
|
330
330
|
this.webex.getWindow().sessionStorage.setItem('oauth2-csrf-token', token);
|
|
331
331
|
return token;
|
|
332
332
|
},
|
|
333
|
-
/**
|
|
334
|
-
* Parses the url hash into an access token object
|
|
335
|
-
* @instance
|
|
336
|
-
* @memberof AuthorizationBrowser
|
|
337
|
-
* @param {Object} location
|
|
338
|
-
* @private
|
|
339
|
-
* @returns {Object}
|
|
333
|
+
/**
|
|
334
|
+
* Parses the url hash into an access token object
|
|
335
|
+
* @instance
|
|
336
|
+
* @memberof AuthorizationBrowser
|
|
337
|
+
* @param {Object} location
|
|
338
|
+
* @private
|
|
339
|
+
* @returns {Object}
|
|
340
340
|
*/
|
|
341
341
|
_parseHash: function _parseHash(location) {
|
|
342
342
|
var hash = (0, _cloneDeep2.default)(location.hash);
|
|
@@ -355,14 +355,14 @@ var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFli
|
|
|
355
355
|
}
|
|
356
356
|
return hash;
|
|
357
357
|
},
|
|
358
|
-
/**
|
|
359
|
-
* Checks if the CSRF token in sessionStorage is the same as the one returned
|
|
360
|
-
* in the url.
|
|
361
|
-
* @instance
|
|
362
|
-
* @memberof AuthorizationBrowser
|
|
363
|
-
* @param {Object} hash
|
|
364
|
-
* @private
|
|
365
|
-
* @returns {Promise}
|
|
358
|
+
/**
|
|
359
|
+
* Checks if the CSRF token in sessionStorage is the same as the one returned
|
|
360
|
+
* in the url.
|
|
361
|
+
* @instance
|
|
362
|
+
* @memberof AuthorizationBrowser
|
|
363
|
+
* @param {Object} hash
|
|
364
|
+
* @private
|
|
365
|
+
* @returns {Promise}
|
|
366
366
|
*/
|
|
367
367
|
_verifySecurityToken: function _verifySecurityToken(hash) {
|
|
368
368
|
var sessionToken = this.webex.getWindow().sessionStorage.getItem(OAUTH2_CSRF_TOKEN);
|
|
@@ -381,7 +381,7 @@ var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFli
|
|
|
381
381
|
throw new Error("CSRF token ".concat(token, " does not match stored token ").concat(sessionToken));
|
|
382
382
|
}
|
|
383
383
|
},
|
|
384
|
-
version: "2.59.
|
|
384
|
+
version: "2.59.4"
|
|
385
385
|
}, ((0, _applyDecoratedDescriptor2.default)(_obj, "initiateImplicitGrant", [_dec], (0, _getOwnPropertyDescriptor.default)(_obj, "initiateImplicitGrant"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, "initiateAuthorizationCodeGrant", [_dec2], (0, _getOwnPropertyDescriptor.default)(_obj, "initiateAuthorizationCodeGrant"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, "requestAccessTokenFromJwt", [_common.oneFlight], (0, _getOwnPropertyDescriptor.default)(_obj, "requestAccessTokenFromJwt"), _obj)), _obj)));
|
|
386
386
|
var _default = Authorization;
|
|
387
387
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_querystring","_interopRequireDefault","require","_url","_common","_webexCore","_uuid","jose","_interopRequireWildcard","_dec","_dec2","_obj","_getRequireWildcardCache","nodeInterop","_WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","default","cache","has","get","newObj","hasPropertyDescriptor","_Object$defineProperty","_Object$getOwnPropertyDescriptor2","key","Object","prototype","hasOwnProperty","call","desc","set","OAUTH2_CSRF_TOKEN","EMPTY_OBJECT_STRING","base64","encode","_stringify","Authorization","WebexPlugin","extend","whileInFlight","derived","isAuthenticating","deps","fn","isAuthorizing","session","type","ready","namespace","initialize","attrs","options","_this","ret","_apply","parse","location","url","webex","getWindow","href","_checkForErrors","hash","includes","substr","querystring","state","JSON","decode","tokenData","_parseHash","_cleanUrl","process","nextTick","credentials","supertoken","initiateLogin","arguments","length","undefined","csrf_token","_generateSecurityToken","config","clientType","initiateAuthorizationCodeGrant","initiateImplicitGrant","logger","info","buildLoginUrl","_assign","response_type","_promise","resolve","requestAccessTokenFromJwt","_ref","_this2","jwt","hydraUri","internal","services","slice","env","HYDRA_SERVICE_URL","request","method","uri","concat","headers","authorization","then","_ref2","body","access_token","token","token_type","expires_in","expiresIn","initServiceCatalogs","logout","noRedirect","buildLogoutUrl","createJwt","_ref3","_asyncToGenerator2","_regenerator","mark","_callee","issuer","secretId","displayName","secret","payload","alg","jwtToken","wrap","_callee$","_context","prev","next","Buffer","from","uuid","SignJWT","setProtectedHeader","setExpirationTime","sign","sent","abrupt","t0","reject","stop","query","error","ErrorConstructor","grantErrors","select","_cloneDeep2","history","replaceState","forEach","_deleteProperty","_isEmpty2","_omit2","stringify","format","v4","sessionStorage","setItem","_verifySecurityToken","_parseInt2","refresh_token_expires_in","sessionToken","getItem","removeItem","Error","version","_applyDecoratedDescriptor2","_getOwnPropertyDescriptor","oneFlight","_default","exports"],"sources":["authorization.js"],"sourcesContent":["/*!\r\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\r\n */\r\n\r\n/* eslint camelcase: [0] */\r\n\r\nimport querystring from 'querystring';\r\nimport url from 'url';\r\n\r\nimport {base64, oneFlight, whileInFlight} from '@webex/common';\r\nimport {grantErrors, WebexPlugin} from '@webex/webex-core';\r\nimport {cloneDeep, isEmpty, omit} from 'lodash';\r\nimport uuid from 'uuid';\r\nimport * as jose from 'jose'\r\n\r\nconst OAUTH2_CSRF_TOKEN = 'oauth2-csrf-token';\r\nconst EMPTY_OBJECT_STRING = base64.encode(JSON.stringify({}));\r\n\r\n/**\r\n * Browser support for OAuth2. Automatically parses the URL hash for an access\r\n * token\r\n * @class\r\n * @name AuthorizationBrowser\r\n */\r\nconst Authorization = WebexPlugin.extend({\r\n derived: {\r\n /**\r\n * Alias of {@link AuthorizationBrowser#isAuthorizing}\r\n * @instance\r\n * @memberof AuthorizationBrowser\r\n * @type {boolean}\r\n */\r\n isAuthenticating: {\r\n deps: ['isAuthorizing'],\r\n fn() {\r\n return this.isAuthorizing;\r\n },\r\n },\r\n },\r\n\r\n session: {\r\n /**\r\n * Indicates if an Authorization Code exchange is inflight\r\n * @instance\r\n * @memberof AuthorizationBrowser\r\n * @type {boolean}\r\n */\r\n isAuthorizing: {\r\n default: false,\r\n type: 'boolean',\r\n },\r\n ready: {\r\n default: false,\r\n type: 'boolean',\r\n },\r\n },\r\n\r\n namespace: 'Credentials',\r\n\r\n /**\r\n * Initializer\r\n * @instance\r\n * @memberof AuthorizationBrowser\r\n * @param {Object} attrs {@link AmpersandState}\r\n * @param {boolean} attrs.parse Controls whether or not the the url should get\r\n * parsed for an access token\r\n * @private\r\n * @returns {Authorization}\r\n */\r\n // eslint-disable-next-line complexity\r\n initialize(attrs, options) {\r\n const ret = Reflect.apply(WebexPlugin.prototype.initialize, this, [attrs, options]);\r\n\r\n // Reminder, we can't do parse based on config, because config is not\r\n // available until nextTick and we want to be able to throw errors found in\r\n // the url.\r\n if (attrs.parse === false) {\r\n this.ready = true;\r\n\r\n return ret;\r\n }\r\n const location = url.parse(this.webex.getWindow().location.href, true);\r\n\r\n this._checkForErrors(location);\r\n\r\n let {hash} = location;\r\n\r\n if (!hash) {\r\n this.ready = true;\r\n\r\n return ret;\r\n }\r\n if (hash.includes('#')) {\r\n hash = hash.substr(1);\r\n }\r\n location.hash = querystring.parse(hash);\r\n if (location.hash.state) {\r\n location.hash.state = JSON.parse(base64.decode(location.hash.state));\r\n }\r\n const tokenData = this._parseHash(location);\r\n\r\n if (!tokenData) {\r\n return ret;\r\n }\r\n this._cleanUrl(location);\r\n\r\n // Wait until nextTick in case `credentials` hasn't initialized yet\r\n process.nextTick(() => {\r\n this.webex.credentials.set({supertoken: tokenData});\r\n this.ready = true;\r\n });\r\n\r\n return ret;\r\n },\r\n\r\n /**\r\n * Kicks off an oauth flow\r\n * @instance\r\n * @memberof AuthorizationBrowser\r\n * @param {Object} options\r\n * @returns {Promise}\r\n */\r\n initiateLogin(options = {}) {\r\n options.state = options.state || {};\r\n options.state.csrf_token = this._generateSecurityToken();\r\n\r\n // If we're not explicitly a confidential client, assume we're a public\r\n // client\r\n if (this.config.clientType === 'confidential') {\r\n return this.initiateAuthorizationCodeGrant(options);\r\n }\r\n\r\n return this.initiateImplicitGrant(options);\r\n },\r\n\r\n @whileInFlight('isAuthorizing')\r\n /**\r\n * Kicks off the Authorization Code grant flow. Typically called via\r\n * {@link AuthorizationBrowser#initiateLogin}\r\n * @instance\r\n * @memberof AuthorizationBrowser\r\n * @param {Object} options\r\n * @returns {Promise}\r\n */\r\n initiateImplicitGrant(options) {\r\n this.logger.info('authorization: initiating implicit grant flow');\r\n this.webex.getWindow().location = this.webex.credentials.buildLoginUrl(\r\n Object.assign({response_type: 'token'}, options)\r\n );\r\n\r\n return Promise.resolve();\r\n },\r\n\r\n @whileInFlight('isAuthorizing')\r\n /**\r\n * Kicks off the Implicit Code grant flow. Typically called via\r\n * {@link AuthorizationBrowser#initiateLogin}\r\n * @instance\r\n * @memberof AuthorizationBrowser\r\n * @param {Object} options\r\n * @returns {Promise}\r\n */\r\n initiateAuthorizationCodeGrant(options) {\r\n this.logger.info('authorization: initiating authorization code grant flow');\r\n this.webex.getWindow().location = this.webex.credentials.buildLoginUrl(\r\n Object.assign({response_type: 'code'}, options)\r\n );\r\n\r\n return Promise.resolve();\r\n },\r\n\r\n @oneFlight\r\n /**\r\n * Requests a Webex access token for a user already authenticated into\r\n * your product.\r\n *\r\n * Note: You'll need to supply a jwtRefreshCallback of the form\r\n * `Promise<jwt> = jwtRefreshCallback(webex)` for automatic token refresh to\r\n * work.\r\n *\r\n * @instance\r\n * @memberof AuthorizationBrowser\r\n * @param {Object} options\r\n * @param {Object} options.jwt This is a jwt generated by your backend that\r\n * identifies a user in your system\r\n * @returns {Promise}\r\n */\r\n requestAccessTokenFromJwt({jwt}) {\r\n let hydraUri = this.webex.internal.services.get('hydra', true);\r\n\r\n if (hydraUri && hydraUri.slice(-1) !== '/') {\r\n // add a `/` to hydra's uri from the services catalog so that\r\n // it matches the current env service format.\r\n hydraUri += '/';\r\n }\r\n\r\n hydraUri = hydraUri || process.env.HYDRA_SERVICE_URL || 'https://api.ciscospark.com/v1/';\r\n\r\n return this.webex\r\n .request({\r\n method: 'POST',\r\n uri: `${hydraUri}jwt/login`,\r\n headers: {\r\n authorization: jwt,\r\n },\r\n })\r\n .then(({body}) => ({\r\n access_token: body.token,\r\n token_type: 'Bearer',\r\n expires_in: body.expiresIn,\r\n }))\r\n .then((token) => {\r\n this.webex.credentials.set({\r\n supertoken: token,\r\n });\r\n })\r\n .then(() => this.webex.internal.services.initServiceCatalogs());\r\n },\r\n\r\n /**\r\n * Called by {@link WebexCore#logout()}. Redirects to the logout page\r\n * @instance\r\n * @memberof AuthorizationBrowser\r\n * @param {Object} options\r\n * @param {boolean} options.noRedirect if true, does not redirect\r\n * @returns {Promise}\r\n */\r\n logout(options = {}) {\r\n if (!options.noRedirect) {\r\n this.webex.getWindow().location = this.webex.credentials.buildLogoutUrl(options);\r\n }\r\n },\r\n\r\n /**\r\n * Creates a jwt user token\r\n * @param {object} options\r\n * @param {String} options.issuer Guest Issuer ID\r\n * @param {String} options.secretId Guest Secret ID\r\n * @param {String} options.displayName Guest Display Name | optional\r\n * @param {String} options.expiresIn\r\n * @returns {Promise<object>}\r\n */\r\n async createJwt({issuer, secretId, displayName, expiresIn}) {\r\n const secret = Buffer.from(secretId, 'base64');\r\n const payload = {\r\n \"sub\": `guest-user-${uuid()}`,\r\n \"iss\": issuer,\r\n \"name\": displayName || `Guest User - ${uuid()}`\r\n };\r\n const alg = 'HS256';\r\n\r\n try {\r\n const jwtToken = await new jose.SignJWT(payload)\r\n .setProtectedHeader({alg})\r\n .setExpirationTime(expiresIn)\r\n .sign(secret);\r\n\r\n return Promise.resolve({jwt: jwtToken});\r\n } catch (e) {\r\n return Promise.reject(e);\r\n }\r\n },\r\n\r\n /**\r\n * Checks if the result of the login redirect contains an error string\r\n * @instance\r\n * @memberof AuthorizationBrowser\r\n * @param {Object} location\r\n * @private\r\n * @returns {Promise}\r\n */\r\n _checkForErrors(location) {\r\n const {query} = location;\r\n\r\n if (query && query.error) {\r\n const ErrorConstructor = grantErrors.select(query.error);\r\n\r\n throw new ErrorConstructor(query);\r\n }\r\n },\r\n\r\n /**\r\n * Removes no-longer needed values from the url (access token, csrf token, etc)\r\n * @instance\r\n * @memberof AuthorizationBrowser\r\n * @param {Object} location\r\n * @private\r\n * @returns {Promise}\r\n */\r\n _cleanUrl(location) {\r\n location = cloneDeep(location);\r\n if (this.webex.getWindow().history && this.webex.getWindow().history.replaceState) {\r\n [\r\n 'access_token',\r\n 'token_type',\r\n 'expires_in',\r\n 'refresh_token',\r\n 'refresh_token_expires_in',\r\n ].forEach((key) => Reflect.deleteProperty(location.hash, key));\r\n if (!isEmpty(location.hash.state)) {\r\n location.hash.state = base64.encode(\r\n JSON.stringify(omit(location.hash.state, 'csrf_token'))\r\n );\r\n if (location.hash.state === EMPTY_OBJECT_STRING) {\r\n Reflect.deleteProperty(location.hash, 'state');\r\n }\r\n } else {\r\n Reflect.deleteProperty(location.hash, 'state');\r\n }\r\n location.hash = querystring.stringify(location.hash);\r\n this.webex.getWindow().history.replaceState({}, null, url.format(location));\r\n }\r\n },\r\n\r\n /**\r\n * Generates a CSRF token and sticks in in sessionStorage\r\n * @instance\r\n * @memberof AuthorizationBrowser\r\n * @private\r\n * @returns {Promise}\r\n */\r\n _generateSecurityToken() {\r\n this.logger.info('authorization: generating csrf token');\r\n\r\n const token = uuid.v4();\r\n\r\n this.webex.getWindow().sessionStorage.setItem('oauth2-csrf-token', token);\r\n\r\n return token;\r\n },\r\n\r\n /**\r\n * Parses the url hash into an access token object\r\n * @instance\r\n * @memberof AuthorizationBrowser\r\n * @param {Object} location\r\n * @private\r\n * @returns {Object}\r\n */\r\n _parseHash(location) {\r\n const hash = cloneDeep(location.hash);\r\n\r\n if (hash) {\r\n this._verifySecurityToken(hash);\r\n }\r\n if (!hash.access_token) {\r\n this.ready = true;\r\n\r\n return undefined;\r\n }\r\n if (hash.expires_in) {\r\n hash.expires_in = parseInt(hash.expires_in, 10);\r\n }\r\n if (hash.refresh_token_expires_in) {\r\n hash.refresh_token_expires_in = parseInt(hash.refresh_token_expires_in, 10);\r\n }\r\n\r\n return hash;\r\n },\r\n\r\n /**\r\n * Checks if the CSRF token in sessionStorage is the same as the one returned\r\n * in the url.\r\n * @instance\r\n * @memberof AuthorizationBrowser\r\n * @param {Object} hash\r\n * @private\r\n * @returns {Promise}\r\n */\r\n _verifySecurityToken(hash) {\r\n const sessionToken = this.webex.getWindow().sessionStorage.getItem(OAUTH2_CSRF_TOKEN);\r\n\r\n this.webex.getWindow().sessionStorage.removeItem(OAUTH2_CSRF_TOKEN);\r\n if (!sessionToken) {\r\n return;\r\n }\r\n\r\n if (!hash.state) {\r\n throw new Error(`Expected CSRF token ${sessionToken}, but not found in redirect hash`);\r\n }\r\n\r\n if (!hash.state.csrf_token) {\r\n throw new Error(`Expected CSRF token ${sessionToken}, but not found in redirect hash`);\r\n }\r\n\r\n const token = hash.state.csrf_token;\r\n\r\n if (token !== sessionToken) {\r\n throw new Error(`CSRF token ${token} does not match stored token ${sessionToken}`);\r\n }\r\n },\r\n});\r\n\r\nexport default Authorization;\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAMA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAEA,IAAAI,KAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,IAAA,GAAAC,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CAAmC;IACxF;IAEA,IAAM1D,KAAK,GAAGnD,IAAI,CAACI,KAAK,CAACc,UAAU;IAEnC,IAAIiC,KAAK,KAAK0D,YAAY,EAAE;MAC1B,MAAM,IAAIG,KAAK,eAAApE,MAAA,CAAeO,KAAK,mCAAAP,MAAA,CAAgCiE,YAAY,EAAG;IACpF;EACF,CAAC;EAAAI,OAAA;AACH,CAAC,OAAAC,0BAAA,CAAAhK,OAAA,EAAAT,IAAA,4BAAAF,IAAA,OAAA4K,yBAAA,CAAAjK,OAAA,EAAAT,IAAA,4BAAAA,IAAA,OAAAyK,0BAAA,CAAAhK,OAAA,EAAAT,IAAA,qCAAAD,KAAA,OAAA2K,yBAAA,CAAAjK,OAAA,EAAAT,IAAA,qCAAAA,IAAA,OAAAyK,0BAAA,CAAAhK,OAAA,EAAAT,IAAA,gCA5NE2K,iBAAS,OAAAD,yBAAA,CAAAjK,OAAA,EAAAT,IAAA,gCAAAA,IAAA,IAAAA,IAAA,GA4NV;AAAC,IAAA4K,QAAA,GAEY/I,aAAa;AAAAgJ,OAAA,CAAApK,OAAA,GAAAmK,QAAA"}
|
|
1
|
+
{"version":3,"names":["_querystring","_interopRequireDefault","require","_url","_common","_webexCore","_uuid","jose","_interopRequireWildcard","_dec","_dec2","_obj","_getRequireWildcardCache","nodeInterop","_WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","default","cache","has","get","newObj","hasPropertyDescriptor","_Object$defineProperty","_Object$getOwnPropertyDescriptor2","key","Object","prototype","hasOwnProperty","call","desc","set","OAUTH2_CSRF_TOKEN","EMPTY_OBJECT_STRING","base64","encode","_stringify","Authorization","WebexPlugin","extend","whileInFlight","derived","isAuthenticating","deps","fn","isAuthorizing","session","type","ready","namespace","initialize","attrs","options","_this","ret","_apply","parse","location","url","webex","getWindow","href","_checkForErrors","hash","includes","substr","querystring","state","JSON","decode","tokenData","_parseHash","_cleanUrl","process","nextTick","credentials","supertoken","initiateLogin","arguments","length","undefined","csrf_token","_generateSecurityToken","config","clientType","initiateAuthorizationCodeGrant","initiateImplicitGrant","logger","info","buildLoginUrl","_assign","response_type","_promise","resolve","requestAccessTokenFromJwt","_ref","_this2","jwt","hydraUri","internal","services","slice","env","HYDRA_SERVICE_URL","request","method","uri","concat","headers","authorization","then","_ref2","body","access_token","token","token_type","expires_in","expiresIn","initServiceCatalogs","logout","noRedirect","buildLogoutUrl","createJwt","_ref3","_asyncToGenerator2","_regenerator","mark","_callee","issuer","secretId","displayName","secret","payload","alg","jwtToken","wrap","_callee$","_context","prev","next","Buffer","from","uuid","SignJWT","setProtectedHeader","setExpirationTime","sign","sent","abrupt","t0","reject","stop","query","error","ErrorConstructor","grantErrors","select","_cloneDeep2","history","replaceState","forEach","_deleteProperty","_isEmpty2","_omit2","stringify","format","v4","sessionStorage","setItem","_verifySecurityToken","_parseInt2","refresh_token_expires_in","sessionToken","getItem","removeItem","Error","version","_applyDecoratedDescriptor2","_getOwnPropertyDescriptor","oneFlight","_default","exports"],"sources":["authorization.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n/* eslint camelcase: [0] */\n\nimport querystring from 'querystring';\nimport url from 'url';\n\nimport {base64, oneFlight, whileInFlight} from '@webex/common';\nimport {grantErrors, WebexPlugin} from '@webex/webex-core';\nimport {cloneDeep, isEmpty, omit} from 'lodash';\nimport uuid from 'uuid';\nimport * as jose from 'jose'\n\nconst OAUTH2_CSRF_TOKEN = 'oauth2-csrf-token';\nconst EMPTY_OBJECT_STRING = base64.encode(JSON.stringify({}));\n\n/**\n * Browser support for OAuth2. Automatically parses the URL hash for an access\n * token\n * @class\n * @name AuthorizationBrowser\n */\nconst Authorization = WebexPlugin.extend({\n derived: {\n /**\n * Alias of {@link AuthorizationBrowser#isAuthorizing}\n * @instance\n * @memberof AuthorizationBrowser\n * @type {boolean}\n */\n isAuthenticating: {\n deps: ['isAuthorizing'],\n fn() {\n return this.isAuthorizing;\n },\n },\n },\n\n session: {\n /**\n * Indicates if an Authorization Code exchange is inflight\n * @instance\n * @memberof AuthorizationBrowser\n * @type {boolean}\n */\n isAuthorizing: {\n default: false,\n type: 'boolean',\n },\n ready: {\n default: false,\n type: 'boolean',\n },\n },\n\n namespace: 'Credentials',\n\n /**\n * Initializer\n * @instance\n * @memberof AuthorizationBrowser\n * @param {Object} attrs {@link AmpersandState}\n * @param {boolean} attrs.parse Controls whether or not the the url should get\n * parsed for an access token\n * @private\n * @returns {Authorization}\n */\n // eslint-disable-next-line complexity\n initialize(attrs, options) {\n const ret = Reflect.apply(WebexPlugin.prototype.initialize, this, [attrs, options]);\n\n // Reminder, we can't do parse based on config, because config is not\n // available until nextTick and we want to be able to throw errors found in\n // the url.\n if (attrs.parse === false) {\n this.ready = true;\n\n return ret;\n }\n const location = url.parse(this.webex.getWindow().location.href, true);\n\n this._checkForErrors(location);\n\n let {hash} = location;\n\n if (!hash) {\n this.ready = true;\n\n return ret;\n }\n if (hash.includes('#')) {\n hash = hash.substr(1);\n }\n location.hash = querystring.parse(hash);\n if (location.hash.state) {\n location.hash.state = JSON.parse(base64.decode(location.hash.state));\n }\n const tokenData = this._parseHash(location);\n\n if (!tokenData) {\n return ret;\n }\n this._cleanUrl(location);\n\n // Wait until nextTick in case `credentials` hasn't initialized yet\n process.nextTick(() => {\n this.webex.credentials.set({supertoken: tokenData});\n this.ready = true;\n });\n\n return ret;\n },\n\n /**\n * Kicks off an oauth flow\n * @instance\n * @memberof AuthorizationBrowser\n * @param {Object} options\n * @returns {Promise}\n */\n initiateLogin(options = {}) {\n options.state = options.state || {};\n options.state.csrf_token = this._generateSecurityToken();\n\n // If we're not explicitly a confidential client, assume we're a public\n // client\n if (this.config.clientType === 'confidential') {\n return this.initiateAuthorizationCodeGrant(options);\n }\n\n return this.initiateImplicitGrant(options);\n },\n\n @whileInFlight('isAuthorizing')\n /**\n * Kicks off the Authorization Code grant flow. Typically called via\n * {@link AuthorizationBrowser#initiateLogin}\n * @instance\n * @memberof AuthorizationBrowser\n * @param {Object} options\n * @returns {Promise}\n */\n initiateImplicitGrant(options) {\n this.logger.info('authorization: initiating implicit grant flow');\n this.webex.getWindow().location = this.webex.credentials.buildLoginUrl(\n Object.assign({response_type: 'token'}, options)\n );\n\n return Promise.resolve();\n },\n\n @whileInFlight('isAuthorizing')\n /**\n * Kicks off the Implicit Code grant flow. Typically called via\n * {@link AuthorizationBrowser#initiateLogin}\n * @instance\n * @memberof AuthorizationBrowser\n * @param {Object} options\n * @returns {Promise}\n */\n initiateAuthorizationCodeGrant(options) {\n this.logger.info('authorization: initiating authorization code grant flow');\n this.webex.getWindow().location = this.webex.credentials.buildLoginUrl(\n Object.assign({response_type: 'code'}, options)\n );\n\n return Promise.resolve();\n },\n\n @oneFlight\n /**\n * Requests a Webex access token for a user already authenticated into\n * your product.\n *\n * Note: You'll need to supply a jwtRefreshCallback of the form\n * `Promise<jwt> = jwtRefreshCallback(webex)` for automatic token refresh to\n * work.\n *\n * @instance\n * @memberof AuthorizationBrowser\n * @param {Object} options\n * @param {Object} options.jwt This is a jwt generated by your backend that\n * identifies a user in your system\n * @returns {Promise}\n */\n requestAccessTokenFromJwt({jwt}) {\n let hydraUri = this.webex.internal.services.get('hydra', true);\n\n if (hydraUri && hydraUri.slice(-1) !== '/') {\n // add a `/` to hydra's uri from the services catalog so that\n // it matches the current env service format.\n hydraUri += '/';\n }\n\n hydraUri = hydraUri || process.env.HYDRA_SERVICE_URL || 'https://api.ciscospark.com/v1/';\n\n return this.webex\n .request({\n method: 'POST',\n uri: `${hydraUri}jwt/login`,\n headers: {\n authorization: jwt,\n },\n })\n .then(({body}) => ({\n access_token: body.token,\n token_type: 'Bearer',\n expires_in: body.expiresIn,\n }))\n .then((token) => {\n this.webex.credentials.set({\n supertoken: token,\n });\n })\n .then(() => this.webex.internal.services.initServiceCatalogs());\n },\n\n /**\n * Called by {@link WebexCore#logout()}. Redirects to the logout page\n * @instance\n * @memberof AuthorizationBrowser\n * @param {Object} options\n * @param {boolean} options.noRedirect if true, does not redirect\n * @returns {Promise}\n */\n logout(options = {}) {\n if (!options.noRedirect) {\n this.webex.getWindow().location = this.webex.credentials.buildLogoutUrl(options);\n }\n },\n\n /**\n * Creates a jwt user token\n * @param {object} options\n * @param {String} options.issuer Guest Issuer ID\n * @param {String} options.secretId Guest Secret ID\n * @param {String} options.displayName Guest Display Name | optional\n * @param {String} options.expiresIn\n * @returns {Promise<object>}\n */\n async createJwt({issuer, secretId, displayName, expiresIn}) {\n const secret = Buffer.from(secretId, 'base64');\n const payload = {\n \"sub\": `guest-user-${uuid()}`,\n \"iss\": issuer,\n \"name\": displayName || `Guest User - ${uuid()}`\n };\n const alg = 'HS256';\n\n try {\n const jwtToken = await new jose.SignJWT(payload)\n .setProtectedHeader({alg})\n .setExpirationTime(expiresIn)\n .sign(secret);\n\n return Promise.resolve({jwt: jwtToken});\n } catch (e) {\n return Promise.reject(e);\n }\n },\n\n /**\n * Checks if the result of the login redirect contains an error string\n * @instance\n * @memberof AuthorizationBrowser\n * @param {Object} location\n * @private\n * @returns {Promise}\n */\n _checkForErrors(location) {\n const {query} = location;\n\n if (query && query.error) {\n const ErrorConstructor = grantErrors.select(query.error);\n\n throw new ErrorConstructor(query);\n }\n },\n\n /**\n * Removes no-longer needed values from the url (access token, csrf token, etc)\n * @instance\n * @memberof AuthorizationBrowser\n * @param {Object} location\n * @private\n * @returns {Promise}\n */\n _cleanUrl(location) {\n location = cloneDeep(location);\n if (this.webex.getWindow().history && this.webex.getWindow().history.replaceState) {\n [\n 'access_token',\n 'token_type',\n 'expires_in',\n 'refresh_token',\n 'refresh_token_expires_in',\n ].forEach((key) => Reflect.deleteProperty(location.hash, key));\n if (!isEmpty(location.hash.state)) {\n location.hash.state = base64.encode(\n JSON.stringify(omit(location.hash.state, 'csrf_token'))\n );\n if (location.hash.state === EMPTY_OBJECT_STRING) {\n Reflect.deleteProperty(location.hash, 'state');\n }\n } else {\n Reflect.deleteProperty(location.hash, 'state');\n }\n location.hash = querystring.stringify(location.hash);\n this.webex.getWindow().history.replaceState({}, null, url.format(location));\n }\n },\n\n /**\n * Generates a CSRF token and sticks in in sessionStorage\n * @instance\n * @memberof AuthorizationBrowser\n * @private\n * @returns {Promise}\n */\n _generateSecurityToken() {\n this.logger.info('authorization: generating csrf token');\n\n const token = uuid.v4();\n\n this.webex.getWindow().sessionStorage.setItem('oauth2-csrf-token', token);\n\n return token;\n },\n\n /**\n * Parses the url hash into an access token object\n * @instance\n * @memberof AuthorizationBrowser\n * @param {Object} location\n * @private\n * @returns {Object}\n */\n _parseHash(location) {\n const hash = cloneDeep(location.hash);\n\n if (hash) {\n this._verifySecurityToken(hash);\n }\n if (!hash.access_token) {\n this.ready = true;\n\n return undefined;\n }\n if (hash.expires_in) {\n hash.expires_in = parseInt(hash.expires_in, 10);\n }\n if (hash.refresh_token_expires_in) {\n hash.refresh_token_expires_in = parseInt(hash.refresh_token_expires_in, 10);\n }\n\n return hash;\n },\n\n /**\n * Checks if the CSRF token in sessionStorage is the same as the one returned\n * in the url.\n * @instance\n * @memberof AuthorizationBrowser\n * @param {Object} hash\n * @private\n * @returns {Promise}\n */\n _verifySecurityToken(hash) {\n const sessionToken = this.webex.getWindow().sessionStorage.getItem(OAUTH2_CSRF_TOKEN);\n\n this.webex.getWindow().sessionStorage.removeItem(OAUTH2_CSRF_TOKEN);\n if (!sessionToken) {\n return;\n }\n\n if (!hash.state) {\n throw new Error(`Expected CSRF token ${sessionToken}, but not found in redirect hash`);\n }\n\n if (!hash.state.csrf_token) {\n throw new Error(`Expected CSRF token ${sessionToken}, but not found in redirect hash`);\n }\n\n const token = hash.state.csrf_token;\n\n if (token !== sessionToken) {\n throw new Error(`CSRF token ${token} does not match stored token ${sessionToken}`);\n }\n },\n});\n\nexport default Authorization;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAMA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAF,sBAAA,CAAAC,OAAA;A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AAY,sCAAmC;IACxF;IAEA,IAAI,CAAC7G,IAAI,CAACI,KAAK,CAACc,UAAU,EAAE;MAC1B,MAAM,IAAI8F,KAAK,wBAAApE,MAAA,CAAwBiE,YAAY,sCAAmC;IACxF;IAEA,IAAM1D,KAAK,GAAGnD,IAAI,CAACI,KAAK,CAACc,UAAU;IAEnC,IAAIiC,KAAK,KAAK0D,YAAY,EAAE;MAC1B,MAAM,IAAIG,KAAK,eAAApE,MAAA,CAAeO,KAAK,mCAAAP,MAAA,CAAgCiE,YAAY,EAAG;IACpF;EACF,CAAC;EAAAI,OAAA;AACH,CAAC,OAAAC,0BAAA,CAAAhK,OAAA,EAAAT,IAAA,4BAAAF,IAAA,OAAA4K,yBAAA,CAAAjK,OAAA,EAAAT,IAAA,4BAAAA,IAAA,OAAAyK,0BAAA,CAAAhK,OAAA,EAAAT,IAAA,qCAAAD,KAAA,OAAA2K,yBAAA,CAAAjK,OAAA,EAAAT,IAAA,qCAAAA,IAAA,OAAAyK,0BAAA,CAAAhK,OAAA,EAAAT,IAAA,gCA5NE2K,iBAAS,OAAAD,yBAAA,CAAAjK,OAAA,EAAAT,IAAA,gCAAAA,IAAA,IAAAA,IAAA,GA4NV;AAAC,IAAA4K,QAAA,GAEY/I,aAAa;AAAAgJ,OAAA,CAAApK,OAAA,GAAAmK,QAAA"}
|
package/dist/config.js
CHANGED
|
@@ -5,17 +5,17 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
/*!
|
|
9
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
8
|
+
/*!
|
|
9
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
10
10
|
*/
|
|
11
11
|
var _default = {
|
|
12
12
|
credentials: {
|
|
13
|
-
/**
|
|
14
|
-
* Controls whether {@link Authorization#initiateLogin()} requests a token
|
|
15
|
-
* or an auth code. Anything other than 'confidential' will be treated as
|
|
16
|
-
* 'public'
|
|
17
|
-
* @private
|
|
18
|
-
* @type {string}
|
|
13
|
+
/**
|
|
14
|
+
* Controls whether {@link Authorization#initiateLogin()} requests a token
|
|
15
|
+
* or an auth code. Anything other than 'confidential' will be treated as
|
|
16
|
+
* 'public'
|
|
17
|
+
* @private
|
|
18
|
+
* @type {string}
|
|
19
19
|
*/
|
|
20
20
|
clientType: 'public'
|
|
21
21
|
}
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_default","credentials","clientType","exports","default"],"sources":["config.js"],"sourcesContent":["/*!\
|
|
1
|
+
{"version":3,"names":["_default","credentials","clientType","exports","default"],"sources":["config.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nexport default {\n credentials: {\n /**\n * Controls whether {@link Authorization#initiateLogin()} requests a token\n * or an auth code. Anything other than 'confidential' will be treated as\n * 'public'\n * @private\n * @type {string}\n */\n clientType: 'public',\n },\n};\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AAFA,IAAAA,QAAA,GAIe;EACbC,WAAW,EAAE;IACX;AACJ;AACA;AACA;AACA;AACA;AACA;IACIC,UAAU,EAAE;EACd;AACF,CAAC;AAAAC,OAAA,CAAAC,OAAA,GAAAJ,QAAA"}
|
package/dist/index.js
CHANGED
|
@@ -21,8 +21,8 @@ require("@webex/internal-plugin-device");
|
|
|
21
21
|
var _webexCore = require("@webex/webex-core");
|
|
22
22
|
var _authorization = _interopRequireDefault(require("./authorization"));
|
|
23
23
|
var _config = _interopRequireDefault(require("./config"));
|
|
24
|
-
/*!
|
|
25
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
24
|
+
/*!
|
|
25
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
28
|
var proxies = ['isAuthorizing', 'isAuthenticating'];
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["require","_webexCore","_authorization","_interopRequireDefault","_config","proxies","registerPlugin","Authorization","config"],"sources":["index.js"],"sourcesContent":["/*!\
|
|
1
|
+
{"version":3,"names":["require","_webexCore","_authorization","_interopRequireDefault","_config","proxies","registerPlugin","Authorization","config"],"sources":["index.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport '@webex/internal-plugin-device';\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} from './authorization';\nexport {default as config} from './config';\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAIAA,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAEA,IAAAE,cAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,OAAA,GAAAD,sBAAA,CAAAH,OAAA;AARA;AACA;AACA;;AAQA,IAAMK,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"}
|
package/jest.config.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const config = require('@webex/jest-config-legacy');
|
|
2
|
-
|
|
3
|
-
module.exports = config;
|
|
1
|
+
const config = require('@webex/jest-config-legacy');
|
|
2
|
+
|
|
3
|
+
module.exports = config;
|