@webex/plugin-authorization-browser 2.59.3-next.1 → 2.59.4-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/.eslintrc.js +6 -6
- package/README.md +53 -53
- package/babel.config.js +3 -3
- package/dist/authorization.js +114 -116
- 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 +13 -13
- 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
|
@@ -19,13 +19,11 @@ var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/pr
|
|
|
19
19
|
var _deleteProperty = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/reflect/delete-property"));
|
|
20
20
|
var _parseInt2 = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/parse-int"));
|
|
21
21
|
var _getOwnPropertyDescriptor = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptor"));
|
|
22
|
-
var _omit2 = _interopRequireDefault(require("lodash/omit"));
|
|
23
|
-
var _isEmpty2 = _interopRequireDefault(require("lodash/isEmpty"));
|
|
24
|
-
var _cloneDeep2 = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
25
22
|
var _querystring = _interopRequireDefault(require("querystring"));
|
|
26
23
|
var _url = _interopRequireDefault(require("url"));
|
|
27
24
|
var _common = require("@webex/common");
|
|
28
25
|
var _webexCore = require("@webex/webex-core");
|
|
26
|
+
var _lodash = require("lodash");
|
|
29
27
|
var _uuid = _interopRequireDefault(require("uuid"));
|
|
30
28
|
var jose = _interopRequireWildcard(require("jose"));
|
|
31
29
|
var _dec, _dec2, _obj;
|
|
@@ -34,19 +32,19 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
34
32
|
var OAUTH2_CSRF_TOKEN = 'oauth2-csrf-token';
|
|
35
33
|
var EMPTY_OBJECT_STRING = _common.base64.encode((0, _stringify.default)({}));
|
|
36
34
|
|
|
37
|
-
/**
|
|
38
|
-
* Browser support for OAuth2. Automatically parses the URL hash for an access
|
|
39
|
-
* token
|
|
40
|
-
* @class
|
|
41
|
-
* @name AuthorizationBrowser
|
|
35
|
+
/**
|
|
36
|
+
* Browser support for OAuth2. Automatically parses the URL hash for an access
|
|
37
|
+
* token
|
|
38
|
+
* @class
|
|
39
|
+
* @name AuthorizationBrowser
|
|
42
40
|
*/
|
|
43
41
|
var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFlight)('isAuthorizing'), _dec2 = (0, _common.whileInFlight)('isAuthorizing'), (_obj = {
|
|
44
42
|
derived: {
|
|
45
|
-
/**
|
|
46
|
-
* Alias of {@link AuthorizationBrowser#isAuthorizing}
|
|
47
|
-
* @instance
|
|
48
|
-
* @memberof AuthorizationBrowser
|
|
49
|
-
* @type {boolean}
|
|
43
|
+
/**
|
|
44
|
+
* Alias of {@link AuthorizationBrowser#isAuthorizing}
|
|
45
|
+
* @instance
|
|
46
|
+
* @memberof AuthorizationBrowser
|
|
47
|
+
* @type {boolean}
|
|
50
48
|
*/
|
|
51
49
|
isAuthenticating: {
|
|
52
50
|
deps: ['isAuthorizing'],
|
|
@@ -56,11 +54,11 @@ var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFli
|
|
|
56
54
|
}
|
|
57
55
|
},
|
|
58
56
|
session: {
|
|
59
|
-
/**
|
|
60
|
-
* Indicates if an Authorization Code exchange is inflight
|
|
61
|
-
* @instance
|
|
62
|
-
* @memberof AuthorizationBrowser
|
|
63
|
-
* @type {boolean}
|
|
57
|
+
/**
|
|
58
|
+
* Indicates if an Authorization Code exchange is inflight
|
|
59
|
+
* @instance
|
|
60
|
+
* @memberof AuthorizationBrowser
|
|
61
|
+
* @type {boolean}
|
|
64
62
|
*/
|
|
65
63
|
isAuthorizing: {
|
|
66
64
|
default: false,
|
|
@@ -72,15 +70,15 @@ var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFli
|
|
|
72
70
|
}
|
|
73
71
|
},
|
|
74
72
|
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}
|
|
73
|
+
/**
|
|
74
|
+
* Initializer
|
|
75
|
+
* @instance
|
|
76
|
+
* @memberof AuthorizationBrowser
|
|
77
|
+
* @param {Object} attrs {@link AmpersandState}
|
|
78
|
+
* @param {boolean} attrs.parse Controls whether or not the the url should get
|
|
79
|
+
* parsed for an access token
|
|
80
|
+
* @private
|
|
81
|
+
* @returns {Authorization}
|
|
84
82
|
*/
|
|
85
83
|
// eslint-disable-next-line complexity
|
|
86
84
|
initialize: function initialize(attrs, options) {
|
|
@@ -123,12 +121,12 @@ var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFli
|
|
|
123
121
|
});
|
|
124
122
|
return ret;
|
|
125
123
|
},
|
|
126
|
-
/**
|
|
127
|
-
* Kicks off an oauth flow
|
|
128
|
-
* @instance
|
|
129
|
-
* @memberof AuthorizationBrowser
|
|
130
|
-
* @param {Object} options
|
|
131
|
-
* @returns {Promise}
|
|
124
|
+
/**
|
|
125
|
+
* Kicks off an oauth flow
|
|
126
|
+
* @instance
|
|
127
|
+
* @memberof AuthorizationBrowser
|
|
128
|
+
* @param {Object} options
|
|
129
|
+
* @returns {Promise}
|
|
132
130
|
*/
|
|
133
131
|
initiateLogin: function initiateLogin() {
|
|
134
132
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -142,13 +140,13 @@ var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFli
|
|
|
142
140
|
}
|
|
143
141
|
return this.initiateImplicitGrant(options);
|
|
144
142
|
},
|
|
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}
|
|
143
|
+
/**
|
|
144
|
+
* Kicks off the Authorization Code grant flow. Typically called via
|
|
145
|
+
* {@link AuthorizationBrowser#initiateLogin}
|
|
146
|
+
* @instance
|
|
147
|
+
* @memberof AuthorizationBrowser
|
|
148
|
+
* @param {Object} options
|
|
149
|
+
* @returns {Promise}
|
|
152
150
|
*/
|
|
153
151
|
initiateImplicitGrant: function initiateImplicitGrant(options) {
|
|
154
152
|
this.logger.info('authorization: initiating implicit grant flow');
|
|
@@ -157,13 +155,13 @@ var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFli
|
|
|
157
155
|
}, options));
|
|
158
156
|
return _promise.default.resolve();
|
|
159
157
|
},
|
|
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}
|
|
158
|
+
/**
|
|
159
|
+
* Kicks off the Implicit Code grant flow. Typically called via
|
|
160
|
+
* {@link AuthorizationBrowser#initiateLogin}
|
|
161
|
+
* @instance
|
|
162
|
+
* @memberof AuthorizationBrowser
|
|
163
|
+
* @param {Object} options
|
|
164
|
+
* @returns {Promise}
|
|
167
165
|
*/
|
|
168
166
|
initiateAuthorizationCodeGrant: function initiateAuthorizationCodeGrant(options) {
|
|
169
167
|
this.logger.info('authorization: initiating authorization code grant flow');
|
|
@@ -172,20 +170,20 @@ var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFli
|
|
|
172
170
|
}, options));
|
|
173
171
|
return _promise.default.resolve();
|
|
174
172
|
},
|
|
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}
|
|
173
|
+
/**
|
|
174
|
+
* Requests a Webex access token for a user already authenticated into
|
|
175
|
+
* your product.
|
|
176
|
+
*
|
|
177
|
+
* Note: You'll need to supply a jwtRefreshCallback of the form
|
|
178
|
+
* `Promise<jwt> = jwtRefreshCallback(webex)` for automatic token refresh to
|
|
179
|
+
* work.
|
|
180
|
+
*
|
|
181
|
+
* @instance
|
|
182
|
+
* @memberof AuthorizationBrowser
|
|
183
|
+
* @param {Object} options
|
|
184
|
+
* @param {Object} options.jwt This is a jwt generated by your backend that
|
|
185
|
+
* identifies a user in your system
|
|
186
|
+
* @returns {Promise}
|
|
189
187
|
*/
|
|
190
188
|
requestAccessTokenFromJwt: function requestAccessTokenFromJwt(_ref) {
|
|
191
189
|
var _this2 = this;
|
|
@@ -218,13 +216,13 @@ var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFli
|
|
|
218
216
|
return _this2.webex.internal.services.initServiceCatalogs();
|
|
219
217
|
});
|
|
220
218
|
},
|
|
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}
|
|
219
|
+
/**
|
|
220
|
+
* Called by {@link WebexCore#logout()}. Redirects to the logout page
|
|
221
|
+
* @instance
|
|
222
|
+
* @memberof AuthorizationBrowser
|
|
223
|
+
* @param {Object} options
|
|
224
|
+
* @param {boolean} options.noRedirect if true, does not redirect
|
|
225
|
+
* @returns {Promise}
|
|
228
226
|
*/
|
|
229
227
|
logout: function logout() {
|
|
230
228
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -232,14 +230,14 @@ var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFli
|
|
|
232
230
|
this.webex.getWindow().location = this.webex.credentials.buildLogoutUrl(options);
|
|
233
231
|
}
|
|
234
232
|
},
|
|
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>}
|
|
233
|
+
/**
|
|
234
|
+
* Creates a jwt user token
|
|
235
|
+
* @param {object} options
|
|
236
|
+
* @param {String} options.issuer Guest Issuer ID
|
|
237
|
+
* @param {String} options.secretId Guest Secret ID
|
|
238
|
+
* @param {String} options.displayName Guest Display Name | optional
|
|
239
|
+
* @param {String} options.expiresIn
|
|
240
|
+
* @returns {Promise<object>}
|
|
243
241
|
*/
|
|
244
242
|
createJwt: function createJwt(_ref3) {
|
|
245
243
|
return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
@@ -276,13 +274,13 @@ var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFli
|
|
|
276
274
|
}, _callee, null, [[4, 11]]);
|
|
277
275
|
}))();
|
|
278
276
|
},
|
|
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}
|
|
277
|
+
/**
|
|
278
|
+
* Checks if the result of the login redirect contains an error string
|
|
279
|
+
* @instance
|
|
280
|
+
* @memberof AuthorizationBrowser
|
|
281
|
+
* @param {Object} location
|
|
282
|
+
* @private
|
|
283
|
+
* @returns {Promise}
|
|
286
284
|
*/
|
|
287
285
|
_checkForErrors: function _checkForErrors(location) {
|
|
288
286
|
var query = location.query;
|
|
@@ -291,22 +289,22 @@ var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFli
|
|
|
291
289
|
throw new ErrorConstructor(query);
|
|
292
290
|
}
|
|
293
291
|
},
|
|
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}
|
|
292
|
+
/**
|
|
293
|
+
* Removes no-longer needed values from the url (access token, csrf token, etc)
|
|
294
|
+
* @instance
|
|
295
|
+
* @memberof AuthorizationBrowser
|
|
296
|
+
* @param {Object} location
|
|
297
|
+
* @private
|
|
298
|
+
* @returns {Promise}
|
|
301
299
|
*/
|
|
302
300
|
_cleanUrl: function _cleanUrl(location) {
|
|
303
|
-
location = (0,
|
|
301
|
+
location = (0, _lodash.cloneDeep)(location);
|
|
304
302
|
if (this.webex.getWindow().history && this.webex.getWindow().history.replaceState) {
|
|
305
303
|
['access_token', 'token_type', 'expires_in', 'refresh_token', 'refresh_token_expires_in'].forEach(function (key) {
|
|
306
304
|
return (0, _deleteProperty.default)(location.hash, key);
|
|
307
305
|
});
|
|
308
|
-
if (!(0,
|
|
309
|
-
location.hash.state = _common.base64.encode((0, _stringify.default)((0,
|
|
306
|
+
if (!(0, _lodash.isEmpty)(location.hash.state)) {
|
|
307
|
+
location.hash.state = _common.base64.encode((0, _stringify.default)((0, _lodash.omit)(location.hash.state, 'csrf_token')));
|
|
310
308
|
if (location.hash.state === EMPTY_OBJECT_STRING) {
|
|
311
309
|
(0, _deleteProperty.default)(location.hash, 'state');
|
|
312
310
|
}
|
|
@@ -317,12 +315,12 @@ var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFli
|
|
|
317
315
|
this.webex.getWindow().history.replaceState({}, null, _url.default.format(location));
|
|
318
316
|
}
|
|
319
317
|
},
|
|
320
|
-
/**
|
|
321
|
-
* Generates a CSRF token and sticks in in sessionStorage
|
|
322
|
-
* @instance
|
|
323
|
-
* @memberof AuthorizationBrowser
|
|
324
|
-
* @private
|
|
325
|
-
* @returns {Promise}
|
|
318
|
+
/**
|
|
319
|
+
* Generates a CSRF token and sticks in in sessionStorage
|
|
320
|
+
* @instance
|
|
321
|
+
* @memberof AuthorizationBrowser
|
|
322
|
+
* @private
|
|
323
|
+
* @returns {Promise}
|
|
326
324
|
*/
|
|
327
325
|
_generateSecurityToken: function _generateSecurityToken() {
|
|
328
326
|
this.logger.info('authorization: generating csrf token');
|
|
@@ -330,16 +328,16 @@ var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFli
|
|
|
330
328
|
this.webex.getWindow().sessionStorage.setItem('oauth2-csrf-token', token);
|
|
331
329
|
return token;
|
|
332
330
|
},
|
|
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}
|
|
331
|
+
/**
|
|
332
|
+
* Parses the url hash into an access token object
|
|
333
|
+
* @instance
|
|
334
|
+
* @memberof AuthorizationBrowser
|
|
335
|
+
* @param {Object} location
|
|
336
|
+
* @private
|
|
337
|
+
* @returns {Object}
|
|
340
338
|
*/
|
|
341
339
|
_parseHash: function _parseHash(location) {
|
|
342
|
-
var hash = (0,
|
|
340
|
+
var hash = (0, _lodash.cloneDeep)(location.hash);
|
|
343
341
|
if (hash) {
|
|
344
342
|
this._verifySecurityToken(hash);
|
|
345
343
|
}
|
|
@@ -355,14 +353,14 @@ var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFli
|
|
|
355
353
|
}
|
|
356
354
|
return hash;
|
|
357
355
|
},
|
|
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}
|
|
356
|
+
/**
|
|
357
|
+
* Checks if the CSRF token in sessionStorage is the same as the one returned
|
|
358
|
+
* in the url.
|
|
359
|
+
* @instance
|
|
360
|
+
* @memberof AuthorizationBrowser
|
|
361
|
+
* @param {Object} hash
|
|
362
|
+
* @private
|
|
363
|
+
* @returns {Promise}
|
|
366
364
|
*/
|
|
367
365
|
_verifySecurityToken: function _verifySecurityToken(hash) {
|
|
368
366
|
var sessionToken = this.webex.getWindow().sessionStorage.getItem(OAUTH2_CSRF_TOKEN);
|
|
@@ -381,7 +379,7 @@ var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFli
|
|
|
381
379
|
throw new Error("CSRF token ".concat(token, " does not match stored token ").concat(sessionToken));
|
|
382
380
|
}
|
|
383
381
|
},
|
|
384
|
-
version: "2.59.
|
|
382
|
+
version: "2.59.4-next.1"
|
|
385
383
|
}, ((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
384
|
var _default = Authorization;
|
|
387
385
|
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,O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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"}
|
|
1
|
+
{"version":3,"names":["_querystring","_interopRequireDefault","require","_url","_common","_webexCore","_lodash","_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","cloneDeep","history","replaceState","forEach","_deleteProperty","isEmpty","omit","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,GA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AM,IAAI4G,KAAK,wBAAApE,MAAA,CAAwBiE,YAAY,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'];
|