Revamp the authentication setup (#7419)
* feat: Add email pass authentication provider package * feat: Revamp auth module and remove concept of scope * feat: Revamp the auth module to be more standardized in how providers are loaded * feat: Switch from scope to actor type for authentication * feat: Add support for per-actor auth methods * feat: Add emailpass auth provider by default * fix: Add back app_metadata in auth module
This commit is contained in:
@@ -33,7 +33,7 @@ medusaIntegrationTestRunner({
|
||||
})
|
||||
},
|
||||
async () => {
|
||||
return await api.post("/auth/admin/emailpass", {
|
||||
return await api.post("/auth/user/emailpass", {
|
||||
email: "admin@medusa.js",
|
||||
password: "secret_password",
|
||||
})
|
||||
@@ -63,7 +63,7 @@ medusaIntegrationTestRunner({
|
||||
|
||||
it("should test the entire authentication lifecycle", async () => {
|
||||
// sign in
|
||||
const response = await api.post("/auth/admin/emailpass", {
|
||||
const response = await api.post("/auth/user/emailpass", {
|
||||
email: "admin@medusa.js",
|
||||
password: "secret_password",
|
||||
})
|
||||
|
||||
@@ -175,7 +175,7 @@ medusaIntegrationTestRunner({
|
||||
token = await breaking(
|
||||
() => null,
|
||||
async () => {
|
||||
const emailPassResponse = await api.post("/auth/admin/emailpass", {
|
||||
const emailPassResponse = await api.post("/auth/user/emailpass", {
|
||||
email: "test@test123.com",
|
||||
password: "test123",
|
||||
})
|
||||
@@ -230,7 +230,7 @@ medusaIntegrationTestRunner({
|
||||
|
||||
// V2 only test
|
||||
it.skip("should throw, if session/bearer auth is present for existing user", async () => {
|
||||
const emailPassResponse = await api.post("/auth/admin/emailpass", {
|
||||
const emailPassResponse = await api.post("/auth/user/emailpass", {
|
||||
email: "test@test123.com",
|
||||
password: "test123",
|
||||
})
|
||||
|
||||
@@ -41,22 +41,7 @@ module.exports = {
|
||||
options: { ttl: cacheTTL },
|
||||
},
|
||||
workflows: true,
|
||||
[Modules.AUTH]: {
|
||||
scope: "internal",
|
||||
resources: "shared",
|
||||
resolve: "@medusajs/auth",
|
||||
options: {
|
||||
providers: [
|
||||
{
|
||||
name: "emailpass",
|
||||
scopes: {
|
||||
admin: {},
|
||||
store: {},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
[Modules.AUTH]: true,
|
||||
[Modules.USER]: {
|
||||
scope: "internal",
|
||||
resources: "shared",
|
||||
|
||||
Reference in New Issue
Block a user