From d7168101a7441a2346b289b8777560b608e977b8 Mon Sep 17 00:00:00 2001 From: Aaron Granick Date: Mon, 13 Jan 2020 14:46:28 -0800 Subject: [PATCH] remove jquery/reqwest httpRequesters --- CHANGELOG.md | 2 + README.md | 40 +------------------ THIRD-PARTY-NOTICES | 27 ------------- packages/okta-auth-js/jquery/index.js | 17 -------- packages/okta-auth-js/jquery/jqueryRequest.js | 37 ----------------- .../okta-auth-js/lib/browser/browserIndex.js | 2 +- .../{ => lib}/fetch/fetchRequest.js | 0 .../okta-auth-js/lib/server/serverIndex.js | 2 +- packages/okta-auth-js/none/index.js | 15 ------- packages/okta-auth-js/package.json | 2 - packages/okta-auth-js/reqwest/index.js | 17 -------- .../okta-auth-js/reqwest/reqwestRequest.js | 30 -------------- .../okta-auth-js/test/spec/fetch-request.js | 2 +- packages/okta-auth-js/webpack.config.js | 2 +- yarn.lock | 10 ----- 15 files changed, 7 insertions(+), 198 deletions(-) delete mode 100644 packages/okta-auth-js/jquery/index.js delete mode 100644 packages/okta-auth-js/jquery/jqueryRequest.js rename packages/okta-auth-js/{ => lib}/fetch/fetchRequest.js (100%) delete mode 100644 packages/okta-auth-js/none/index.js delete mode 100644 packages/okta-auth-js/reqwest/index.js delete mode 100644 packages/okta-auth-js/reqwest/reqwestRequest.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 46fcbd3b96..6bce21b431 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ ### Breaking Changes +- [#308](https://github.com/okta/okta-auth-js/pull/308) - Removed `jquery` and `reqwest` httpRequesters + ### Other ## 2.11.2 diff --git a/README.md b/README.md index 33794e8859..0d5143a4c7 100644 --- a/README.md +++ b/README.md @@ -76,16 +76,6 @@ var OktaAuth = require('@okta/okta-auth-js'); var authClient = new OktaAuth(/* configOptions */); ``` -If you're using a bundler like webpack or browserify, we have implementations for jquery and reqwest included. To use them, import the SDK like this: - -```javascript -// reqwest -var OktaAuth = require('@okta/okta-auth-js/reqwest'); - -// jquery -var OktaAuth = require('@okta/okta-auth-js/jquery'); -``` - ## Usage guide For an overview of the client's features and authentication flows, check out [our developer docs](https://developer.okta.com/code/javascript/okta_auth_sdk). There, you will learn how to use the Auth SDK on a simple static page to: @@ -274,7 +264,7 @@ If the user's browser does not support PKCE, an exception will be thrown. You ca ### `httpRequestClient` -The http request implementation. By default, this is implemented using [reqwest](https://github.com/ded/reqwest) for browser and [cross-fetch](https://github.com/lquixada/cross-fetch) for server. To provide your own request library, implement the following interface: +The http request implementation. By default, this is implemented using [cross-fetch](https://github.com/lquixada/cross-fetch). To provide your own request library, implement the following interface: 1. Must accept: * method (http method) @@ -299,34 +289,6 @@ var config = { } ``` -#### `ajaxRequest` - -:warning: This parameter has been *deprecated*, please use [**httpRequestClient**](#httpRequestClient) instead. - -The ajax request implementation. By default, this is implemented using [reqwest](https://github.com/ded/reqwest). To provide your own request library, implement the following interface: - - 1. Must accept: - * method (http method) - * url (target url) - * args (object containing headers and data) - 2. Must return a Promise that resolves with a raw XMLHttpRequest response - -```javascript -var config = { - url: 'https://{yourOktaDomain}', - ajaxRequest: function(method, url, args) { - // args is in the form: - // { - // headers: { - // headerName: headerValue - // }, - // data: postBodyData - // } - return Promise.resolve(/* a raw XMLHttpRequest response */); - } -} -``` - ## API Reference * [signIn](#signinoptions) diff --git a/THIRD-PARTY-NOTICES b/THIRD-PARTY-NOTICES index 1d39348d10..3de88fd65d 100644 --- a/THIRD-PARTY-NOTICES +++ b/THIRD-PARTY-NOTICES @@ -250,33 +250,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -reqwest -Version (if any): 2.0.5 -Brief Description: It's AJAX All over again. Includes support for -xmlHttpRequest, JSONP, CORS, and CommonJS Promises A. -License MIT - -Copyright 2015 Dustin Diaz. All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - Disclaimer and Limitation of Liability Disclaimer. OKTA AND ITS SUPPLIERS HEREBY DISCLAIM ALL (AND HAVE NOT AUTHORIZED diff --git a/packages/okta-auth-js/jquery/index.js b/packages/okta-auth-js/jquery/index.js deleted file mode 100644 index af163ea943..0000000000 --- a/packages/okta-auth-js/jquery/index.js +++ /dev/null @@ -1,17 +0,0 @@ -/*! - * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved. - * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.") - * - * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * - * See the License for the specific language governing permissions and limitations under the License. - * - */ - -var jqueryRequest = require('./jqueryRequest'); -var storageUtil = require('../lib/browser/browserStorage'); - -module.exports = require('../lib/browser/browser')(storageUtil, jqueryRequest); diff --git a/packages/okta-auth-js/jquery/jqueryRequest.js b/packages/okta-auth-js/jquery/jqueryRequest.js deleted file mode 100644 index 59b1d6691d..0000000000 --- a/packages/okta-auth-js/jquery/jqueryRequest.js +++ /dev/null @@ -1,37 +0,0 @@ -/*! - * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved. - * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.") - * - * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * - * See the License for the specific language governing permissions and limitations under the License. - */ - -var $ = require('jquery'); - -function jqueryRequest(method, url, args) { - // TODO: support content-type - var deferred = $.Deferred(); - $.ajax({ - type: method, - url: url, - headers: args.headers, - data: JSON.stringify(args.data), - xhrFields: { - withCredentials: args.withCredentials - } - }) - .then(function(data, textStatus, jqXHR) { - delete jqXHR.then; - deferred.resolve(jqXHR); - }, function(jqXHR) { - delete jqXHR.then; - deferred.reject(jqXHR); - }); - return deferred; -} - -module.exports = jqueryRequest; diff --git a/packages/okta-auth-js/lib/browser/browserIndex.js b/packages/okta-auth-js/lib/browser/browserIndex.js index 91822a4a8a..7ec3a64765 100644 --- a/packages/okta-auth-js/lib/browser/browserIndex.js +++ b/packages/okta-auth-js/lib/browser/browserIndex.js @@ -11,7 +11,7 @@ * */ -var fetchRequest = require('../../fetch/fetchRequest'); +var fetchRequest = require('../fetch/fetchRequest'); var storageUtil = require('./browserStorage'); module.exports = require('./browser')(storageUtil, fetchRequest); diff --git a/packages/okta-auth-js/fetch/fetchRequest.js b/packages/okta-auth-js/lib/fetch/fetchRequest.js similarity index 100% rename from packages/okta-auth-js/fetch/fetchRequest.js rename to packages/okta-auth-js/lib/fetch/fetchRequest.js diff --git a/packages/okta-auth-js/lib/server/serverIndex.js b/packages/okta-auth-js/lib/server/serverIndex.js index e1019bec8a..45b633f818 100644 --- a/packages/okta-auth-js/lib/server/serverIndex.js +++ b/packages/okta-auth-js/lib/server/serverIndex.js @@ -11,7 +11,7 @@ * */ -var fetchRequest = require('../../fetch/fetchRequest'); +var fetchRequest = require('../fetch/fetchRequest'); var storageUtil = require('./serverStorage'); module.exports = require('./server')(storageUtil, fetchRequest); diff --git a/packages/okta-auth-js/none/index.js b/packages/okta-auth-js/none/index.js deleted file mode 100644 index 8a2133fbbe..0000000000 --- a/packages/okta-auth-js/none/index.js +++ /dev/null @@ -1,15 +0,0 @@ -/*! - * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved. - * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.") - * - * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * - * See the License for the specific language governing permissions and limitations under the License. - * - */ -var storageUtil = require('../lib/browser/browserStorage'); - -module.exports = require('../lib/browser/browser')(storageUtil); diff --git a/packages/okta-auth-js/package.json b/packages/okta-auth-js/package.json index b275883060..c1e9fe60c9 100644 --- a/packages/okta-auth-js/package.json +++ b/packages/okta-auth-js/package.json @@ -37,7 +37,6 @@ "js-cookie": "2.2.0", "node-cache": "^4.2.0", "q": "1.4.1", - "reqwest": "2.0.5", "tiny-emitter": "1.1.0", "xhr2": "0.1.3" }, @@ -49,7 +48,6 @@ "jasmine-ajax": "^4.0.0", "jest": "^24.9.0", "jest-junit": "^9.0.0", - "jquery": "3.3.1", "json-loader": "0.5.4", "karma": "^4.1.0", "karma-chrome-launcher": "^2.2.0", diff --git a/packages/okta-auth-js/reqwest/index.js b/packages/okta-auth-js/reqwest/index.js deleted file mode 100644 index 1e61a745ac..0000000000 --- a/packages/okta-auth-js/reqwest/index.js +++ /dev/null @@ -1,17 +0,0 @@ -/*! - * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved. - * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.") - * - * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * - * See the License for the specific language governing permissions and limitations under the License. - * - */ - -var reqwestRequest = require('./reqwestRequest'); -var storageUtil = require('../lib/browser/browserStorage'); - -module.exports = require('../lib/browser/browser')(storageUtil, reqwestRequest); diff --git a/packages/okta-auth-js/reqwest/reqwestRequest.js b/packages/okta-auth-js/reqwest/reqwestRequest.js deleted file mode 100644 index 8d90a63160..0000000000 --- a/packages/okta-auth-js/reqwest/reqwestRequest.js +++ /dev/null @@ -1,30 +0,0 @@ -/*! - * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved. - * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.") - * - * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * - * See the License for the specific language governing permissions and limitations under the License. - */ - -var reqwest = require('reqwest'); - -function reqwestRequest(method, url, args) { - // TODO: support content-type and withCredentials - var r = reqwest({ - url: url, - method: method, - headers: args.headers, - data: JSON.stringify(args.data), - withCredentials: args.withCredentials - }) - .then(function() { - return r.request; - }); - return r; -} - -module.exports = reqwestRequest; diff --git a/packages/okta-auth-js/test/spec/fetch-request.js b/packages/okta-auth-js/test/spec/fetch-request.js index c5130122f9..9eb951b87e 100644 --- a/packages/okta-auth-js/test/spec/fetch-request.js +++ b/packages/okta-auth-js/test/spec/fetch-request.js @@ -10,7 +10,7 @@ describe('fetchRequest', function () { return mockFetchObj.fetch.apply(null, arguments); }); - var fetchRequest = require('../../fetch/fetchRequest'); + var fetchRequest = require('../../lib/fetch/fetchRequest'); beforeEach(function() { /* global Map */ diff --git a/packages/okta-auth-js/webpack.config.js b/packages/okta-auth-js/webpack.config.js index 76bfb9d4c3..01b168c72d 100644 --- a/packages/okta-auth-js/webpack.config.js +++ b/packages/okta-auth-js/webpack.config.js @@ -1,7 +1,7 @@ /* * This config builds a minified version that can be imported * anywhere without any dependencies. It packages the SDK - * with reqwest and Q. It also preserves license comments. + * with cross-fetch and Q. It also preserves license comments. */ /* global __dirname */ var path = require('path'); diff --git a/yarn.lock b/yarn.lock index 1dafa50ed0..2cd46c6170 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6419,11 +6419,6 @@ jest@24.9.0, jest@^24.9.0: import-local "^2.0.0" jest-cli "^24.9.0" -jquery@3.3.1: - version "3.3.1" - resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.3.1.tgz#958ce29e81c9790f31be7792df5d4d95fc57fbca" - integrity sha512-Ubldcmxp5np52/ENotGxlLe6aGMvmF4R8S6tZjsP6Knsaxd/xp3Zrh50cG93lR6nPXyUFwzN3ZSOQI0wRJNdGg== - js-cookie@2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/js-cookie/-/js-cookie-2.2.0.tgz#1b2c279a6eece380a12168b92485265b35b1effb" @@ -8972,11 +8967,6 @@ requires-port@^1.0.0: resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" integrity sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8= -reqwest@2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/reqwest/-/reqwest-2.0.5.tgz#00fb15ac4918c419ca82b43f24c78882e66039a1" - integrity sha1-APsVrEkYxBnKgrQ/JMeIguZgOaE= - resolve-cwd@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-2.0.0.tgz#00a9f7387556e27038eae232caa372a6a59b665a"