ibm-cloud-sdk-core 4.0.1 → 4.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [4.0.2](https://github.com/IBM/node-sdk-core/compare/v4.0.1...v4.0.2) (2022-12-30)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **auth:** revert to using decode instead verify for jwt ([#227](https://github.com/IBM/node-sdk-core/issues/227)) ([cf3d641](https://github.com/IBM/node-sdk-core/commit/cf3d64106f35943c34f2a9c5d1b4de63994aed2a))
7
+
1
8
  ## [4.0.1](https://github.com/IBM/node-sdk-core/compare/v4.0.0...v4.0.1) (2022-12-29)
2
9
 
3
10
 
@@ -100,18 +100,7 @@ var JwtTokenManager = /** @class */ (function (_super) {
100
100
  logger_1.default.error(err);
101
101
  throw new Error(err);
102
102
  }
103
- var decodedResponse;
104
- try {
105
- decodedResponse = (0, jsonwebtoken_1.verify)(this.accessToken);
106
- }
107
- catch (e) {
108
- // the token is either an invalid JWT or it could not be verified
109
- logger_1.default.error('Failed to verify the JWT. See error message:');
110
- logger_1.default.error(e);
111
- throw new Error(e);
112
- }
113
- // the 'catch' method above should handle any verificiation/decoding issues but
114
- // this check is here as a failsafe
103
+ var decodedResponse = (0, jsonwebtoken_1.decode)(this.accessToken);
115
104
  if (!decodedResponse) {
116
105
  var err = 'Access token recieved is not a valid JWT';
117
106
  logger_1.default.error(err);
@@ -14,7 +14,7 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- import { verify } from 'jsonwebtoken';
17
+ import { decode } from 'jsonwebtoken';
18
18
  import logger from '../../lib/logger';
19
19
  import { TokenManager } from './token-manager';
20
20
  /**
@@ -65,18 +65,7 @@ export class JwtTokenManager extends TokenManager {
65
65
  logger.error(err);
66
66
  throw new Error(err);
67
67
  }
68
- let decodedResponse;
69
- try {
70
- decodedResponse = verify(this.accessToken);
71
- }
72
- catch (e) {
73
- // the token is either an invalid JWT or it could not be verified
74
- logger.error('Failed to verify the JWT. See error message:');
75
- logger.error(e);
76
- throw new Error(e);
77
- }
78
- // the 'catch' method above should handle any verificiation/decoding issues but
79
- // this check is here as a failsafe
68
+ const decodedResponse = decode(this.accessToken);
80
69
  if (!decodedResponse) {
81
70
  const err = 'Access token recieved is not a valid JWT';
82
71
  logger.error(err);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ibm-cloud-sdk-core",
3
- "version": "4.0.1",
3
+ "version": "4.0.2",
4
4
  "description": "Core functionality to support SDKs generated with IBM's OpenAPI SDK Generator.",
5
5
  "main": "index.js",
6
6
  "typings": "./es/index.d.ts",