feat(auth): Revamp authentication setup (#7387)
* chore: Clean up authentication middlewares * chore: Rename AuthUser to AuthIdentity * feat: Define link between user, customer, and auth identity * feat: Use links for auth, update auth context content * fix: Adjust user create command with new auth setup * fix: Make auth login more dynamic, review fixes * fix: Change test assertions for created by
This commit is contained in:
1 parent
b7df447682
commit
5ede560f70
88 files changed
+887
-1014
No files matched your search
@@ -0,0 +1,37 @@
|
||||
import { AuthIdentity } from "@models"
|
||||
import { SqlEntityManager } from "@mikro-orm/postgresql"
|
||||
|
||||
export async function createAuthIdentities(
|
||||
manager: SqlEntityManager,
|
||||
userData: any[] = [
|
||||
{
|
||||
id: "test-id",
|
||||
entity_id: "test-id",
|
||||
provider: "manual",
|
||||
scope: "store",
|
||||
},
|
||||
{
|
||||
id: "test-id-1",
|
||||
entity_id: "test-id-1",
|
||||
provider: "manual",
|
||||
scope: "store",
|
||||
},
|
||||
{
|
||||
entity_id: "test-id-2",
|
||||
provider: "store",
|
||||
scope: "store",
|
||||
},
|
||||
]
|
||||
): Promise<AuthIdentity[]> {
|
||||
const authIdentities: AuthIdentity[] = []
|
||||
|
||||
for (const user of userData) {
|
||||
const authIdentity = manager.create(AuthIdentity, user)
|
||||
|
||||
authIdentities.push(authIdentity)
|
||||
}
|
||||
|
||||
await manager.persistAndFlush(authIdentities)
|
||||
|
||||
return authIdentities
|
||||
}
|
||||
Reference in new issue
Block a user