Fixes: FRMW-2728, FRMW-2729 After this PR gets merged the following middleware will be exported from the `@medusajs/framework/http` import path. - applyParamsAsFilters - clearFiltersByKey - applyDefaultFilters - setContext - getQueryConfig - httpCompression - maybeApplyLinkFilter - refetchEntities - unlessPath - validateBody - validateQuery Co-authored-by: Adrien de Peretti <25098370+adrien2p@users.noreply.github.com>
60 lines
1.6 KiB
TypeScript
60 lines
1.6 KiB
TypeScript
import {
|
|
authenticate,
|
|
MiddlewareRoute,
|
|
validateAndTransformBody,
|
|
} from "@medusajs/framework/http"
|
|
import { validateScopeProviderAssociation } from "./utils/validate-scope-provider-association"
|
|
import { validateToken } from "./utils/validate-token"
|
|
import { ResetPasswordRequest } from "./validators"
|
|
|
|
export const authRoutesMiddlewares: MiddlewareRoute[] = [
|
|
{
|
|
method: ["POST"],
|
|
matcher: "/auth/session",
|
|
middlewares: [authenticate("*", "bearer")],
|
|
},
|
|
{
|
|
method: ["DELETE"],
|
|
matcher: "/auth/session",
|
|
middlewares: [authenticate("*", ["session"])],
|
|
},
|
|
{
|
|
method: ["POST"],
|
|
matcher: "/auth/token/refresh",
|
|
middlewares: [authenticate("*", "bearer", { allowUnregistered: true })],
|
|
},
|
|
{
|
|
method: ["POST"],
|
|
matcher: "/auth/:actor_type/:auth_provider/callback",
|
|
middlewares: [validateScopeProviderAssociation()],
|
|
},
|
|
{
|
|
method: ["POST"],
|
|
matcher: "/auth/:actor_type/:auth_provider/register",
|
|
middlewares: [validateScopeProviderAssociation()],
|
|
},
|
|
{
|
|
method: ["POST"],
|
|
matcher: "/auth/:actor_type/:auth_provider",
|
|
middlewares: [validateScopeProviderAssociation()],
|
|
},
|
|
{
|
|
method: ["GET"],
|
|
matcher: "/auth/:actor_type/:auth_provider",
|
|
middlewares: [validateScopeProviderAssociation()],
|
|
},
|
|
{
|
|
method: ["POST"],
|
|
matcher: "/auth/:actor_type/:auth_provider/reset-password",
|
|
middlewares: [
|
|
validateScopeProviderAssociation(),
|
|
validateAndTransformBody(ResetPasswordRequest),
|
|
],
|
|
},
|
|
{
|
|
method: ["POST"],
|
|
matcher: "/auth/:actor_type/:auth_provider/update",
|
|
middlewares: [validateScopeProviderAssociation(), validateToken()],
|
|
},
|
|
]
|