@webex/webex-core 3.13.0-next.4 → 3.13.0-next.5
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/interceptors/auth.js +10 -1
- package/dist/interceptors/auth.js.map +1 -1
- package/dist/lib/batcher.js +1 -1
- package/dist/lib/credentials/credentials.js +1 -1
- package/dist/lib/credentials/token.js +1 -1
- package/dist/lib/interceptors/service.js +5 -1
- package/dist/lib/interceptors/service.js.map +1 -1
- package/dist/lib/services/catalog-auth.js +114 -0
- package/dist/lib/services/catalog-auth.js.map +1 -0
- package/dist/lib/services/services.js +46 -3
- package/dist/lib/services/services.js.map +1 -1
- package/dist/lib/services-v2/services-v2.js +40 -3
- package/dist/lib/services-v2/services-v2.js.map +1 -1
- package/dist/plugins/logger.js +1 -1
- package/dist/webex-core.js +2 -2
- package/package.json +3 -3
- package/src/interceptors/auth.js +14 -1
- package/src/lib/interceptors/service.js +11 -3
- package/src/lib/services/catalog-auth.js +112 -0
- package/src/lib/services/docs/README.md +4 -4
- package/src/lib/services/services.js +54 -2
- package/src/lib/services-v2/docs/README.md +4 -4
- package/src/lib/services-v2/services-v2.ts +48 -2
- package/test/unit/spec/interceptors/auth.js +35 -0
- package/test/unit/spec/services/interceptors/service.js +35 -1
- package/test/unit/spec/services/services.js +309 -0
- package/test/unit/spec/services-v2/services-v2.ts +227 -0
|
@@ -139,7 +139,16 @@ var AuthInterceptor = exports.default = /*#__PURE__*/function (_Interceptor) {
|
|
|
139
139
|
(0, _deleteProperty.default)(reason.options.headers, 'authorization');
|
|
140
140
|
}
|
|
141
141
|
if (_this3.webex.credentials.canRefresh) {
|
|
142
|
-
return _this3.webex.credentials.refresh().
|
|
142
|
+
return _this3.webex.credentials.refresh().catch(function (error) {
|
|
143
|
+
var refreshStatus = error && (error.statusCode || error.status);
|
|
144
|
+
|
|
145
|
+
// A refresh 403 is not a catalog 403. Keep the original 401 for
|
|
146
|
+
// catalog auth reporting and leave statusCode unchanged.
|
|
147
|
+
if (reason.statusCode === 401 && refreshStatus === 403 && error) {
|
|
148
|
+
error.catalogAuthStatus = 401;
|
|
149
|
+
}
|
|
150
|
+
return _promise.default.reject(error);
|
|
151
|
+
}).then(function () {
|
|
143
152
|
return _this3.replay(options);
|
|
144
153
|
});
|
|
145
154
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_httpCore","require","_callSuper","t","o","e","_getPrototypeOf2","default","_possibleConstructorReturn2","_isNativeReflectConstruct","_Reflect$construct","constructor","apply","Boolean","prototype","valueOf","call","AuthInterceptor","exports","_Interceptor","_classCallCheck2","arguments","_inherits2","_createClass2","key","value","onRequest","options","_this","headers","authorization","_deleteProperty","_promise","resolve","requiresCredentials","then","requires","webex","credentials","getUserToken","token","toString","_this2","addAuthHeader","internal","services","details","getServiceFromUrl","uri","_ref","name","resource","service","api","includes","validateDomains","hasAllowedDomains","isAllowedDomainUrl","waitForService","url","detectedUrl","catch","error","logger","warn","onResponseError","reason","_this3","shouldAttemptReauth","info","canRefresh","refresh","replay","reject","replayCount","config","maxAuthenticationReplays","concat","Error","request","shouldRefreshAccessToken","statusCode","create","Interceptor"],"sources":["auth.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {Interceptor} from '@webex/http-core';\n\n/**\n * @class\n */\nexport default class AuthInterceptor extends Interceptor {\n /**\n * @returns {AuthInterceptor}\n */\n static create() {\n return new AuthInterceptor({webex: this});\n }\n\n /**\n * @see {@link Interceptor#onRequest}\n * @param {Object} options\n * @returns {Object}\n */\n onRequest(options) {\n options.headers = options.headers || {};\n\n // If Authorizations is already set, don't overwrite it\n if ('authorization' in options.headers || 'auth' in options) {\n // If Authorization is set to null, false, or undefined, delete it to\n // prevent a CORS preflight.\n if (!options.headers.authorization) {\n Reflect.deleteProperty(options.headers, 'authorization');\n }\n\n return Promise.resolve(options);\n }\n\n return this.requiresCredentials(options).then((requires) => {\n if (!requires) {\n return options;\n }\n\n return this.webex.credentials.getUserToken().then((token) => {\n options.headers.authorization = token.toString();\n\n return options;\n });\n });\n }\n\n /**\n * Determines if the provided options object needs an authorization header.\n *\n * @param {Object} options\n * @returns {Promise<boolean>}\n */\n requiresCredentials(options) {\n // Validate that authorization is necessary.\n if (options.addAuthHeader === false) {\n return Promise.resolve(false);\n }\n\n // Validate that the services plugin has been loaded before proceeding.\n if (!this.webex.internal.services) {\n return Promise.resolve(false);\n }\n\n // Destructure webex instance to isolate services plugin.\n const {services} = this.webex.internal;\n\n // Store the current service details if available and destructure details.\n const details = services.getServiceFromUrl(options.uri || '');\n const {name} = details || {};\n const {resource, uri} = options;\n const service = options.service || options.api;\n\n // Unique validation for the u2c service.\n if ((service && service === 'u2c') || (name && name === 'u2c')) {\n if ((resource && resource.includes('limited')) || (uri && uri.includes('limited'))) {\n return Promise.resolve(false);\n }\n\n return Promise.resolve(true);\n }\n\n // Validate that the allowed domains can be utilized.\n if (\n services.validateDomains &&\n services.hasAllowedDomains() &&\n uri &&\n services.isAllowedDomainUrl(uri)\n ) {\n return Promise.resolve(true);\n }\n\n // Perform an additional validation in case the service does not exist yet.\n return services\n .waitForService({name: service, url: uri})\n .then((detectedUrl) => {\n // Validate that the url exists in the catalog.\n if (services.getServiceFromUrl(detectedUrl)) {\n return true;\n }\n\n // Return false to indicate authentication is not required.\n return false;\n })\n .catch((error) => {\n this.webex.logger.warn(\n 'auth-interceptor: failed to validate service exists in catalog',\n error\n );\n\n return false;\n });\n }\n\n /**\n * @see {@link Interceptor#onResponseError}\n * @param {Object} options\n * @param {Error} reason\n * @returns {Object}\n */\n onResponseError(options, reason) {\n return this.shouldAttemptReauth(reason, options).then((shouldAttemptReauth) => {\n if (shouldAttemptReauth) {\n this.webex.logger.info('auth: received 401, attempting to reauthenticate');\n\n if (reason.options.headers) {\n Reflect.deleteProperty(reason.options.headers, 'authorization');\n }\n\n if (this.webex.credentials.canRefresh) {\n return this.webex.credentials.refresh().then(() => this.replay(options));\n }\n }\n\n return Promise.reject(reason);\n });\n }\n\n /**\n * Replays the request\n * @param {Object} options\n * @returns {Object}\n */\n replay(options) {\n if (options.replayCount) {\n options.replayCount += 1;\n } else {\n options.replayCount = 1;\n }\n\n if (options.replayCount > this.webex.config.maxAuthenticationReplays) {\n this.webex.logger.error(\n `auth: failed after ${this.webex.config.maxAuthenticationReplays} replay attempts`\n );\n\n return Promise.reject(\n new Error(`Failed after ${this.webex.config.maxAuthenticationReplays} replay attempts`)\n );\n }\n\n this.webex.logger.info(`auth: replaying request ${options.replayCount} time`);\n\n return this.webex.request(options);\n }\n\n /**\n * Indicates whether or not the current request should refresh its access\n * token in event of a 401\n * @param {Error} reason\n * @param {Object} options\n * @returns {Promise<boolean>}\n */\n shouldAttemptReauth(reason, options) {\n if (options && options.shouldRefreshAccessToken === false) {\n return Promise.resolve(false);\n }\n\n if (reason.statusCode === 401) {\n return Promise.resolve(true);\n }\n\n return Promise.resolve(false);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAIA,IAAAA,SAAA,GAAAC,OAAA;AAA6C,SAAAC,WAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,WAAAD,CAAA,OAAAE,gBAAA,CAAAC,OAAA,EAAAH,CAAA,OAAAI,2BAAA,CAAAD,OAAA,EAAAJ,CAAA,EAAAM,yBAAA,KAAAC,kBAAA,CAAAN,CAAA,EAAAC,CAAA,YAAAC,gBAAA,CAAAC,OAAA,EAAAJ,CAAA,EAAAQ,WAAA,IAAAP,CAAA,CAAAQ,KAAA,CAAAT,CAAA,EAAAE,CAAA;AAAA,SAAAI,0BAAA,cAAAN,CAAA,IAAAU,OAAA,CAAAC,SAAA,CAAAC,OAAA,CAAAC,IAAA,CAAAN,kBAAA,CAAAG,OAAA,iCAAAV,CAAA,aAAAM,yBAAA,YAAAA,0BAAA,aAAAN,CAAA,UAJ7C;AACA;AACA;AAIA;AACA;AACA;AAFA,IAGqBc,eAAe,GAAAC,OAAA,CAAAX,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,KAAK,GAAG,EAAE;QAC7B,OAAOjD,QAAA,CAAAzB,OAAA,CAAQ0B,OAAO,CAAC,IAAI,CAAC;MAC9B;MAEA,OAAOD,QAAA,CAAAzB,OAAA,CAAQ0B,OAAO,CAAC,KAAK,CAAC;IAC/B;EAAC;IAAAT,GAAA;IAAAC,KAAA;IA9KD;AACF;AACA;IACE,SAAOyD,MAAMA,CAAA,EAAG;MACd,OAAO,IAAIjE,eAAe,CAAC;QAACoB,KAAK,EAAE;MAAI,CAAC,CAAC;IAC3C;EAAC;AAAA,EAN0C8C,qBAAW","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_httpCore","require","_callSuper","t","o","e","_getPrototypeOf2","default","_possibleConstructorReturn2","_isNativeReflectConstruct","_Reflect$construct","constructor","apply","Boolean","prototype","valueOf","call","AuthInterceptor","exports","_Interceptor","_classCallCheck2","arguments","_inherits2","_createClass2","key","value","onRequest","options","_this","headers","authorization","_deleteProperty","_promise","resolve","requiresCredentials","then","requires","webex","credentials","getUserToken","token","toString","_this2","addAuthHeader","internal","services","details","getServiceFromUrl","uri","_ref","name","resource","service","api","includes","validateDomains","hasAllowedDomains","isAllowedDomainUrl","waitForService","url","detectedUrl","catch","error","logger","warn","onResponseError","reason","_this3","shouldAttemptReauth","info","canRefresh","refresh","refreshStatus","statusCode","status","catalogAuthStatus","reject","replay","replayCount","config","maxAuthenticationReplays","concat","Error","request","shouldRefreshAccessToken","create","Interceptor"],"sources":["auth.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {Interceptor} from '@webex/http-core';\n\n/**\n * @class\n */\nexport default class AuthInterceptor extends Interceptor {\n /**\n * @returns {AuthInterceptor}\n */\n static create() {\n return new AuthInterceptor({webex: this});\n }\n\n /**\n * @see {@link Interceptor#onRequest}\n * @param {Object} options\n * @returns {Object}\n */\n onRequest(options) {\n options.headers = options.headers || {};\n\n // If Authorizations is already set, don't overwrite it\n if ('authorization' in options.headers || 'auth' in options) {\n // If Authorization is set to null, false, or undefined, delete it to\n // prevent a CORS preflight.\n if (!options.headers.authorization) {\n Reflect.deleteProperty(options.headers, 'authorization');\n }\n\n return Promise.resolve(options);\n }\n\n return this.requiresCredentials(options).then((requires) => {\n if (!requires) {\n return options;\n }\n\n return this.webex.credentials.getUserToken().then((token) => {\n options.headers.authorization = token.toString();\n\n return options;\n });\n });\n }\n\n /**\n * Determines if the provided options object needs an authorization header.\n *\n * @param {Object} options\n * @returns {Promise<boolean>}\n */\n requiresCredentials(options) {\n // Validate that authorization is necessary.\n if (options.addAuthHeader === false) {\n return Promise.resolve(false);\n }\n\n // Validate that the services plugin has been loaded before proceeding.\n if (!this.webex.internal.services) {\n return Promise.resolve(false);\n }\n\n // Destructure webex instance to isolate services plugin.\n const {services} = this.webex.internal;\n\n // Store the current service details if available and destructure details.\n const details = services.getServiceFromUrl(options.uri || '');\n const {name} = details || {};\n const {resource, uri} = options;\n const service = options.service || options.api;\n\n // Unique validation for the u2c service.\n if ((service && service === 'u2c') || (name && name === 'u2c')) {\n if ((resource && resource.includes('limited')) || (uri && uri.includes('limited'))) {\n return Promise.resolve(false);\n }\n\n return Promise.resolve(true);\n }\n\n // Validate that the allowed domains can be utilized.\n if (\n services.validateDomains &&\n services.hasAllowedDomains() &&\n uri &&\n services.isAllowedDomainUrl(uri)\n ) {\n return Promise.resolve(true);\n }\n\n // Perform an additional validation in case the service does not exist yet.\n return services\n .waitForService({name: service, url: uri})\n .then((detectedUrl) => {\n // Validate that the url exists in the catalog.\n if (services.getServiceFromUrl(detectedUrl)) {\n return true;\n }\n\n // Return false to indicate authentication is not required.\n return false;\n })\n .catch((error) => {\n this.webex.logger.warn(\n 'auth-interceptor: failed to validate service exists in catalog',\n error\n );\n\n return false;\n });\n }\n\n /**\n * @see {@link Interceptor#onResponseError}\n * @param {Object} options\n * @param {Error} reason\n * @returns {Object}\n */\n onResponseError(options, reason) {\n return this.shouldAttemptReauth(reason, options).then((shouldAttemptReauth) => {\n if (shouldAttemptReauth) {\n this.webex.logger.info('auth: received 401, attempting to reauthenticate');\n\n if (reason.options.headers) {\n Reflect.deleteProperty(reason.options.headers, 'authorization');\n }\n\n if (this.webex.credentials.canRefresh) {\n return this.webex.credentials\n .refresh()\n .catch((error) => {\n const refreshStatus = error && (error.statusCode || error.status);\n\n // A refresh 403 is not a catalog 403. Keep the original 401 for\n // catalog auth reporting and leave statusCode unchanged.\n if (reason.statusCode === 401 && refreshStatus === 403 && error) {\n error.catalogAuthStatus = 401;\n }\n\n return Promise.reject(error);\n })\n .then(() => this.replay(options));\n }\n }\n\n return Promise.reject(reason);\n });\n }\n\n /**\n * Replays the request\n * @param {Object} options\n * @returns {Object}\n */\n replay(options) {\n if (options.replayCount) {\n options.replayCount += 1;\n } else {\n options.replayCount = 1;\n }\n\n if (options.replayCount > this.webex.config.maxAuthenticationReplays) {\n this.webex.logger.error(\n `auth: failed after ${this.webex.config.maxAuthenticationReplays} replay attempts`\n );\n\n return Promise.reject(\n new Error(`Failed after ${this.webex.config.maxAuthenticationReplays} replay attempts`)\n );\n }\n\n this.webex.logger.info(`auth: replaying request ${options.replayCount} time`);\n\n return this.webex.request(options);\n }\n\n /**\n * Indicates whether or not the current request should refresh its access\n * token in event of a 401\n * @param {Error} reason\n * @param {Object} options\n * @returns {Promise<boolean>}\n */\n shouldAttemptReauth(reason, options) {\n if (options && options.shouldRefreshAccessToken === false) {\n return Promise.resolve(false);\n }\n\n if (reason.statusCode === 401) {\n return Promise.resolve(true);\n }\n\n return Promise.resolve(false);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAIA,IAAAA,SAAA,GAAAC,OAAA;AAA6C,SAAAC,WAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,WAAAD,CAAA,OAAAE,gBAAA,CAAAC,OAAA,EAAAH,CAAA,OAAAI,2BAAA,CAAAD,OAAA,EAAAJ,CAAA,EAAAM,yBAAA,KAAAC,kBAAA,CAAAN,CAAA,EAAAC,CAA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mB,MAAA,CACC,IAAI,CAAC5C,KAAK,CAAC0C,MAAM,CAACC,wBAAwB,qBAClE,CAAC;QAED,OAAOhD,QAAA,CAAAzB,OAAA,CAAQqE,MAAM,CACnB,IAAIM,KAAK,iBAAAD,MAAA,CAAiB,IAAI,CAAC5C,KAAK,CAAC0C,MAAM,CAACC,wBAAwB,qBAAkB,CACxF,CAAC;MACH;MAEA,IAAI,CAAC3C,KAAK,CAAC0B,MAAM,CAACM,IAAI,4BAAAY,MAAA,CAA4BtD,OAAO,CAACmD,WAAW,UAAO,CAAC;MAE7E,OAAO,IAAI,CAACzC,KAAK,CAAC8C,OAAO,CAACxD,OAAO,CAAC;IACpC;;IAEA;AACF;AACA;AACA;AACA;AACA;AACA;EANE;IAAAH,GAAA;IAAAC,KAAA,EAOA,SAAA2C,mBAAmBA,CAACF,MAAM,EAAEvC,OAAO,EAAE;MACnC,IAAIA,OAAO,IAAIA,OAAO,CAACyD,wBAAwB,KAAK,KAAK,EAAE;QACzD,OAAOpD,QAAA,CAAAzB,OAAA,CAAQ0B,OAAO,CAAC,KAAK,CAAC;MAC/B;MAEA,IAAIiC,MAAM,CAACO,UAAU,KAAK,GAAG,EAAE;QAC7B,OAAOzC,QAAA,CAAAzB,OAAA,CAAQ0B,OAAO,CAAC,IAAI,CAAC;MAC9B;MAEA,OAAOD,QAAA,CAAAzB,OAAA,CAAQ0B,OAAO,CAAC,KAAK,CAAC;IAC/B;EAAC;IAAAT,GAAA;IAAAC,KAAA;IA3LD;AACF;AACA;IACE,SAAO4D,MAAMA,CAAA,EAAG;MACd,OAAO,IAAIpE,eAAe,CAAC;QAACoB,KAAK,EAAE;MAAI,CAAC,CAAC;IAC3C;EAAC;AAAA,EAN0CiD,qBAAW","ignoreList":[]}
|
package/dist/lib/batcher.js
CHANGED
|
@@ -302,7 +302,7 @@ var Batcher = _webexPlugin.default.extend({
|
|
|
302
302
|
fingerprintResponse: function fingerprintResponse(item) {
|
|
303
303
|
throw new Error('fingerprintResponse() must be implemented');
|
|
304
304
|
},
|
|
305
|
-
version: "3.13.0-next.
|
|
305
|
+
version: "3.13.0-next.5"
|
|
306
306
|
});
|
|
307
307
|
var _default2 = exports.default = Batcher;
|
|
308
308
|
//# sourceMappingURL=batcher.js.map
|
|
@@ -655,7 +655,7 @@ var Credentials = _webexPlugin.default.extend((_dec = (0, _common.oneFlight)({
|
|
|
655
655
|
this.refresh();
|
|
656
656
|
}
|
|
657
657
|
},
|
|
658
|
-
version: "3.13.0-next.
|
|
658
|
+
version: "3.13.0-next.5"
|
|
659
659
|
}, (0, _applyDecoratedDescriptor2.default)(_obj, "getUserToken", [_dec, _dec2], (0, _getOwnPropertyDescriptor.default)(_obj, "getUserToken"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, "initialize", [_dec3], (0, _getOwnPropertyDescriptor.default)(_obj, "initialize"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, "invalidate", [_common.oneFlight, _dec4], (0, _getOwnPropertyDescriptor.default)(_obj, "invalidate"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, "refresh", [_common.oneFlight, _dec5, _dec6], (0, _getOwnPropertyDescriptor.default)(_obj, "refresh"), _obj), _obj));
|
|
660
660
|
var _default = exports.default = Credentials;
|
|
661
661
|
//# sourceMappingURL=credentials.js.map
|
|
@@ -532,7 +532,7 @@ var Token = _webexPlugin.default.extend((_dec = (0, _common.oneFlight)({
|
|
|
532
532
|
return res.body;
|
|
533
533
|
});
|
|
534
534
|
},
|
|
535
|
-
version: "3.13.0-next.
|
|
535
|
+
version: "3.13.0-next.5"
|
|
536
536
|
}, (0, _applyDecoratedDescriptor2.default)(_obj, "downscope", [_dec], (0, _getOwnPropertyDescriptor.default)(_obj, "downscope"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, "refresh", [_common.oneFlight], (0, _getOwnPropertyDescriptor.default)(_obj, "refresh"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, "revoke", [_common.oneFlight], (0, _getOwnPropertyDescriptor.default)(_obj, "revoke"), _obj), _obj));
|
|
537
537
|
var _default = exports.default = Token;
|
|
538
538
|
//# sourceMappingURL=token.js.map
|
|
@@ -14,6 +14,7 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
|
|
|
14
14
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/getPrototypeOf"));
|
|
15
15
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inherits"));
|
|
16
16
|
var _httpCore = require("@webex/http-core");
|
|
17
|
+
var _catalogAuth = require("../services/catalog-auth");
|
|
17
18
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? _Reflect$construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
18
19
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /*!
|
|
19
20
|
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
@@ -62,7 +63,10 @@ var ServiceInterceptor = exports.default = /*#__PURE__*/function (_Interceptor)
|
|
|
62
63
|
// Generate the combined service url and resource.
|
|
63
64
|
options.uri = _this.generateUri(serviceUrl, resource);
|
|
64
65
|
return options;
|
|
65
|
-
}).catch(function () {
|
|
66
|
+
}).catch(function (error) {
|
|
67
|
+
if (error && (0, _catalogAuth.isCatalogAuthReason)(error.reason)) {
|
|
68
|
+
return _promise.default.reject(error);
|
|
69
|
+
}
|
|
66
70
|
return _promise.default.reject(new Error("service-interceptor: '".concat(service, "' is not a known service")));
|
|
67
71
|
});
|
|
68
72
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_httpCore","require","_callSuper","t","o","e","_getPrototypeOf2","default","_possibleConstructorReturn2","_isNativeReflectConstruct","_Reflect$construct","constructor","apply","Boolean","prototype","valueOf","call","trailingSlashes","ServiceInterceptor","exports","_Interceptor","_classCallCheck2","arguments","_inherits2","_createClass2","key","value","onRequest","options","_this","uri","normalizeOptions","validateOptions","services","webex","internal","service","resource","waitForServiceTimeout","waitForService","name","timeout","then","serviceUrl","generateUri","catch","_promise","reject","Error","concat","length","undefined","formattedService","replace","formattedResource","api","create","Interceptor"],"sources":["service.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {Interceptor} from '@webex/http-core';\n\nconst trailingSlashes = /(?:^\\/)|(?:\\/$)/;\n\n/**\n * @class\n */\nexport default class ServiceInterceptor extends Interceptor {\n /**\n * @returns {ServiceInterceptor}\n */\n static create() {\n /* eslint no-invalid-this: [0] */\n return new ServiceInterceptor({webex: this});\n }\n\n /* eslint-disable no-param-reassign */\n /**\n * @see Interceptor#onRequest\n * @param {Object} options - The request PTO.\n * @returns {Object} - The mutated request PTO.\n */\n onRequest(options) {\n // Validate that the PTO includes a uri property.\n if (options.uri) {\n return options;\n }\n\n // Normalize and validate the PTO.\n this.normalizeOptions(options);\n this.validateOptions(options);\n\n // Destructure commonly referenced namespaces.\n const {services} = this.webex.internal;\n const {service, resource, waitForServiceTimeout} = options;\n\n // Attempt to collect the service url.\n return services\n .waitForService({name: service, timeout: waitForServiceTimeout})\n .then((serviceUrl) => {\n // Generate the combined service url and resource.\n options.uri = this.generateUri(serviceUrl, resource);\n\n return options;\n })\n .catch(()
|
|
1
|
+
{"version":3,"names":["_httpCore","require","_catalogAuth","_callSuper","t","o","e","_getPrototypeOf2","default","_possibleConstructorReturn2","_isNativeReflectConstruct","_Reflect$construct","constructor","apply","Boolean","prototype","valueOf","call","trailingSlashes","ServiceInterceptor","exports","_Interceptor","_classCallCheck2","arguments","_inherits2","_createClass2","key","value","onRequest","options","_this","uri","normalizeOptions","validateOptions","services","webex","internal","service","resource","waitForServiceTimeout","waitForService","name","timeout","then","serviceUrl","generateUri","catch","error","isCatalogAuthReason","reason","_promise","reject","Error","concat","length","undefined","formattedService","replace","formattedResource","api","create","Interceptor"],"sources":["service.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {Interceptor} from '@webex/http-core';\n\nimport {isCatalogAuthReason} from '../services/catalog-auth';\n\nconst trailingSlashes = /(?:^\\/)|(?:\\/$)/;\n\n/**\n * @class\n */\nexport default class ServiceInterceptor extends Interceptor {\n /**\n * @returns {ServiceInterceptor}\n */\n static create() {\n /* eslint no-invalid-this: [0] */\n return new ServiceInterceptor({webex: this});\n }\n\n /* eslint-disable no-param-reassign */\n /**\n * @see Interceptor#onRequest\n * @param {Object} options - The request PTO.\n * @returns {Object} - The mutated request PTO.\n */\n onRequest(options) {\n // Validate that the PTO includes a uri property.\n if (options.uri) {\n return options;\n }\n\n // Normalize and validate the PTO.\n this.normalizeOptions(options);\n this.validateOptions(options);\n\n // Destructure commonly referenced namespaces.\n const {services} = this.webex.internal;\n const {service, resource, waitForServiceTimeout} = options;\n\n // Attempt to collect the service url.\n return services\n .waitForService({name: service, timeout: waitForServiceTimeout})\n .then((serviceUrl) => {\n // Generate the combined service url and resource.\n options.uri = this.generateUri(serviceUrl, resource);\n\n return options;\n })\n .catch((error) => {\n if (error && isCatalogAuthReason(error.reason)) {\n return Promise.reject(error);\n }\n\n return Promise.reject(\n new Error(`service-interceptor: '${service}' is not a known service`)\n );\n });\n }\n\n /* eslint-disable class-methods-use-this */\n /**\n * Generate a usable request uri string from a service url and a resouce.\n *\n * @param {string} serviceUrl - The service url.\n * @param {string} [resource] - The resouce to be appended to the service url.\n * @returns {string} - The combined service url and resource.\n */\n generateUri(serviceUrl, resource = '') {\n const formattedService = serviceUrl.replace(trailingSlashes, '');\n const formattedResource = resource.replace(trailingSlashes, '');\n\n return `${formattedService}/${formattedResource}`;\n }\n\n /**\n * Normalizes request options relative to service identification.\n *\n * @param {Object} options - The request PTO.\n * @returns {Object} - The mutated request PTO.\n */\n normalizeOptions(options) {\n // Validate if the api property is used.\n if (options.api) {\n // Assign the service property the value of the api property if necessary.\n options.service = options.service || options.api;\n delete options.api;\n }\n }\n\n /**\n * Validates that the appropriate options for this interceptor are present.\n *\n * @param {Object} options - The request PTO.\n * @returns {Object} - The mutated request PTO.\n */\n validateOptions(options) {\n if (!options.resource) {\n throw new Error('a `resource` parameter is required');\n }\n\n if (!options.service) {\n throw new Error(\"a valid 'service' parameter is required\");\n }\n }\n /* eslint-enable class-methods-use-this, no-param-reassign */\n}\n"],"mappings":";;;;;;;;;;;;;;;AAIA,IAAAA,SAAA,GAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAD,OAAA;AAA6D,SAAAE,WAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,WAAAD,CAAA,OAAAE,gBAAA,CAAAC,OAAA,EAAAH,CAAA,OAAAI,2BAAA,CAAAD,OAAA,EAAAJ,CAAA,EAAAM,yBAAA,KAAAC,kBAAA,CAAAN,CAAA,EAAAC,CAAA,YAAAC,gBAAA,CAAAC,OAAA,EAAAJ,CAAA,EAAAQ,WAAA,IAAAP,CAAA,CAAAQ,KAAA,CAAAT,CAAA,EAAAE,CAAA;AAAA,SAAAI,0BAAA,cAAAN,CAAA,IAAAU,OAAA,CAAAC,SAAA,CAAAC,OAAA,CAAAC,IAAA,CAAAN,kBAAA,CAAAG,OAAA,iCAAAV,CAAA,aAAAM,yBAAA,YAAAA,0BAAA,aAAAN,CAAA,UAN7D;AACA;AACA;AAMA,IAAMc,eAAe,GAAG,iBAAiB;;AAEzC;AACA;AACA;AAFA,IAGqBC,kBAAkB,GAAAC,OAAA,CAAAZ,OAAA,0BAAAa,YAAA;EAAA,SAAAF,mBAAA;IAAA,IAAAG,gBAAA,CAAAd,OAAA,QAAAW,kBAAA;IAAA,OAAAhB,UAAA,OAAAgB,kBAAA,EAAAI,SAAA;EAAA;EAAA,IAAAC,UAAA,CAAAhB,OAAA,EAAAW,kBA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
+
|
|
3
|
+
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
5
|
+
_Object$defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.INVALID_ACCESS_TOKEN = exports.ACCESS_DENIED = void 0;
|
|
9
|
+
exports.classifyCatalogAuthFailure = classifyCatalogAuthFailure;
|
|
10
|
+
exports.clearCatalogAuthFailure = clearCatalogAuthFailure;
|
|
11
|
+
exports.getCatalogAuthFailure = getCatalogAuthFailure;
|
|
12
|
+
exports.isCatalogAuthReason = isCatalogAuthReason;
|
|
13
|
+
exports.isWrappedCatalogAuthFailure = isWrappedCatalogAuthFailure;
|
|
14
|
+
exports.recordCatalogAuthFailure = recordCatalogAuthFailure;
|
|
15
|
+
exports.serviceLookupError = serviceLookupError;
|
|
16
|
+
var _weakMap = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/weak-map"));
|
|
17
|
+
var _grantErrors = require("../credentials/grant-errors");
|
|
18
|
+
var INVALID_ACCESS_TOKEN = exports.INVALID_ACCESS_TOKEN = 'invalid_access_token';
|
|
19
|
+
var ACCESS_DENIED = exports.ACCESS_DENIED = 'access_denied';
|
|
20
|
+
var catalogAuthFailures = new _weakMap.default();
|
|
21
|
+
var catalogAuthReplayLimit = /^Failed after \d+ replay attempts$/;
|
|
22
|
+
var reasonByStatus = {
|
|
23
|
+
401: INVALID_ACCESS_TOKEN,
|
|
24
|
+
403: ACCESS_DENIED
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* A catalog 401 can arrive as an OAuth refresh failure or the auth replay limit.
|
|
29
|
+
* @param {Error} error
|
|
30
|
+
* @returns {boolean}
|
|
31
|
+
*/
|
|
32
|
+
function isWrappedCatalogAuthFailure(error) {
|
|
33
|
+
return error instanceof _grantErrors.OAuthError || typeof (error === null || error === void 0 ? void 0 : error.message) === 'string' && catalogAuthReplayLimit.test(error.message);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @param {string} reason
|
|
38
|
+
* @returns {boolean}
|
|
39
|
+
*/
|
|
40
|
+
function isCatalogAuthReason(reason) {
|
|
41
|
+
return reason === INVALID_ACCESS_TOKEN || reason === ACCESS_DENIED;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Classify a postauth catalog failure.
|
|
46
|
+
* A result is stored. Null means any previously stored failure should be cleared.
|
|
47
|
+
* Network errors and HTTP 5xx stay null.
|
|
48
|
+
* @param {Error} error
|
|
49
|
+
* @returns {{status: number, reason: string}|null}
|
|
50
|
+
*/
|
|
51
|
+
function classifyCatalogAuthFailure(error) {
|
|
52
|
+
var status = error && (error.catalogAuthStatus || error.statusCode || error.status);
|
|
53
|
+
var reason = reasonByStatus[status];
|
|
54
|
+
if (reason) {
|
|
55
|
+
return {
|
|
56
|
+
status: status,
|
|
57
|
+
reason: reason
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
if (isWrappedCatalogAuthFailure(error)) {
|
|
61
|
+
return {
|
|
62
|
+
status: 401,
|
|
63
|
+
reason: INVALID_ACCESS_TOKEN
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* @param {object} services
|
|
71
|
+
* @param {Error} error
|
|
72
|
+
* @returns {void}
|
|
73
|
+
*/
|
|
74
|
+
function recordCatalogAuthFailure(services, error) {
|
|
75
|
+
var authFailure = classifyCatalogAuthFailure(error);
|
|
76
|
+
if (authFailure) {
|
|
77
|
+
catalogAuthFailures.set(services, authFailure);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
catalogAuthFailures.delete(services);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* @param {object} services
|
|
85
|
+
* @returns {void}
|
|
86
|
+
*/
|
|
87
|
+
function clearCatalogAuthFailure(services) {
|
|
88
|
+
catalogAuthFailures.delete(services);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* @param {object} services
|
|
93
|
+
* @returns {{status: number, reason: string}|null}
|
|
94
|
+
*/
|
|
95
|
+
function getCatalogAuthFailure(services) {
|
|
96
|
+
return catalogAuthFailures.get(services) || null;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* @param {object} services
|
|
101
|
+
* @param {string} fallbackMessage
|
|
102
|
+
* @returns {Error}
|
|
103
|
+
*/
|
|
104
|
+
function serviceLookupError(services, fallbackMessage) {
|
|
105
|
+
var authFailure = getCatalogAuthFailure(services);
|
|
106
|
+
if (authFailure && isCatalogAuthReason(authFailure.reason)) {
|
|
107
|
+
var authError = new Error(authFailure.reason);
|
|
108
|
+
authError.reason = authFailure.reason;
|
|
109
|
+
authError.statusCode = authFailure.status;
|
|
110
|
+
return authError;
|
|
111
|
+
}
|
|
112
|
+
return new Error(fallbackMessage);
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=catalog-auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_grantErrors","require","INVALID_ACCESS_TOKEN","exports","ACCESS_DENIED","catalogAuthFailures","_weakMap","default","catalogAuthReplayLimit","reasonByStatus","isWrappedCatalogAuthFailure","error","OAuthError","message","test","isCatalogAuthReason","reason","classifyCatalogAuthFailure","status","catalogAuthStatus","statusCode","recordCatalogAuthFailure","services","authFailure","set","delete","clearCatalogAuthFailure","getCatalogAuthFailure","get","serviceLookupError","fallbackMessage","authError","Error"],"sources":["catalog-auth.js"],"sourcesContent":["import {OAuthError} from '../credentials/grant-errors';\n\nexport const INVALID_ACCESS_TOKEN = 'invalid_access_token';\nexport const ACCESS_DENIED = 'access_denied';\n\nconst catalogAuthFailures = new WeakMap();\nconst catalogAuthReplayLimit = /^Failed after \\d+ replay attempts$/;\nconst reasonByStatus = {\n 401: INVALID_ACCESS_TOKEN,\n 403: ACCESS_DENIED,\n};\n\n/**\n * A catalog 401 can arrive as an OAuth refresh failure or the auth replay limit.\n * @param {Error} error\n * @returns {boolean}\n */\nexport function isWrappedCatalogAuthFailure(error) {\n return (\n error instanceof OAuthError ||\n (typeof error?.message === 'string' && catalogAuthReplayLimit.test(error.message))\n );\n}\n\n/**\n * @param {string} reason\n * @returns {boolean}\n */\nexport function isCatalogAuthReason(reason) {\n return reason === INVALID_ACCESS_TOKEN || reason === ACCESS_DENIED;\n}\n\n/**\n * Classify a postauth catalog failure.\n * A result is stored. Null means any previously stored failure should be cleared.\n * Network errors and HTTP 5xx stay null.\n * @param {Error} error\n * @returns {{status: number, reason: string}|null}\n */\nexport function classifyCatalogAuthFailure(error) {\n const status = error && (error.catalogAuthStatus || error.statusCode || error.status);\n const reason = reasonByStatus[status];\n\n if (reason) {\n return {\n status,\n reason,\n };\n }\n\n if (isWrappedCatalogAuthFailure(error)) {\n return {\n status: 401,\n reason: INVALID_ACCESS_TOKEN,\n };\n }\n\n return null;\n}\n\n/**\n * @param {object} services\n * @param {Error} error\n * @returns {void}\n */\nexport function recordCatalogAuthFailure(services, error) {\n const authFailure = classifyCatalogAuthFailure(error);\n\n if (authFailure) {\n catalogAuthFailures.set(services, authFailure);\n\n return;\n }\n\n catalogAuthFailures.delete(services);\n}\n\n/**\n * @param {object} services\n * @returns {void}\n */\nexport function clearCatalogAuthFailure(services) {\n catalogAuthFailures.delete(services);\n}\n\n/**\n * @param {object} services\n * @returns {{status: number, reason: string}|null}\n */\nexport function getCatalogAuthFailure(services) {\n return catalogAuthFailures.get(services) || null;\n}\n\n/**\n * @param {object} services\n * @param {string} fallbackMessage\n * @returns {Error}\n */\nexport function serviceLookupError(services, fallbackMessage) {\n const authFailure = getCatalogAuthFailure(services);\n\n if (authFailure && isCatalogAuthReason(authFailure.reason)) {\n const authError = new Error(authFailure.reason);\n\n authError.reason = authFailure.reason;\n authError.statusCode = authFailure.status;\n\n return authError;\n }\n\n return new Error(fallbackMessage);\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEO,IAAMC,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA,GAAG,sBAAsB;AACnD,IAAME,aAAa,GAAAD,OAAA,CAAAC,aAAA,GAAG,eAAe;AAE5C,IAAMC,mBAAmB,GAAG,IAAAC,QAAA,CAAAC,OAAA,CAAY,CAAC;AACzC,IAAMC,sBAAsB,GAAG,oCAAoC;AACnE,IAAMC,cAAc,GAAG;EACrB,GAAG,EAAEP,oBAAoB;EACzB,GAAG,EAAEE;AACP,CAAC;;AAED;AACA;AACA;AACA;AACA;AACO,SAASM,2BAA2BA,CAACC,KAAK,EAAE;EACjD,OACEA,KAAK,YAAYC,uBAAU,IAC1B,QAAOD,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEE,OAAO,MAAK,QAAQ,IAAIL,sBAAsB,CAACM,IAAI,CAACH,KAAK,CAACE,OAAO,CAAE;AAEtF;;AAEA;AACA;AACA;AACA;AACO,SAASE,mBAAmBA,CAACC,MAAM,EAAE;EAC1C,OAAOA,MAAM,KAAKd,oBAAoB,IAAIc,MAAM,KAAKZ,aAAa;AACpE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASa,0BAA0BA,CAACN,KAAK,EAAE;EAChD,IAAMO,MAAM,GAAGP,KAAK,KAAKA,KAAK,CAACQ,iBAAiB,IAAIR,KAAK,CAACS,UAAU,IAAIT,KAAK,CAACO,MAAM,CAAC;EACrF,IAAMF,MAAM,GAAGP,cAAc,CAACS,MAAM,CAAC;EAErC,IAAIF,MAAM,EAAE;IACV,OAAO;MACLE,MAAM,EAANA,MAAM;MACNF,MAAM,EAANA;IACF,CAAC;EACH;EAEA,IAAIN,2BAA2B,CAACC,KAAK,CAAC,EAAE;IACtC,OAAO;MACLO,MAAM,EAAE,GAAG;MACXF,MAAM,EAAEd;IACV,CAAC;EACH;EAEA,OAAO,IAAI;AACb;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASmB,wBAAwBA,CAACC,QAAQ,EAAEX,KAAK,EAAE;EACxD,IAAMY,WAAW,GAAGN,0BAA0B,CAACN,KAAK,CAAC;EAErD,IAAIY,WAAW,EAAE;IACflB,mBAAmB,CAACmB,GAAG,CAACF,QAAQ,EAAEC,WAAW,CAAC;IAE9C;EACF;EAEAlB,mBAAmB,CAACoB,MAAM,CAACH,QAAQ,CAAC;AACtC;;AAEA;AACA;AACA;AACA;AACO,SAASI,uBAAuBA,CAACJ,QAAQ,EAAE;EAChDjB,mBAAmB,CAACoB,MAAM,CAACH,QAAQ,CAAC;AACtC;;AAEA;AACA;AACA;AACA;AACO,SAASK,qBAAqBA,CAACL,QAAQ,EAAE;EAC9C,OAAOjB,mBAAmB,CAACuB,GAAG,CAACN,QAAQ,CAAC,IAAI,IAAI;AAClD;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASO,kBAAkBA,CAACP,QAAQ,EAAEQ,eAAe,EAAE;EAC5D,IAAMP,WAAW,GAAGI,qBAAqB,CAACL,QAAQ,CAAC;EAEnD,IAAIC,WAAW,IAAIR,mBAAmB,CAACQ,WAAW,CAACP,MAAM,CAAC,EAAE;IAC1D,IAAMe,SAAS,GAAG,IAAIC,KAAK,CAACT,WAAW,CAACP,MAAM,CAAC;IAE/Ce,SAAS,CAACf,MAAM,GAAGO,WAAW,CAACP,MAAM;IACrCe,SAAS,CAACX,UAAU,GAAGG,WAAW,CAACL,MAAM;IAEzC,OAAOa,SAAS;EAClB;EAEA,OAAO,IAAIC,KAAK,CAACF,eAAe,CAAC;AACnC","ignoreList":[]}
|
|
@@ -25,6 +25,7 @@ var _sha = _interopRequireDefault(require("crypto-js/sha256"));
|
|
|
25
25
|
var _lodash = require("lodash");
|
|
26
26
|
var _webexPlugin = _interopRequireDefault(require("../webex-plugin"));
|
|
27
27
|
var _metrics = _interopRequireDefault(require("../metrics"));
|
|
28
|
+
var _catalogAuth = require("./catalog-auth");
|
|
28
29
|
var _serviceCatalog = _interopRequireDefault(require("./service-catalog"));
|
|
29
30
|
var _serviceRegistry = _interopRequireDefault(require("./service-registry"));
|
|
30
31
|
var _serviceState = _interopRequireDefault(require("./service-state"));
|
|
@@ -122,6 +123,39 @@ var Services = _webexPlugin.default.extend({
|
|
|
122
123
|
_getCatalog: function _getCatalog() {
|
|
123
124
|
return this._catalogs.get(this.webex);
|
|
124
125
|
},
|
|
126
|
+
/**
|
|
127
|
+
* Remember a postauth catalog failure caused by HTTP 401 or 403.
|
|
128
|
+
* 401 means the access token was rejected. 403 means the token can be
|
|
129
|
+
* valid and the caller still has no access. A refresh or replay failure
|
|
130
|
+
* that replaced a catalog 401 is recorded as invalid_access_token.
|
|
131
|
+
* A refresh 403 keeps that original 401 on error.catalogAuthStatus.
|
|
132
|
+
* Other failures clear any previously stored auth failure.
|
|
133
|
+
*
|
|
134
|
+
* @private
|
|
135
|
+
* @param {Error} error
|
|
136
|
+
* @returns {void}
|
|
137
|
+
*/
|
|
138
|
+
_recordCatalogAuthFailure: function _recordCatalogAuthFailure(error) {
|
|
139
|
+
(0, _catalogAuth.recordCatalogAuthFailure)(this, error);
|
|
140
|
+
},
|
|
141
|
+
/**
|
|
142
|
+
* @private
|
|
143
|
+
* @returns {{status: number, reason: string}|null}
|
|
144
|
+
*/
|
|
145
|
+
_getCatalogAuthFailure: function _getCatalogAuthFailure() {
|
|
146
|
+
return (0, _catalogAuth.getCatalogAuthFailure)(this);
|
|
147
|
+
},
|
|
148
|
+
/**
|
|
149
|
+
* Build the rejection for a service that could not be resolved.
|
|
150
|
+
* A stored catalog auth failure replaces the generic not-found text.
|
|
151
|
+
*
|
|
152
|
+
* @private
|
|
153
|
+
* @param {string} fallbackMessage
|
|
154
|
+
* @returns {Error}
|
|
155
|
+
*/
|
|
156
|
+
_serviceLookupError: function _serviceLookupError(fallbackMessage) {
|
|
157
|
+
return (0, _catalogAuth.serviceLookupError)(this, fallbackMessage);
|
|
158
|
+
},
|
|
125
159
|
/**
|
|
126
160
|
* Safely access localStorage if available; returns the Storage or null.
|
|
127
161
|
* @returns {Storage|null}
|
|
@@ -392,8 +426,17 @@ var Services = _webexPlugin.default.extend({
|
|
|
392
426
|
catalog.updateServiceUrls(serviceGroup, formattedServiceHostMap);
|
|
393
427
|
_this.updateCredentialsConfig();
|
|
394
428
|
catalog.status[serviceGroup].collecting = false;
|
|
429
|
+
|
|
430
|
+
// A successful postauth catalog replaces any remembered 401/403.
|
|
431
|
+
// Preauth and signin updates leave that marker alone.
|
|
432
|
+
if (serviceGroup === 'postauth') {
|
|
433
|
+
(0, _catalogAuth.clearCatalogAuthFailure)(_this);
|
|
434
|
+
}
|
|
395
435
|
}).catch(function (error) {
|
|
396
436
|
catalog.status[serviceGroup].collecting = false;
|
|
437
|
+
if (serviceGroup === 'postauth') {
|
|
438
|
+
_this._recordCatalogAuthFailure(error);
|
|
439
|
+
}
|
|
397
440
|
return _promise.default.reject(error);
|
|
398
441
|
}));
|
|
399
442
|
case 7:
|
|
@@ -812,7 +855,7 @@ var Services = _webexPlugin.default.extend({
|
|
|
812
855
|
service_name: name
|
|
813
856
|
}
|
|
814
857
|
});
|
|
815
|
-
return _promise.default.reject(
|
|
858
|
+
return _promise.default.reject(this._serviceLookupError("services: service '".concat(name, "' was not found in any of the catalogs")));
|
|
816
859
|
}
|
|
817
860
|
return new _promise.default(function (resolve, reject) {
|
|
818
861
|
var groupsToCheck = ['preauth', 'signin', 'postauth'];
|
|
@@ -835,7 +878,7 @@ var Services = _webexPlugin.default.extend({
|
|
|
835
878
|
service_name: name
|
|
836
879
|
}
|
|
837
880
|
});
|
|
838
|
-
reject(
|
|
881
|
+
reject(_this6._serviceLookupError("services: service '".concat(name, "' was not found after waiting")));
|
|
839
882
|
});
|
|
840
883
|
});
|
|
841
884
|
},
|
|
@@ -1647,7 +1690,7 @@ var Services = _webexPlugin.default.extend({
|
|
|
1647
1690
|
}, _callee6);
|
|
1648
1691
|
})));
|
|
1649
1692
|
},
|
|
1650
|
-
version: "3.13.0-next.
|
|
1693
|
+
version: "3.13.0-next.5"
|
|
1651
1694
|
});
|
|
1652
1695
|
/* eslint-enable no-underscore-dangle */
|
|
1653
1696
|
var _default = exports.default = Services;
|