Skip to content

Commit

Permalink
[2.3.1] Bumped version of jwt-decode to 4.0.0 (#389)
Browse files Browse the repository at this point in the history
  • Loading branch information
maaaNu authored Feb 26, 2024
1 parent 224c9ee commit 4578bdb
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# CHANGELOG

## 2.3.1 (26.02.2024)
~ Bump the version of jwt-decode

## 2.3.0 (15.01.2024)
- Do not add the full content of `context.bindingData` to `customDimensions` for app insights logging anymore as it contains i.e. the request body.
+ Add `AppInsightForHttpTrigger.finalizeWithConfig` which allows you to configure when the request and response body should be logged and allows you to use a body sanitizer to remove sensitive data.
Expand Down
10 changes: 7 additions & 3 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@senacor/azure-function-middleware",
"version": "2.3.0",
"version": "2.3.1",
"description": "Middleware for azure functions to handle authentication, authorization, error handling and logging",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -42,7 +42,7 @@
"@azure/functions": "^3.0.0",
"@types/node": "^20.8.10",
"axios": "^1.1.3",
"jwt-decode": "^3.1.2"
"jwt-decode": "^4.0.0"
},
"peerDependencies": {
"applicationinsights": "^2.5.0",
Expand Down
8 changes: 4 additions & 4 deletions src/jwtAuthorization.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('The authorization middleware should', () => {

test('successfully validate the passed authorization token', async () => {
requestMock.headers.authorization = 'Bearer token';
jwtMock.default.mockReturnValue('JWT-TEST');
jwtMock.jwtDecode.mockReturnValue('JWT-TEST');

await sut([
{
Expand All @@ -45,7 +45,7 @@ describe('The authorization middleware should', () => {
),
).rejects.toEqual(new ApplicationError('Authorization error', 401));

expect(jwtMock.default).not.toBeCalled();
expect(jwtMock.jwtDecode).not.toBeCalled();
});

test('fail caused by a incorrectly formatted authorization header', async () => {
Expand All @@ -60,12 +60,12 @@ describe('The authorization middleware should', () => {
),
).rejects.toEqual(new ApplicationError('Authorization error', 401));

expect(jwtMock.default).not.toBeCalled();
expect(jwtMock.jwtDecode).not.toBeCalled();
});

test('fail caused by second rule failing and therefore chaining failed', async () => {
requestMock.headers.authorization = 'Bearer token';
jwtMock.default.mockReturnValue('JWT-TEST');
jwtMock.jwtDecode.mockReturnValue('JWT-TEST');

await expect(
sut([
Expand Down
2 changes: 1 addition & 1 deletion src/jwtAuthorization.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AzureFunction, Context, ContextBindingData, HttpRequest } from '@azure/functions';
import jwtDecode from 'jwt-decode';
import { jwtDecode } from 'jwt-decode';

import { ApplicationError } from './error';

Expand Down

0 comments on commit 4578bdb

Please sign in to comment.