From 295c191c1779b52700da4ef5e2be9f0f27b565eb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 18 Jun 2024 13:54:33 -0700 Subject: [PATCH] Bump jwt-decode from 3.1.2 to 4.0.0 in /spiffworkflow-frontend (#1691) * Bump jwt-decode from 3.1.2 to 4.0.0 in /spiffworkflow-frontend Bumps [jwt-decode](https://github.com/auth0/jwt-decode) from 3.1.2 to 4.0.0. - [Release notes](https://github.com/auth0/jwt-decode/releases) - [Changelog](https://github.com/auth0/jwt-decode/blob/main/CHANGELOG.md) - [Commits](https://github.com/auth0/jwt-decode/compare/v3.1.2...v4.0.0) --- updated-dependencies: - dependency-name: jwt-decode dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] * The jwtDecode function is now no longer the default export --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Kevin Burnett <18027+burnettk@users.noreply.github.com> Co-authored-by: burnettk --- spiffworkflow-frontend/package-lock.json | 32 ++++++------------- spiffworkflow-frontend/package.json | 2 +- .../src/services/UserService.ts | 10 +++--- 3 files changed, 16 insertions(+), 28 deletions(-) diff --git a/spiffworkflow-frontend/package-lock.json b/spiffworkflow-frontend/package-lock.json index 2045389d..2129ace1 100644 --- a/spiffworkflow-frontend/package-lock.json +++ b/spiffworkflow-frontend/package-lock.json @@ -48,7 +48,7 @@ "dmn-js": "^16.0.0", "dmn-js-properties-panel": "^3.0.0", "dmn-js-shared": "^16.4.0", - "jwt-decode": "^3.1.2", + "jwt-decode": "^4.0.0", "keycloak-js": "^24.0.4", "lodash.merge": "^4.6.2", "prop-types": "^15.8.1", @@ -17670,9 +17670,12 @@ } }, "node_modules/jwt-decode": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/jwt-decode/-/jwt-decode-3.1.2.tgz", - "integrity": "sha512-UfpWE/VZn0iP50d8cz9NrZLM9lSWhcJ+0Gt/nm4by88UL+J1SiKN8/5dkjMmbEzwL2CAe+67GsegCbIKtbp75A==" + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jwt-decode/-/jwt-decode-4.0.0.tgz", + "integrity": "sha512-+KJGIyHgkGuIq3IEBNftfhW/LfWhXUIY6OmyVWjliu5KH1y0fw7VQ8YndE2O4qZdMSd9SqbnC8GOcZEy0Om7sA==", + "engines": { + "node": ">=18" + } }, "node_modules/keycloak-js": { "version": "24.0.4", @@ -17683,14 +17686,6 @@ "jwt-decode": "^4.0.0" } }, - "node_modules/keycloak-js/node_modules/jwt-decode": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jwt-decode/-/jwt-decode-4.0.0.tgz", - "integrity": "sha512-+KJGIyHgkGuIq3IEBNftfhW/LfWhXUIY6OmyVWjliu5KH1y0fw7VQ8YndE2O4qZdMSd9SqbnC8GOcZEy0Om7sA==", - "engines": { - "node": ">=18" - } - }, "node_modules/keyv": { "version": "4.5.4", "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", @@ -38727,9 +38722,9 @@ } }, "jwt-decode": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/jwt-decode/-/jwt-decode-3.1.2.tgz", - "integrity": "sha512-UfpWE/VZn0iP50d8cz9NrZLM9lSWhcJ+0Gt/nm4by88UL+J1SiKN8/5dkjMmbEzwL2CAe+67GsegCbIKtbp75A==" + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jwt-decode/-/jwt-decode-4.0.0.tgz", + "integrity": "sha512-+KJGIyHgkGuIq3IEBNftfhW/LfWhXUIY6OmyVWjliu5KH1y0fw7VQ8YndE2O4qZdMSd9SqbnC8GOcZEy0Om7sA==" }, "keycloak-js": { "version": "24.0.4", @@ -38738,13 +38733,6 @@ "requires": { "js-sha256": "^0.11.0", "jwt-decode": "^4.0.0" - }, - "dependencies": { - "jwt-decode": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jwt-decode/-/jwt-decode-4.0.0.tgz", - "integrity": "sha512-+KJGIyHgkGuIq3IEBNftfhW/LfWhXUIY6OmyVWjliu5KH1y0fw7VQ8YndE2O4qZdMSd9SqbnC8GOcZEy0Om7sA==" - } } }, "keyv": { diff --git a/spiffworkflow-frontend/package.json b/spiffworkflow-frontend/package.json index 6fab5f53..20487f96 100644 --- a/spiffworkflow-frontend/package.json +++ b/spiffworkflow-frontend/package.json @@ -44,7 +44,7 @@ "dmn-js": "^16.0.0", "dmn-js-properties-panel": "^3.0.0", "dmn-js-shared": "^16.4.0", - "jwt-decode": "^3.1.2", + "jwt-decode": "^4.0.0", "keycloak-js": "^24.0.4", "lodash.merge": "^4.6.2", "prop-types": "^15.8.1", diff --git a/spiffworkflow-frontend/src/services/UserService.ts b/spiffworkflow-frontend/src/services/UserService.ts index c9a33086..fd0f7500 100644 --- a/spiffworkflow-frontend/src/services/UserService.ts +++ b/spiffworkflow-frontend/src/services/UserService.ts @@ -1,4 +1,4 @@ -import jwt from 'jwt-decode'; +import { jwtDecode } from 'jwt-decode'; import cookie from 'cookie'; import { BACKEND_BASE_URL } from '../config'; import { AuthenticationOption } from '../interfaces'; @@ -61,7 +61,7 @@ const isLoggedIn = () => { const isPublicUser = () => { const idToken = getIdToken(); if (idToken) { - const idObject = jwt(idToken); + const idObject = jwtDecode(idToken); return (idObject as any).public; } return false; @@ -107,7 +107,7 @@ const doLogout = () => { const getUserEmail = () => { const idToken = getIdToken(); if (idToken) { - const idObject = jwt(idToken); + const idObject = jwtDecode(idToken); return (idObject as any).email; } return null; @@ -116,7 +116,7 @@ const getUserEmail = () => { const authenticationDisabled = () => { const idToken = getIdToken(); if (idToken) { - const idObject = jwt(idToken); + const idObject = jwtDecode(idToken); return (idObject as any).authentication_disabled; } return false; @@ -133,7 +133,7 @@ const authenticationDisabled = () => { const getPreferredUsername = () => { const idToken = getIdToken(); if (idToken) { - const idObject = jwt(idToken); + const idObject = jwtDecode(idToken); if (idToken === undefined || idToken === 'undefined') { return null;