Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Update authentication middleware #6447

Merged
merged 26 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
255d696
authentication middleware update
pKorsholm Feb 20, 2024
e17f1ed
disable customer authentication
pKorsholm Feb 20, 2024
be19733
call correct feature flag method
pKorsholm Feb 20, 2024
d6b5337
Merge branch 'develop' into feat/update-authentication-middleware
pKorsholm Feb 21, 2024
3d5e33a
fix authentication middleware for store/customers
pKorsholm Feb 21, 2024
71a4674
Merge branch 'develop' into feat/update-authentication-middleware
pKorsholm Feb 21, 2024
b43a408
fix integration tests and add middleware for admin customers
pKorsholm Feb 22, 2024
44cd43c
Merge branch 'develop' into feat/update-authentication-middleware
pKorsholm Feb 22, 2024
4d68eae
update seeders
pKorsholm Feb 22, 2024
60aedea
customer groups fix
pKorsholm Feb 22, 2024
76589f8
add authentication middleware for all admin endpoints
pKorsholm Feb 22, 2024
ed3378a
Feat(medusa, user): require authentication for invite accept (#6448)
pKorsholm Feb 22, 2024
4202a39
refactor to auth instead of auth_user
pKorsholm Feb 22, 2024
515441b
pr feedback
pKorsholm Feb 23, 2024
c184c62
Merge branch 'develop' into feat/update-authentication-middleware
pKorsholm Feb 23, 2024
4eac91b
Merge branch 'develop' into feat/update-authentication-middleware
pKorsholm Feb 23, 2024
cda6136
update authenticatedRequest type
pKorsholm Feb 26, 2024
24a5bdd
update store authenticated endpoints
pKorsholm Feb 26, 2024
ef5dd9a
update routes with type
pKorsholm Feb 26, 2024
61be5ee
fix build
pKorsholm Feb 26, 2024
0c8275c
Merge branch 'develop' into feat/update-authentication-middleware
pKorsholm Feb 26, 2024
53e4007
fix build
pKorsholm Feb 26, 2024
a2fc0cb
Merge branch 'develop' into feat/update-authentication-middleware
pKorsholm Feb 26, 2024
6ab1073
fix build
pKorsholm Feb 26, 2024
5865b85
Merge branch 'develop' into feat/update-authentication-middleware
pKorsholm Feb 27, 2024
4c8afe4
use auth middleware for api-keys
pKorsholm Feb 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
import { initDb, useDb } from "../../../../environment-helpers/use-db"

import { ICustomerModuleService } from "@medusajs/types"
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
import adminSeeder from "../../../../helpers/admin-seeder"
import { createAdminUser } from "../../../helpers/create-admin-user"
import { getContainer } from "../../../../environment-helpers/use-container"
import path from "path"
import { startBootstrapApp } from "../../../../environment-helpers/bootstrap-app"
import { useApi } from "../../../../environment-helpers/use-api"
import { getContainer } from "../../../../environment-helpers/use-container"
import { initDb, useDb } from "../../../../environment-helpers/use-db"
import adminSeeder from "../../../../helpers/admin-seeder"

jest.setTimeout(50000)

Expand Down Expand Up @@ -37,7 +39,7 @@ describe("POST /admin/customer-groups/:id/customers/batch", () => {
})

beforeEach(async () => {
await adminSeeder(dbConnection)
await createAdminUser(dbConnection, adminHeaders)
})

afterEach(async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
import { initDb, useDb } from "../../../../environment-helpers/use-db"

import { ICustomerModuleService } from "@medusajs/types"
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
import adminSeeder from "../../../../helpers/admin-seeder"
import { createAdminUser } from "../../../helpers/create-admin-user"
import { getContainer } from "../../../../environment-helpers/use-container"
import path from "path"
import { startBootstrapApp } from "../../../../environment-helpers/bootstrap-app"
import { useApi } from "../../../../environment-helpers/use-api"
import { getContainer } from "../../../../environment-helpers/use-container"
import { initDb, useDb } from "../../../../environment-helpers/use-db"
import adminSeeder from "../../../../helpers/admin-seeder"

jest.setTimeout(50000)

Expand Down Expand Up @@ -37,7 +39,7 @@ describe("DELETE /admin/customer-groups/:id/customers/remove", () => {
})

beforeEach(async () => {
await adminSeeder(dbConnection)
await createAdminUser(dbConnection, adminHeaders)
})

afterEach(async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
import { initDb, useDb } from "../../../../environment-helpers/use-db"

import { ICustomerModuleService } from "@medusajs/types"
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
import adminSeeder from "../../../../helpers/admin-seeder"
import { createAdminUser } from "../../../helpers/create-admin-user"
import { getContainer } from "../../../../environment-helpers/use-container"
import path from "path"
import { startBootstrapApp } from "../../../../environment-helpers/bootstrap-app"
import { useApi } from "../../../../environment-helpers/use-api"
import { getContainer } from "../../../../environment-helpers/use-container"
import { initDb, useDb } from "../../../../environment-helpers/use-db"
import adminSeeder from "../../../../helpers/admin-seeder"

jest.setTimeout(50000)

Expand Down Expand Up @@ -37,7 +39,8 @@ describe("POST /admin/customer-groups", () => {
})

beforeEach(async () => {
await adminSeeder(dbConnection)
await createAdminUser(dbConnection, adminHeaders)
// await adminSeeder(dbConnection)
})

afterEach(async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
import { initDb, useDb } from "../../../../environment-helpers/use-db"

import { ICustomerModuleService } from "@medusajs/types"
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
import adminSeeder from "../../../../helpers/admin-seeder"
import { createAdminUser } from "../../../helpers/create-admin-user"
import { getContainer } from "../../../../environment-helpers/use-container"
import path from "path"
import { startBootstrapApp } from "../../../../environment-helpers/bootstrap-app"
import { useApi } from "../../../../environment-helpers/use-api"
import { getContainer } from "../../../../environment-helpers/use-container"
import { initDb, useDb } from "../../../../environment-helpers/use-db"
import adminSeeder from "../../../../helpers/admin-seeder"

jest.setTimeout(50000)

Expand Down Expand Up @@ -37,7 +39,7 @@ describe("DELETE /admin/customer-groups/:id", () => {
})

beforeEach(async () => {
await adminSeeder(dbConnection)
await createAdminUser(dbConnection, adminHeaders)
})

afterEach(async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
import { initDb, useDb } from "../../../../environment-helpers/use-db"

import { ICustomerModuleService } from "@medusajs/types"
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
import adminSeeder from "../../../../helpers/admin-seeder"
import { createAdminUser } from "../../../helpers/create-admin-user"
import { getContainer } from "../../../../environment-helpers/use-container"
import path from "path"
import { startBootstrapApp } from "../../../../environment-helpers/bootstrap-app"
import { useApi } from "../../../../environment-helpers/use-api"
import { getContainer } from "../../../../environment-helpers/use-container"
import { initDb, useDb } from "../../../../environment-helpers/use-db"
import adminSeeder from "../../../../helpers/admin-seeder"

jest.setTimeout(50000)

Expand Down Expand Up @@ -37,7 +39,7 @@ describe("GET /admin/customer-groups/:id/customers", () => {
})

beforeEach(async () => {
await adminSeeder(dbConnection)
await createAdminUser(dbConnection, adminHeaders)
})

afterEach(async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
import { initDb, useDb } from "../../../../environment-helpers/use-db"

import { ICustomerModuleService } from "@medusajs/types"
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
import adminSeeder from "../../../../helpers/admin-seeder"
import { createAdminUser } from "../../../helpers/create-admin-user"
import { getContainer } from "../../../../environment-helpers/use-container"
import path from "path"
import { startBootstrapApp } from "../../../../environment-helpers/bootstrap-app"
import { useApi } from "../../../../environment-helpers/use-api"
import { getContainer } from "../../../../environment-helpers/use-container"
import { initDb, useDb } from "../../../../environment-helpers/use-db"
import adminSeeder from "../../../../helpers/admin-seeder"

jest.setTimeout(50000)

Expand Down Expand Up @@ -37,7 +39,7 @@ describe("GET /admin/customer-groups", () => {
})

beforeEach(async () => {
await adminSeeder(dbConnection)
await createAdminUser(dbConnection, adminHeaders)
})

afterEach(async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
import { initDb, useDb } from "../../../../environment-helpers/use-db"

import { ICustomerModuleService } from "@medusajs/types"
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
import adminSeeder from "../../../../helpers/admin-seeder"
import { createAdminUser } from "../../../helpers/create-admin-user"
import { getContainer } from "../../../../environment-helpers/use-container"
import path from "path"
import { startBootstrapApp } from "../../../../environment-helpers/bootstrap-app"
import { useApi } from "../../../../environment-helpers/use-api"
import { getContainer } from "../../../../environment-helpers/use-container"
import { initDb, useDb } from "../../../../environment-helpers/use-db"
import adminSeeder from "../../../../helpers/admin-seeder"

jest.setTimeout(50000)

Expand Down Expand Up @@ -37,7 +39,7 @@ describe("GET /admin/customer-groups/:id", () => {
})

beforeEach(async () => {
await adminSeeder(dbConnection)
await createAdminUser(dbConnection, adminHeaders)
})

afterEach(async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
import { initDb, useDb } from "../../../../environment-helpers/use-db"

import { ICustomerModuleService } from "@medusajs/types"
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
import adminSeeder from "../../../../helpers/admin-seeder"
import { createAdminUser } from "../../../helpers/create-admin-user"
import { getContainer } from "../../../../environment-helpers/use-container"
import path from "path"
import { startBootstrapApp } from "../../../../environment-helpers/bootstrap-app"
import { useApi } from "../../../../environment-helpers/use-api"
import { getContainer } from "../../../../environment-helpers/use-container"
import { initDb, useDb } from "../../../../environment-helpers/use-db"
import adminSeeder from "../../../../helpers/admin-seeder"

jest.setTimeout(50000)

Expand Down Expand Up @@ -37,7 +39,7 @@ describe("POST /admin/customer-groups/:id", () => {
})

beforeEach(async () => {
await adminSeeder(dbConnection)
await createAdminUser(dbConnection, adminHeaders)
})

afterEach(async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
import { initDb, useDb } from "../../../../environment-helpers/use-db"

import { ICustomerModuleService } from "@medusajs/types"
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
import adminSeeder from "../../../../helpers/admin-seeder"
import { createAdminUser } from "../../../helpers/create-admin-user"
import { getContainer } from "../../../../environment-helpers/use-container"
import path from "path"
import { startBootstrapApp } from "../../../../environment-helpers/bootstrap-app"
import { useApi } from "../../../../environment-helpers/use-api"
import { getContainer } from "../../../../environment-helpers/use-container"
import { initDb, useDb } from "../../../../environment-helpers/use-db"
import adminSeeder from "../../../../helpers/admin-seeder"

jest.setTimeout(50000)

Expand Down Expand Up @@ -37,7 +39,7 @@ describe("POST /admin/customers/:id/addresses", () => {
})

beforeEach(async () => {
await adminSeeder(dbConnection)
await createAdminUser(dbConnection, adminHeaders)
})

afterEach(async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
import { initDb, useDb } from "../../../../environment-helpers/use-db"

import { ICustomerModuleService } from "@medusajs/types"
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
import adminSeeder from "../../../../helpers/admin-seeder"
import { createAdminUser } from "../../../helpers/create-admin-user"
import { getContainer } from "../../../../environment-helpers/use-container"
import path from "path"
import { startBootstrapApp } from "../../../../environment-helpers/bootstrap-app"
import { useApi } from "../../../../environment-helpers/use-api"
import { getContainer } from "../../../../environment-helpers/use-container"
import { initDb, useDb } from "../../../../environment-helpers/use-db"
import adminSeeder from "../../../../helpers/admin-seeder"

jest.setTimeout(50000)

Expand Down Expand Up @@ -37,7 +39,7 @@ describe("POST /admin/customers", () => {
})

beforeEach(async () => {
await adminSeeder(dbConnection)
await createAdminUser(dbConnection, adminHeaders)
})

afterEach(async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
import { initDb, useDb } from "../../../../environment-helpers/use-db"

import { ICustomerModuleService } from "@medusajs/types"
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
import adminSeeder from "../../../../helpers/admin-seeder"
import { createAdminUser } from "../../../helpers/create-admin-user"
import { getContainer } from "../../../../environment-helpers/use-container"
import path from "path"
import { startBootstrapApp } from "../../../../environment-helpers/bootstrap-app"
import { useApi } from "../../../../environment-helpers/use-api"
import { getContainer } from "../../../../environment-helpers/use-container"
import { initDb, useDb } from "../../../../environment-helpers/use-db"
import adminSeeder from "../../../../helpers/admin-seeder"

jest.setTimeout(50000)

Expand Down Expand Up @@ -37,7 +39,7 @@ describe("DELETE /admin/customers/:id/addresses/:address_id", () => {
})

beforeEach(async () => {
await adminSeeder(dbConnection)
await createAdminUser(dbConnection, adminHeaders)
})

afterEach(async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
import { initDb, useDb } from "../../../../environment-helpers/use-db"

import { ICustomerModuleService } from "@medusajs/types"
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
import adminSeeder from "../../../../helpers/admin-seeder"
import { createAdminUser } from "../../../helpers/create-admin-user"
import { getContainer } from "../../../../environment-helpers/use-container"
import path from "path"
import { startBootstrapApp } from "../../../../environment-helpers/bootstrap-app"
import { useApi } from "../../../../environment-helpers/use-api"
import { getContainer } from "../../../../environment-helpers/use-container"
import { initDb, useDb } from "../../../../environment-helpers/use-db"
import adminSeeder from "../../../../helpers/admin-seeder"

jest.setTimeout(50000)

Expand Down Expand Up @@ -37,7 +39,7 @@ describe("DELETE /admin/customers/:id", () => {
})

beforeEach(async () => {
await adminSeeder(dbConnection)
await createAdminUser(dbConnection, adminHeaders)
})

afterEach(async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
import { initDb, useDb } from "../../../../environment-helpers/use-db"

import { ICustomerModuleService } from "@medusajs/types"
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
import adminSeeder from "../../../../helpers/admin-seeder"
import { createAdminUser } from "../../../helpers/create-admin-user"
import { getContainer } from "../../../../environment-helpers/use-container"
import path from "path"
import { startBootstrapApp } from "../../../../environment-helpers/bootstrap-app"
import { useApi } from "../../../../environment-helpers/use-api"
import { getContainer } from "../../../../environment-helpers/use-container"
import { initDb, useDb } from "../../../../environment-helpers/use-db"
import adminSeeder from "../../../../helpers/admin-seeder"

jest.setTimeout(50000)

Expand Down Expand Up @@ -37,7 +39,7 @@ describe("GET /admin/customers/:id/addresses", () => {
})

beforeEach(async () => {
await adminSeeder(dbConnection)
await createAdminUser(dbConnection, adminHeaders)
})

afterEach(async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
import { initDb, useDb } from "../../../../environment-helpers/use-db"

import { ICustomerModuleService } from "@medusajs/types"
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
import adminSeeder from "../../../../helpers/admin-seeder"
import { createAdminUser } from "../../../helpers/create-admin-user"
import { getContainer } from "../../../../environment-helpers/use-container"
import path from "path"
import { startBootstrapApp } from "../../../../environment-helpers/bootstrap-app"
import { useApi } from "../../../../environment-helpers/use-api"
import { getContainer } from "../../../../environment-helpers/use-container"
import { initDb, useDb } from "../../../../environment-helpers/use-db"
import adminSeeder from "../../../../helpers/admin-seeder"

jest.setTimeout(50000)

Expand Down Expand Up @@ -37,7 +39,7 @@ describe("GET /admin/customers", () => {
})

beforeEach(async () => {
await adminSeeder(dbConnection)
await createAdminUser(dbConnection, adminHeaders)
})

afterEach(async () => {
Expand Down
Loading
Loading