Skip to content

Commit

Permalink
dev-7 upgrade (#248)
Browse files Browse the repository at this point in the history
OKTA-530591 adds auth-js 7 support
  • Loading branch information
jaredperreault-okta authored Sep 28, 2022
1 parent 8f318ff commit 5c810a6
Show file tree
Hide file tree
Showing 12 changed files with 113 additions and 26 deletions.
16 changes: 15 additions & 1 deletion .bacon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,23 @@ test_suites:
script_name: e2e
criteria: MERGE
queue_name: small
- name: publish
- name: unit-v6
script_path: /root/okta/okta-react/scripts
sort_order: '4'
timeout: '10'
script_name: unit-v6
criteria: MERGE
queue_name: small
- name: e2e-v6
script_path: /root/okta/okta-react/scripts
sort_order: '5'
timeout: '10'
script_name: e2e-v6
criteria: MERGE
queue_name: small
- name: publish
script_path: /root/okta/okta-react/scripts
sort_order: '6'
timeout: '60'
script_name: publish
criteria: MERGE
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 6.7.0

-[#248](https://github.com/okta/okta-react/pull/248) Adds support for `@okta/okta-auth-js` `7.x`
- Bumps minimum node version to `14`

# 6.6.0

- [#239](https://github.com/okta/okta-react/pull/239)
Expand Down
1 change: 0 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ module.exports = {
],
restoreMocks: true,
moduleNameMapper: {
'^@okta/okta-auth-js$': '<rootDir>/node_modules/@okta/okta-auth-js/dist/okta-auth-js.umd.js',
// avoid react conflict in yarn workspace
'^react$': '<rootDir>/node_modules/react',
'^react-dom$': '<rootDir>/node_modules/react-dom',
Expand Down
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,14 @@
"//": "[email protected] has a vuln, see OKTA-473553",
"**/set-value": "^4.1.0",
"ejs": "^3.1.7",
"axios": "^0.27.2",
"broadcast-channel": "4.13.0"
"axios": "^0.27.2"
},
"dependencies": {
"@babel/runtime": "^7.11.2",
"compare-versions": "^4.1.2"
},
"peerDependencies": {
"@okta/okta-auth-js": "^5.3.1 || ^6.0.0",
"@okta/okta-auth-js": "^5.3.1 || ^6.0.0 || ^7.0.0",
"react": ">=16.8.0",
"react-dom": ">=16.8.0",
"react-router-dom": ">=5.1.0"
Expand All @@ -65,7 +64,7 @@
"@babel/preset-env": "^7.11.5",
"@babel/preset-react": "^7.10.4",
"@babel/register": "^7.12.1",
"@okta/okta-auth-js": "~6.7.5",
"@okta/okta-auth-js": "^7.0.0",
"@rollup/plugin-babel": "^5.2.1",
"@rollup/plugin-replace": "^2.3.4",
"@testing-library/jest-dom": "^5.16.2",
Expand Down
2 changes: 1 addition & 1 deletion samples/custom-login/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion samples/doc-embedded-widget/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions scripts/e2e-v6.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash -x

source ${OKTA_HOME}/${REPO}/scripts/setup.sh

setup_service java 1.8.222
setup_service google-chrome-stable 89.0.4389.72-1

export CI=true
export TEST_SUITE_TYPE="junit"
export TEST_RESULT_FILE_DIR="${REPO}/test-reports/e2e"

export ISSUER=https://samples-javascript.okta.com/oauth2/default
export CLIENT_ID=0oapmwm72082GXal14x6
export SPA_CLIENT_ID=0oapmwm72082GXal14x6
export [email protected]
get_secret prod/okta-sdk-vars/password PASSWORD

# modifies the package.json of all workspaces to the latest 6.x version
./scripts/utils/sync-ws-auth-js.sh $(yarn info @okta/okta-auth-js@^6 --json | jq '.data.versions | last' | tr -d \")
yarn --ignore-scripts

if ! yarn test:e2e; then
echo "e2e tests failed! Exiting..."
exit ${TEST_FAILURE}
fi

echo ${TEST_SUITE_TYPE} > ${TEST_SUITE_TYPE_FILE}
echo ${TEST_RESULT_FILE_DIR} > ${TEST_RESULT_FILE_DIR_FILE}
exit ${PUBLISH_TYPE_AND_RESULT_DIR}
4 changes: 4 additions & 0 deletions scripts/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export TEST_SUITE_TYPE="build"
# Install required dependencies
export PATH="${PATH}:$(yarn global bin)"
yarn global add @okta/ci-append-sha
yarn global add @okta/ci-pkginfo

if [ -n "${action_branch}" ];
then
Expand All @@ -32,6 +33,9 @@ if ! npm publish --registry ${REGISTRY}; then
exit ${PUBLISH_ARTIFACTORY_FAILURE}
fi

FINAL_PUBLISHED_VERSION="$(ci-pkginfo -t pkgsemver)"
log_custom_message "Published Version" "${FINAL_PUBLISHED_VERSION}"

popd

exit ${SUCCESS}
2 changes: 1 addition & 1 deletion scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export PATH="${PATH}:$(yarn global bin)"

# Install required node version
export NVM_DIR="/root/.nvm"
NODE_VERSION="${1:-v12.20.0}"
NODE_VERSION="${1:-v14.18.3}"
setup_service node $NODE_VERSION
# Use the cacert bundled with centos as okta root CA is self-signed and cause issues downloading from yarn
setup_service yarn 1.21.1 /etc/pki/tls/certs/ca-bundle.crt
Expand Down
23 changes: 23 additions & 0 deletions scripts/unit-v6.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash -x

# runs unit tests against latest 6.x version

source ${OKTA_HOME}/${REPO}/scripts/setup.sh

export TEST_SUITE_TYPE="junit"
export TEST_RESULT_FILE_DIR="${REPO}/test-reports/unit"

if ! yarn add -DW --ignore-scripts @okta/okta-auth-js@^6; then
echo "auth-js v6.x could not be installed"
exit ${FAILED_SETUP}
fi

# Run jest with "ci" flag
if ! yarn test:unit --ci; then
echo "unit failed! Exiting..."
exit ${TEST_FAILURE}
fi

echo ${TEST_SUITE_TYPE} > ${TEST_SUITE_TYPE_FILE}
echo ${TEST_RESULT_FILE_DIR} > ${TEST_RESULT_FILE_DIR_FILE}
exit ${PUBLISH_TYPE_AND_RESULT_DIR}
4 changes: 4 additions & 0 deletions src/Security.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,13 @@ const Security: React.FC<{

// Add default restoreOriginalUri callback
// props.restoreOriginalUri is required, therefore if options.restoreOriginalUri exists, there are 2 callbacks
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
if (oktaAuth.options.restoreOriginalUri) {
console.warn('Two custom restoreOriginalUri callbacks are detected. The one from the OktaAuth configuration will be overridden by the provided restoreOriginalUri prop from the Security component.');
}
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
oktaAuth.options.restoreOriginalUri = (async (oktaAuth: unknown, originalUri: string) => {
restoreOriginalUri(oktaAuth as OktaAuth, originalUri);
}) as ((oktaAuth: OktaAuth, originalUri?: string) => Promise<void>);
Expand Down
44 changes: 27 additions & 17 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1460,17 +1460,16 @@
"@nodelib/fs.scandir" "2.1.5"
fastq "^1.6.0"

"@okta/okta-auth-js@*", "@okta/okta-auth-js@~6.7.5":
version "6.7.5"
resolved "https://registry.yarnpkg.com/@okta/okta-auth-js/-/okta-auth-js-6.7.5.tgz#b2eeaf5daa12f94aa6cfa6271e53e4cd6d3e2aee"
integrity sha512-zeN+5uA+PsBUIIqKD9K4Nz2jBGlKbMWURtkXEJmC2o8marcFKTMuPtkroIUV41gLT+B4H4ocCzMp/b1AOxgZWw==
"@okta/okta-auth-js@*", "@okta/okta-auth-js@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/@okta/okta-auth-js/-/okta-auth-js-7.0.0.tgz#d83acb76394ebc7d019d922f0e319fe6655c41ac"
integrity sha512-tF+OiaAHNHc5ACKUR5lynX7LQyw9+pqKj8hzSY+E6OCKucYudjMg87AdCdyBxpFgxrirRlAFYv08sM1wwn0Eeg==
dependencies:
"@babel/runtime" "^7.12.5"
"@babel/runtime-corejs3" "^7.17.0"
"@peculiar/webcrypto" "^1.4.0"
Base64 "1.1.0"
atob "^2.1.2"
broadcast-channel "4.13.0"
broadcast-channel "~4.17.0"
btoa "^1.2.1"
core-js "^3.6.5"
cross-fetch "^3.1.5"
Expand All @@ -1483,17 +1482,17 @@
webcrypto-shim "^0.1.5"
xhr2 "0.1.3"

"@okta/[email protected].1":
version "6.5.1"
resolved "https://registry.yarnpkg.com/@okta/okta-auth-js/-/okta-auth-js-6.5.1.tgz#aa1b3815152e729c6a69137a19c7fd502d2e4e5d"
integrity sha512-mBzg+EH1Ey7skxHiimSN/ZYraB3l8ZXZlBi8RXNmRLwPMbFlZkQoKrrQu357S5YSEckF59Lqbb/r9Y3cXBNQBQ==
"@okta/[email protected].4":
version "6.5.4"
resolved "https://registry.yarnpkg.com/@okta/okta-auth-js/-/okta-auth-js-6.5.4.tgz#a61877162113e6e0cfe7e05ecaf55840aa287669"
integrity sha512-a96D1QUBlE464Xm0GBSIWTcRYyGgsDf/TchGJeDbUvEa2rcFJcxG1x+7gRUzMW+WiX1DN7N0v8Dd+j6Fgou+ow==
dependencies:
"@babel/runtime" "^7.12.5"
"@babel/runtime-corejs3" "^7.17.0"
"@peculiar/webcrypto" "1.1.6"
Base64 "1.1.0"
atob "^2.1.2"
broadcast-channel "^4.10.0"
broadcast-channel "4.13.0"
btoa "^1.2.1"
core-js "^3.6.5"
cross-fetch "^3.1.5"
Expand All @@ -1506,12 +1505,12 @@
webcrypto-shim "^0.1.5"
xhr2 "0.1.3"

"@okta/okta-signin-widget@^6.6.1":
version "6.6.1"
resolved "https://registry.yarnpkg.com/@okta/okta-signin-widget/-/okta-signin-widget-6.6.1.tgz#8a1158e6e57b0e168726ded7375424ac9fb2dc80"
integrity sha512-H0OnQzQQOTGKpFK0imT+aatS0Qrg7m0uuW9GHbHeFTU4Usq0tsD2TsswHEDhJx+YOJr/6TbX2zTfnPLBskgXYQ==
"@okta/okta-signin-widget@^6.7.1":
version "6.7.1"
resolved "https://registry.yarnpkg.com/@okta/okta-signin-widget/-/okta-signin-widget-6.7.1.tgz#d9bf00ca4498cb60041dcc725d618e6f50cf36fc"
integrity sha512-81OManicMpSqXJ0L4fLuniZx8G10Fmo6xDEKeKVeO7QM3GyFfyFTJtxcd6rn0P6OCnAUZ5yfVnI5xceO4YfWTA==
dependencies:
"@okta/okta-auth-js" "6.5.1"
"@okta/okta-auth-js" "6.5.4"
"@sindresorhus/to-milliseconds" "^1.0.0"
"@types/backbone" "^1.4.15"
"@types/jquery" "^3.5.14"
Expand Down Expand Up @@ -3142,7 +3141,7 @@ braces@^3.0.2, braces@~3.0.2:
dependencies:
fill-range "^7.0.1"

[email protected], broadcast-channel@^4.10.0:
[email protected]:
version "4.13.0"
resolved "https://registry.yarnpkg.com/broadcast-channel/-/broadcast-channel-4.13.0.tgz#21387b2602b9e9ec3b97b03bd8a8d2c198352ff6"
integrity sha512-fcDr8QNJ4SOb6jyjUNZatVNmcHtSWfW4PFcs4xIEFZAtorKCIFoEYtjIjaQ4c0jrbr/Bl8NIwOWiLSyspoAnEQ==
Expand All @@ -3155,6 +3154,17 @@ [email protected], broadcast-channel@^4.10.0:
rimraf "3.0.2"
unload "2.3.1"

broadcast-channel@~4.17.0:
version "4.17.0"
resolved "https://registry.yarnpkg.com/broadcast-channel/-/broadcast-channel-4.17.0.tgz#599d44674b09a4e2e07af6da5d03b45ca8bffd11"
integrity sha512-r2GSQMNgZv7eAsbdsu9xofSjc3J2diCQTPkSuyVhLBfx8fylLCVhi5KheuhuAQBJNd4pxqUyz9U6rvdnt7GZng==
dependencies:
"@babel/runtime" "^7.16.0"
oblivious-set "1.1.1"
p-queue "6.6.2"
rimraf "3.0.2"
unload "2.3.1"

browser-process-hrtime@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz#3c9b4b7d782c8121e56f10106d84c0d0ffc94626"
Expand Down

0 comments on commit 5c810a6

Please sign in to comment.