Skip to content

Commit

Permalink
version 3.0.0 (#326)
Browse files Browse the repository at this point in the history
  • Loading branch information
aarongranick-okta committed Mar 2, 2020
1 parent 8ba6dec commit 0509e1f
Show file tree
Hide file tree
Showing 80 changed files with 3,293 additions and 2,134 deletions.
10 changes: 9 additions & 1 deletion .eslintrc.json
@@ -1,9 +1,17 @@
{
"extends": ["eslint:recommended"],
"env": {
"browser": true,
"browser": false,
"commonjs": true
},
"globals": {
"Promise": true,
"console": true,
"setTimeout": true,
"clearTimeout": true,
"setInterval": true,
"clearInterval": true
},
"rules": {
"camelcase": 2,
"complexity": [2, 7],
Expand Down
38 changes: 38 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,43 @@
# Changelog

## 3.0.0

### Breaking Changes

- [#308](https://github.com/okta/okta-auth-js/pull/308) - Removed `jquery` and `reqwest` httpRequesters

- [#309](https://github.com/okta/okta-auth-js/pull/309) - Removed `Q` library, now using standard Promise. IE11 will require a polyfill for the `Promise` object. Use of `Promise.prototype.finally` requires Node > 10.3 for server-side use.

- [#310](https://github.com/okta/okta-auth-js/pull/310) - New behavior for [signOut()](README.md#signout)
- `postLogoutRedirectUri` will default to `window.location.origin`
- [signOut()](README.md#signout) will revoke access token and perform redirect by default. Fallback to XHR [closeSession()](README.md#closesession) if no idToken.
- New method [closeSession()](README.md#closesession) for XHR signout without redirect or reload.
- New method [revokeAccessToken()](README.md#revokeaccesstokenaccesstoken)

- [#311](https://github.com/okta/okta-auth-js/pull/311) - [parseFromUrl()](README.md#tokenparsefromurloptions) now returns tokens in an object hash (instead of array). The `state` parameter (passed to authorize request) is also returned.

- [#313](https://github.com/okta/okta-auth-js/pull/313) - New [option](README.md#additional-options) `secureCookies`, which is `true` by default. An HTTPS origin will be enforced unless `secureCookies` is set to `false`.

- [#316](https://github.com/okta/okta-auth-js/pull/316) - Option `issuer` is [required](README.md#configuration-reference). Option `url` has been deprecated and is no longer used.

- [#317](https://github.com/okta/okta-auth-js/pull/317) - `pkce` [option](README.md#additional-options) is now `true` by default. `grantType` option is removed.

- [#320](https://github.com/okta/okta-auth-js/pull/320) - `getWithRedirect`, `getWithPopup`, and `getWithoutPrompt` previously took 2 sets of option objects as parameters, a set of "oauthOptions" and additional options. These methods now take a single options object which can hold all [available options](README.md#authorize-options). Passing a second options object will cause an exception to be thrown.

- [#321](https://github.com/okta/okta-auth-js/pull/321)
- Default responseType when using [implicit flow](README.md#implicit-oauth-20-flow) is now `['token', 'id_token']`.
- When both access token and id token are returned, the id token's `at_hash` claim will be validated against the access token

- [#325](https://github.com/okta/okta-auth-js/pull/325) - Previously, the default `responseMode` for [PKCE](README.md#pkce-oauth-20-flow) was `"fragment"`. It is now `"query"`. Unless explicitly specified using the `responseMode` option, the `response_mode` parameter is no longer passed by `token.getWithRedirect` to the `/authorize` endpoint. The `response_mode` will be set by the backend according to the [OpenID specification](https://openid.net/specs/openid-connect-core-1_0.html#Authentication). [Implicit flow](README.md#implicit-oauth-20-flow) will use `"fragment"` and [PKCE](README.md#pkce-oauth-20-flow) will use `"query"`. If previous behavior is desired, [PKCE](README.md#pkce-oauth-20-flow) can set the `responseMode` option to `"fragment"`.

- [#329](https://github.com/okta/okta-auth-js/pull/329) - Fix internal fetch implementation. `responseText` will always be a string, regardless of headers or response type. If a JSON object was returned, the object will be returned as `responseJSON` and `responseType` will be set to "json". Invalid/malformed JSON server response will no longer throw a raw TypeError but will return a well structured error response which includes the `status` code returned from the server.

### Other

- [#306](https://github.com/okta/okta-auth-js/pull/306) - Now using babel for ES5 compatibility. [All polyfills have been removed](README.md#browser-compatibility).

- [#312](https://github.com/okta/okta-auth-js/pull/312) - Added an E2E test for server-side authentication (node module, not webpack).

## 2.13.1

### Bug Fixes
Expand Down
378 changes: 222 additions & 156 deletions README.md

Large diffs are not rendered by default.

40 changes: 0 additions & 40 deletions THIRD-PARTY-NOTICES
Expand Up @@ -219,46 +219,6 @@ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE

0. You just DO WHAT THE FUCK YOU WANT TO.

q.js
Version (if any):
Brief Description: If a function cannot return a value or throw an
exception without blocking, it can return a promise instead. A promise is an
object that represents the return value or the thrown exception that the
function may eventually provide. A promise can also be used as a proxy for a
remote object to overcome latency. On the first pass, promises can mitigate the
“Pyramid of Doom”: the situation where code marches to the right faster than it
marches forward.
License MIT

Copyright 2009–2014 Kristopher Michael Kowal. 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.


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
Expand Down
2 changes: 2 additions & 0 deletions package.json
Expand Up @@ -5,6 +5,7 @@
"@babel/preset-env": "^7.6.3",
"@babel/register": "^7.6.2",
"dotenv": "^8.1.0",
"eslint-plugin-compat": "^3.3.0",
"eslint-plugin-jasmine": "^2.10.1",
"globby": "^6.1.0",
"lerna": "^2.11.0"
Expand All @@ -23,6 +24,7 @@
"test:e2e": "yarn --cwd test/e2e start",
"test:browser": "yarn workspace @okta/okta-auth-js test:browser",
"test:server": "yarn workspace @okta/okta-auth-js test:server",
"test:karma": "yarn workspace @okta/okta-auth-js test:karma",
"test:unit": "yarn workspace @okta/okta-auth-js test",
"test:report": "yarn test:unit --ci --silent || true",
"prepare": "yarn build",
Expand Down
14 changes: 14 additions & 0 deletions packages/okta-auth-js/.eslintrc.json
@@ -0,0 +1,14 @@
{
"extends": ["plugin:compat/recommended"],
"settings": {
"polyfills": [
"Promise",
"Array.from",
"TextEncoder"
]
},
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 2017
}
}
5 changes: 3 additions & 2 deletions packages/okta-auth-js/jest.server.js
@@ -1,5 +1,4 @@
var packageJson = require('./package.json');
var OktaAuth = '<rootDir>/' + packageJson.main;
var OktaAuth = '<rootDir>/lib/server/serverIndex.js';

module.exports = {
'coverageDirectory': '<rootDir>/build2/reports/coverage',
Expand All @@ -12,6 +11,8 @@ module.exports = {
],
'testPathIgnorePatterns': [
'./test/spec/browser.js',
'./test/spec/browserStorage.js',
'./test/spec/cookies.js',
'./test/spec/fingerprint.js',
'./test/spec/general.js',
'./test/spec/oauthUtil.js',
Expand Down
17 changes: 0 additions & 17 deletions packages/okta-auth-js/jquery/index.js

This file was deleted.

37 changes: 0 additions & 37 deletions packages/okta-auth-js/jquery/jqueryRequest.js

This file was deleted.

22 changes: 8 additions & 14 deletions packages/okta-auth-js/lib/TokenManager.js
Expand Up @@ -10,12 +10,11 @@
* See the License for the specific language governing permissions and limitations under the License.
*
*/

/* global localStorage, sessionStorage */
/* eslint complexity:[0,8] max-statements:[0,21] */
var util = require('./util');
var AuthSdkError = require('./errors/AuthSdkError');
var storageUtil = require('./browser/browserStorage');
var Q = require('q');
var constants = require('./constants');
var storageBuilder = require('./storageBuilder');
var SdkClock = require('./clock');
Expand Down Expand Up @@ -115,7 +114,7 @@ function get(storage, key) {
}

function getAsync(sdk, tokenMgmtRef, storage, key) {
return Q.Promise(function(resolve) {
return new Promise(function(resolve) {
var token = get(storage, key);
if (!token || !hasExpired(tokenMgmtRef, token)) {
return resolve(token);
Expand Down Expand Up @@ -152,23 +151,15 @@ function renew(sdk, tokenMgmtRef, storage, key) {
throw new AuthSdkError('The tokenManager has no token for the key: ' + key);
}
} catch (e) {
return Q.reject(e);
return Promise.reject(e);
}

// Remove existing autoRenew timeout for this key
clearExpireEventTimeout(tokenMgmtRef, key);

// Store the renew promise state, to avoid renewing again
tokenMgmtRef.renewPromise[key] = sdk.token.renew(token)
.then(function(freshTokens) {
var freshToken = freshTokens;
// With PKCE flow we will receive multiple tokens. Find the one we are looking for
if (freshTokens instanceof Array) {
freshToken = freshTokens.find(function(freshToken) {
return (freshToken.idToken && token.idToken) || (freshToken.accessToken && token.accessToken);
});
}

.then(function(freshToken) {
var oldToken = get(storage, key);
if (!oldToken) {
// It is possible to enter a state where the tokens have been cleared
Expand Down Expand Up @@ -228,7 +219,10 @@ function TokenManager(sdk, options) {
storageProvider = sessionStorage;
break;
case 'cookie':
storageProvider = storageUtil.getCookieStorage(options);
storageProvider = storageUtil.getCookieStorage({
secure: sdk.options.secureCookies,
sameSite: 'none'
});
break;
case 'memory':
storageProvider = storageUtil.getInMemoryStorage();
Expand Down

0 comments on commit 0509e1f

Please sign in to comment.