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,7 +1,5 @@
|
||||
{
|
||||
"namespaces": [
|
||||
"public"
|
||||
],
|
||||
"namespaces": ["public"],
|
||||
"name": "public",
|
||||
"tables": [
|
||||
{
|
||||
@@ -70,25 +68,19 @@
|
||||
"mappedType": "json"
|
||||
}
|
||||
},
|
||||
"name": "auth_user",
|
||||
"name": "auth_identity",
|
||||
"schema": "public",
|
||||
"indexes": [
|
||||
{
|
||||
"keyName": "IDX_auth_user_provider_scope_entity_id",
|
||||
"columnNames": [
|
||||
"provider",
|
||||
"scope",
|
||||
"entity_id"
|
||||
],
|
||||
"keyName": "IDX_auth_identity_provider_scope_entity_id",
|
||||
"columnNames": ["provider", "scope", "entity_id"],
|
||||
"composite": true,
|
||||
"primary": false,
|
||||
"unique": true
|
||||
},
|
||||
{
|
||||
"keyName": "auth_user_pkey",
|
||||
"columnNames": [
|
||||
"id"
|
||||
],
|
||||
"keyName": "auth_identity_pkey",
|
||||
"columnNames": ["id"],
|
||||
"composite": false,
|
||||
"primary": true,
|
||||
"unique": true
|
||||
|
||||
@@ -3,14 +3,14 @@ import { Migration } from "@mikro-orm/migrations"
|
||||
export class Migration20240205025924 extends Migration {
|
||||
async up(): Promise<void> {
|
||||
this.addSql(
|
||||
'create table if not exists "auth_user" ("id" text not null, "entity_id" text not null, "provider" text not null, "scope" text not null, "user_metadata" jsonb null, "app_metadata" jsonb not null, "provider_metadata" jsonb null, constraint "auth_user_pkey" primary key ("id"));'
|
||||
'create table if not exists "auth_identity" ("id" text not null, "entity_id" text not null, "provider" text not null, "scope" text not null, "user_metadata" jsonb null, "app_metadata" jsonb not null, "provider_metadata" jsonb null, constraint "auth_identity_pkey" primary key ("id"));'
|
||||
)
|
||||
this.addSql(
|
||||
'alter table "auth_user" add constraint "IDX_auth_user_provider_scope_entity_id" unique ("provider", "scope", "entity_id");'
|
||||
'alter table "auth_identity" add constraint "IDX_auth_identity_provider_scope_entity_id" unique ("provider", "scope", "entity_id");'
|
||||
)
|
||||
}
|
||||
|
||||
async down(): Promise<void> {
|
||||
this.addSql('drop table if exists "auth_user" cascade;')
|
||||
this.addSql('drop table if exists "auth_identity" cascade;')
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user