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;