@webex/plugin-authorization-node 2.42.0 → 2.43.0
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/dist/authorization.js +1 -1
- package/dist/authorization.js.map +1 -1
- package/dist/config.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +10 -10
package/dist/authorization.js
CHANGED
|
@@ -144,7 +144,7 @@ var Authorization = _webexCore.WebexPlugin.extend((_dec = (0, _common.whileInFli
|
|
|
144
144
|
return _this2.webex.internal.services.initServiceCatalogs();
|
|
145
145
|
});
|
|
146
146
|
},
|
|
147
|
-
version: "2.
|
|
147
|
+
version: "2.43.0"
|
|
148
148
|
}, ((0, _applyDecoratedDescriptor2.default)(_obj, "requestAuthorizationCodeGrant", [_dec, _common.oneFlight], (0, _getOwnPropertyDescriptor.default)(_obj, "requestAuthorizationCodeGrant"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, "requestAccessTokenFromJwt", [_common.oneFlight], (0, _getOwnPropertyDescriptor.default)(_obj, "requestAccessTokenFromJwt"), _obj)), _obj)));
|
|
149
149
|
var _default = Authorization;
|
|
150
150
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Authorization","WebexPlugin","extend","whileInFlight","derived","isAuthenticating","deps","fn","isAuthorizing","session","default","type","namespace","logout","options","webex","request","method","uri","config","logoutUrl","body","token","cisService","service","requestAuthorizationCodeGrant","logger","info","code","reject","Error","tokenUrl","form","grant_type","redirect_uri","self_contained_token","auth","user","client_id","pass","client_secret","sendImmediately","shouldRefreshAccessToken","then","res","credentials","set","supertoken","catch","statusCode","ErrorConstructor","grantErrors","select","error","_res","requestAccessTokenFromJwt","jwt","hydraUri","internal","services","get","slice","process","env","HYDRA_SERVICE_URL","headers","authorization","access_token","token_type","expires_in","expiresIn","initServiceCatalogs","oneFlight"],"sources":["authorization.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n/* eslint camelcase: [0] */\n\nimport {oneFlight, whileInFlight} from '@webex/common';\nimport {grantErrors, WebexPlugin} from '@webex/webex-core';\n\n/**\n * NodeJS support for OAuth2\n * @class\n * @name AuthorizationNode\n */\nconst Authorization = WebexPlugin.extend({\n derived: {\n /**\n * Alias of {@link AuthorizationNode#isAuthorizing}\n * @instance\n * @memberof AuthorizationNode\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 AuthorizationNode\n * @type {boolean}\n */\n isAuthorizing: {\n default: false,\n type: 'boolean',\n },\n },\n\n namespace: 'Credentials',\n\n logout(options = {}) {\n this.webex.request({\n method: 'POST',\n uri: this.config.logoutUrl,\n body: {\n token: options.token,\n cisService: this.config.service,\n },\n });\n },\n\n @whileInFlight('isAuthorizing')\n @oneFlight\n /**\n * Exchanges an authorization code for an access token\n * @instance\n * @memberof AuthorizationNode\n * @param {Object} options\n * @param {Object} options.code\n * @returns {Promise}\n */\n requestAuthorizationCodeGrant(options = {}) {\n this.logger.info('credentials: requesting authorization code grant');\n\n if (!options.code) {\n return Promise.reject(new Error('`options.code` is required'));\n }\n\n return this.webex\n .request({\n method: 'POST',\n uri: this.config.tokenUrl,\n form: {\n grant_type: 'authorization_code',\n redirect_uri: this.config.redirect_uri,\n code: options.code,\n self_contained_token: true,\n },\n auth: {\n user: this.config.client_id,\n pass: this.config.client_secret,\n sendImmediately: true,\n },\n shouldRefreshAccessToken: false,\n })\n .then((res) => {\n this.webex.credentials.set({supertoken: res.body});\n })\n .catch((res) => {\n if (res.statusCode !== 400) {\n return Promise.reject(res);\n }\n\n const ErrorConstructor = grantErrors.select(res.body.error);\n\n return Promise.reject(new ErrorConstructor(res._res || res));\n });\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 AuthorizationNode\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\nexport default Authorization;\n"],"mappings":";;;;;;;;;;;AAMA;AACA;AAA2D;AAE3D;AACA;AACA;AACA;AACA;AACA,
|
|
1
|
+
{"version":3,"names":["_common","require","_webexCore","_dec","_obj","Authorization","WebexPlugin","extend","whileInFlight","derived","isAuthenticating","deps","fn","isAuthorizing","session","default","type","namespace","logout","options","arguments","length","undefined","webex","request","method","uri","config","logoutUrl","body","token","cisService","service","requestAuthorizationCodeGrant","_this","logger","info","code","_promise","reject","Error","tokenUrl","form","grant_type","redirect_uri","self_contained_token","auth","user","client_id","pass","client_secret","sendImmediately","shouldRefreshAccessToken","then","res","credentials","set","supertoken","catch","statusCode","ErrorConstructor","grantErrors","select","error","_res","requestAccessTokenFromJwt","_ref","_this2","jwt","hydraUri","internal","services","get","slice","process","env","HYDRA_SERVICE_URL","concat","headers","authorization","_ref2","access_token","token_type","expires_in","expiresIn","initServiceCatalogs","version","_applyDecoratedDescriptor2","oneFlight","_getOwnPropertyDescriptor","_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 {oneFlight, whileInFlight} from '@webex/common';\nimport {grantErrors, WebexPlugin} from '@webex/webex-core';\n\n/**\n * NodeJS support for OAuth2\n * @class\n * @name AuthorizationNode\n */\nconst Authorization = WebexPlugin.extend({\n derived: {\n /**\n * Alias of {@link AuthorizationNode#isAuthorizing}\n * @instance\n * @memberof AuthorizationNode\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 AuthorizationNode\n * @type {boolean}\n */\n isAuthorizing: {\n default: false,\n type: 'boolean',\n },\n },\n\n namespace: 'Credentials',\n\n logout(options = {}) {\n this.webex.request({\n method: 'POST',\n uri: this.config.logoutUrl,\n body: {\n token: options.token,\n cisService: this.config.service,\n },\n });\n },\n\n @whileInFlight('isAuthorizing')\n @oneFlight\n /**\n * Exchanges an authorization code for an access token\n * @instance\n * @memberof AuthorizationNode\n * @param {Object} options\n * @param {Object} options.code\n * @returns {Promise}\n */\n requestAuthorizationCodeGrant(options = {}) {\n this.logger.info('credentials: requesting authorization code grant');\n\n if (!options.code) {\n return Promise.reject(new Error('`options.code` is required'));\n }\n\n return this.webex\n .request({\n method: 'POST',\n uri: this.config.tokenUrl,\n form: {\n grant_type: 'authorization_code',\n redirect_uri: this.config.redirect_uri,\n code: options.code,\n self_contained_token: true,\n },\n auth: {\n user: this.config.client_id,\n pass: this.config.client_secret,\n sendImmediately: true,\n },\n shouldRefreshAccessToken: false,\n })\n .then((res) => {\n this.webex.credentials.set({supertoken: res.body});\n })\n .catch((res) => {\n if (res.statusCode !== 400) {\n return Promise.reject(res);\n }\n\n const ErrorConstructor = grantErrors.select(res.body.error);\n\n return Promise.reject(new ErrorConstructor(res._res || res));\n });\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 AuthorizationNode\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\nexport default Authorization;\n"],"mappings":";;;;;;;;;;;AAMA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAA2D,IAAAE,IAAA,EAAAC,IAAA;AAE3D;AACA;AACA;AACA;AACA;AACA,IAAMC,aAAa,GAAGC,sBAAW,CAACC,MAAM,EAAAJ,IAAA,GA0CrC,IAAAK,qBAAa,EAAC,eAAe,CAAC,GAAAJ,IAAA,GA1CQ;EACvCK,OAAO,EAAE;IACP;AACJ;AACA;AACA;AACA;AACA;IACIC,gBAAgB,EAAE;MAChBC,IAAI,EAAE,CAAC,eAAe,CAAC;MACvBC,EAAE,WAAAA,GAAA,EAAG;QACH,OAAO,IAAI,CAACC,aAAa;MAC3B;IACF;EACF,CAAC;EAEDC,OAAO,EAAE;IACP;AACJ;AACA;AACA;AACA;AACA;IACID,aAAa,EAAE;MACbE,OAAO,EAAE,KA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AAO,CAAC;MACPC,MAAM,EAAE,MAAM;MACdC,GAAG,KAAAmD,MAAA,CAAKR,QAAQ,cAAW;MAC3BS,OAAO,EAAE;QACPC,aAAa,EAAEX;MACjB;IACF,CAAC,CAAC,CACDf,IAAI,CAAC,UAAA2B,KAAA;MAAA,IAAEnD,IAAI,GAAAmD,KAAA,CAAJnD,IAAI;MAAA,OAAO;QACjBoD,YAAY,EAAEpD,IAAI,CAACC,KAAK;QACxBoD,UAAU,EAAE,QAAQ;QACpBC,UAAU,EAAEtD,IAAI,CAACuD;MACnB,CAAC;IAAA,CAAC,CAAC,CACF/B,IAAI,CAAC,UAACvB,KAAK,EAAK;MACfqC,MAAI,CAAC5C,KAAK,CAACgC,WAAW,CAACC,GAAG,CAAC;QACzBC,UAAU,EAAE3B;MACd,CAAC,CAAC;IACJ,CAAC,CAAC,CACDuB,IAAI,CAAC;MAAA,OAAMc,MAAI,CAAC5C,KAAK,CAAC+C,QAAQ,CAACC,QAAQ,CAACc,mBAAmB,EAAE;IAAA,EAAC;EACnE,CAAC;EAAAC,OAAA;AACH,CAAC,OAAAC,0BAAA,CAAAxE,OAAA,EAAAX,IAAA,oCAAAD,IAAA,EA9FEqF,iBAAS,OAAAC,yBAAA,CAAA1E,OAAA,EAAAX,IAAA,oCAAAA,IAAA,OAAAmF,0BAAA,CAAAxE,OAAA,EAAAX,IAAA,gCA+CToF,iBAAS,OAAAC,yBAAA,CAAA1E,OAAA,EAAAX,IAAA,gCAAAA,IAAA,IAAAA,IAAA,GA+CV;AAAC,IAAAsF,QAAA,GAEYrF,aAAa;AAAAsF,OAAA,CAAA5E,OAAA,GAAA2E,QAAA"}
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["credentials"],"sources":["config.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nexport default {\n credentials: {},\n};\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AAFA,
|
|
1
|
+
{"version":3,"names":["_default","credentials","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"],"mappings":";;;;;;;AAAA;AACA;AACA;AAFA,IAAAA,QAAA,GAIe;EACbC,WAAW,EAAE,CAAC;AAChB,CAAC;AAAAC,OAAA,CAAAC,OAAA,GAAAH,QAAA"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["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":";;;;;;;;;;;;;;;;;;;
|
|
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webex/plugin-authorization-node",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.43.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -21,18 +21,18 @@
|
|
|
21
21
|
]
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@webex/test-helper-appid": "2.
|
|
25
|
-
"@webex/test-helper-chai": "2.
|
|
26
|
-
"@webex/test-helper-mocha": "2.
|
|
27
|
-
"@webex/test-helper-mock-webex": "2.
|
|
28
|
-
"@webex/test-helper-test-users": "2.
|
|
24
|
+
"@webex/test-helper-appid": "2.43.0",
|
|
25
|
+
"@webex/test-helper-chai": "2.43.0",
|
|
26
|
+
"@webex/test-helper-mocha": "2.43.0",
|
|
27
|
+
"@webex/test-helper-mock-webex": "2.43.0",
|
|
28
|
+
"@webex/test-helper-test-users": "2.43.0",
|
|
29
29
|
"sinon": "^9.2.4"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@webex/common": "2.
|
|
33
|
-
"@webex/internal-plugin-device": "2.
|
|
34
|
-
"@webex/plugin-authorization-node": "2.
|
|
35
|
-
"@webex/webex-core": "2.
|
|
32
|
+
"@webex/common": "2.43.0",
|
|
33
|
+
"@webex/internal-plugin-device": "2.43.0",
|
|
34
|
+
"@webex/plugin-authorization-node": "2.43.0",
|
|
35
|
+
"@webex/webex-core": "2.43.0",
|
|
36
36
|
"uuid": "^3.3.2"
|
|
37
37
|
}
|
|
38
38
|
}
|