Skip to content

Commit

Permalink
[RND-663] Allow case insensitivity in OAuth requests (#328)
Browse files Browse the repository at this point in the history
* Allow case insensitivity in OAuth requests

* v0.4.0-pre.4

* removes second it con test description.

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
DavidJGapCR and github-actions[bot] authored Nov 23, 2023
1 parent f9dcbff commit 1e7f42f
Show file tree
Hide file tree
Showing 15 changed files with 117 additions and 90 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@edfi/meadowlark-elasticsearch-backend",
"main": "dist/index.js",
"version": "0.4.0-pre.3",
"version": "0.4.0-pre.4",
"description": "Meadowlark backend plugin for elasticsearch",
"license": "Apache-2.0",
"publishConfig": {
Expand All @@ -19,8 +19,8 @@
"build:copy-non-ts": "copyfiles -u 1 -e \"**/*.ts\" \"src/**/*\" dist --verbose"
},
"dependencies": {
"@edfi/meadowlark-core": "0.4.0-pre.3",
"@edfi/meadowlark-utilities": "0.4.0-pre.3",
"@edfi/meadowlark-core": "0.4.0-pre.4",
"@edfi/meadowlark-utilities": "0.4.0-pre.4",
"@elastic/elasticsearch": "^8.10.0",
"@elastic/transport": "^8.3.4"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@edfi/meadowlark-mongodb-backend",
"main": "dist/index.js",
"version": "0.4.0-pre.3",
"version": "0.4.0-pre.4",
"description": "Meadowlark backend plugin for MongoDB",
"license": "Apache-2.0",
"publishConfig": {
Expand All @@ -19,9 +19,9 @@
"build:copy-non-ts": "copyfiles -u 1 -e \"**/*.ts\" \"src/**/*\" dist --verbose"
},
"dependencies": {
"@edfi/meadowlark-authz-server": "0.4.0-pre.3",
"@edfi/meadowlark-core": "0.4.0-pre.3",
"@edfi/meadowlark-utilities": "0.4.0-pre.3",
"@edfi/meadowlark-authz-server": "0.4.0-pre.4",
"@edfi/meadowlark-core": "0.4.0-pre.4",
"@edfi/meadowlark-utilities": "0.4.0-pre.4",
"async-retry": "^1.3.3",
"mongodb": "^5.9.0",
"ramda": "0.29.1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@edfi/meadowlark-opensearch-backend",
"main": "dist/index.js",
"version": "0.4.0-pre.3",
"version": "0.4.0-pre.4",
"description": "Meadowlark backend plugin for OpenSearch",
"license": "Apache-2.0",
"publishConfig": {
Expand All @@ -19,8 +19,8 @@
"build:copy-non-ts": "copyfiles -u 1 -e \"**/*.ts\" \"src/**/*\" dist --verbose"
},
"dependencies": {
"@edfi/meadowlark-core": "0.4.0-pre.3",
"@edfi/meadowlark-utilities": "0.4.0-pre.3",
"@edfi/meadowlark-core": "0.4.0-pre.4",
"@edfi/meadowlark-utilities": "0.4.0-pre.4",
"@opensearch-project/opensearch": "^2.4.0"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@edfi/meadowlark-postgresql-backend",
"main": "dist/index.js",
"version": "0.4.0-pre.3",
"version": "0.4.0-pre.4",
"description": "Meadowlark backend plugin for PostgreSQL",
"license": "Apache-2.0",
"publishConfig": {
Expand All @@ -19,9 +19,9 @@
"build:copy-non-ts": "copyfiles -u 1 -e \"**/*.ts\" \"src/**/*\" dist --verbose"
},
"dependencies": {
"@edfi/meadowlark-authz-server": "0.4.0-pre.3",
"@edfi/meadowlark-core": "0.4.0-pre.3",
"@edfi/meadowlark-utilities": "0.4.0-pre.3",
"@edfi/meadowlark-authz-server": "0.4.0-pre.4",
"@edfi/meadowlark-core": "0.4.0-pre.4",
"@edfi/meadowlark-utilities": "0.4.0-pre.4",
"pg": "^8.11.3",
"pg-format": "^1.0.4",
"ramda": "0.29.1"
Expand Down
2 changes: 1 addition & 1 deletion Meadowlark-js/lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"packages": [
"packages/*"
],
"version": "0.4.0-pre.3",
"version": "0.4.0-pre.4",
"npmClient": "npm",
"useWorkspaces": true
}
50 changes: 25 additions & 25 deletions Meadowlark-js/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 Meadowlark-js/packages/meadowlark-authz-server/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@edfi/meadowlark-authz-server",
"main": "dist/index.js",
"version": "0.4.0-pre.3",
"version": "0.4.0-pre.4",
"description": "Meadowlark authorization server",
"license": "Apache-2.0",
"publishConfig": {
Expand All @@ -14,7 +14,7 @@
],
"dependencies": {
"@apideck/better-ajv-errors": "^0.3.6",
"@edfi/meadowlark-utilities": "0.4.0-pre.3",
"@edfi/meadowlark-utilities": "0.4.0-pre.4",
"ajv": "^8.12.0",
"dotenv": "^16.3.1",
"fast-memoize": "^2.5.2",
Expand Down
4 changes: 2 additions & 2 deletions Meadowlark-js/packages/meadowlark-core/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@edfi/meadowlark-core",
"main": "dist/index.js",
"version": "0.4.0-pre.3",
"version": "0.4.0-pre.4",
"description": "Meadowlark core functionality",
"license": "Apache-2.0",
"publishConfig": {
Expand All @@ -14,7 +14,7 @@
],
"dependencies": {
"@apideck/better-ajv-errors": "^0.3.6",
"@edfi/meadowlark-utilities": "0.4.0-pre.3",
"@edfi/meadowlark-utilities": "0.4.0-pre.4",
"@isaacs/ttlcache": "^1.4.1",
"ajv": "^8.12.0",
"ajv-formats": "^2.1.1",
Expand Down
2 changes: 1 addition & 1 deletion Meadowlark-js/packages/meadowlark-utilities/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@edfi/meadowlark-utilities",
"main": "dist/index.js",
"version": "0.4.0-pre.3",
"version": "0.4.0-pre.4",
"description": "Meadowlark shared utilities",
"license": "Apache-2.0",
"publishConfig": {
Expand Down
8 changes: 4 additions & 4 deletions Meadowlark-js/services/meadowlark-fastify/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@edfi/meadowlark-fastify",
"version": "0.4.0-pre.3",
"version": "0.4.0-pre.4",
"description": "Meadowlark service using Fastify",
"license": "Apache-2.0",
"publishConfig": {
Expand All @@ -12,9 +12,9 @@
"/package.json"
],
"dependencies": {
"@edfi/meadowlark-authz-server": "0.4.0-pre.3",
"@edfi/meadowlark-core": "0.4.0-pre.3",
"@edfi/meadowlark-utilities": "0.4.0-pre.3",
"@edfi/meadowlark-authz-server": "0.4.0-pre.4",
"@edfi/meadowlark-core": "0.4.0-pre.4",
"@edfi/meadowlark-utilities": "0.4.0-pre.4",
"@fastify/rate-limit": "^6.0.1",
"dotenv": "^16.3.1",
"fastify": "^3.29.5"
Expand Down
1 change: 1 addition & 0 deletions Meadowlark-js/services/meadowlark-fastify/src/Service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export function buildService(): FastifyInstance {
logger: Logger as FastifyLoggerInstance,
disableRequestLogging: true,
genReqId: () => randomUUID(),
caseSensitive: false,
});
}

Expand Down
43 changes: 10 additions & 33 deletions Meadowlark-js/services/meadowlark-fastify/test/Get.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,52 +58,29 @@ describe('given a GET', () => {
});
});

describe('given a school query without path ending slash', () => {
describe('given a school query', () => {
const schoolQueryRequest: InjectOptions = {
method: 'GET',
url: '/local/v3.3b/ed-fi/schools?schoolId=123',
url: '',
headers: { authorization: 'bearer 1234', 'content-type': 'application/json' },
};

beforeAll(async () => {
// Act
await service.inject(schoolQueryRequest);
});

it('should send the expected FrontendRequest to Meadowlark', async () => {
expect(mockGet.mock.calls).toHaveLength(1);
const mock = mockGet.mock.calls[0][0];
it.each([
{ url: '/local/v3.3b/ed-fi/schools?schoolId=123', path: '/v3.3b/ed-fi/schools' },
{ url: '/local/v3.3b/ed-fi/schools/?schoolId=123', path: '/v3.3b/ed-fi/schools/' },
{ url: '/local/v3.3b/Ed-Fi/Schools?schoolId=123', path: '/v3.3b/Ed-Fi/Schools' },
{ url: '/local/v3.3b/ED-FI/SCHOOLS/?schoolId=123', path: '/v3.3b/ED-FI/SCHOOLS/' },
])('should send the expected FrontendRequest to Meadowlark', async (item) => {
schoolQueryRequest.url = item.url;

expect(mock.body).toBeNull();
expect(mock.headers.authorization).toBe('bearer 1234');
expect(mock.path).toBe('/v3.3b/ed-fi/schools');
expect(mock.queryParameters).toMatchInlineSnapshot(`
{
"schoolId": "123",
}
`);
});
});

describe('given a school query with path ending slash', () => {
const schoolQueryRequest: InjectOptions = {
method: 'GET',
url: '/local/v3.3b/ed-fi/schools/?schoolId=123',
headers: { authorization: 'bearer 1234', 'content-type': 'application/json' },
};

beforeAll(async () => {
// Act
await service.inject(schoolQueryRequest);
});

it('should send the expected FrontendRequest to Meadowlark', async () => {
expect(mockGet.mock.calls).toHaveLength(1);
const mock = mockGet.mock.calls[0][0];

expect(mock.body).toBeNull();
expect(mock.headers.authorization).toBe('bearer 1234');
expect(mock.path).toBe('/v3.3b/ed-fi/schools/');
expect(mock.path).toBe(item.path);
expect(mock.queryParameters).toMatchInlineSnapshot(`
{
"schoolId": "123",
Expand Down
4 changes: 2 additions & 2 deletions Meadowlark-js/tests/e2e/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "@edfi/meadowlark-e2e-tests",
"main": "dist/index.js",
"version": "0.4.0-pre.3",
"version": "0.4.0-pre.4",
"description": "Meadowlark Ed-Fi API end to end tests",
"license": "Apache-2.0",
"private": true,
"files": [],
"devDependencies": {
"@edfi/meadowlark-utilities": "0.4.0-pre.3",
"@edfi/meadowlark-utilities": "0.4.0-pre.4",
"@testcontainers/mongodb": "^10.2.1",
"@testcontainers/postgresql": "^10.2.1",
"@types/chance": "^1.1.4",
Expand Down
Loading

0 comments on commit 1e7f42f

Please sign in to comment.