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:
@@ -15,9 +15,9 @@ type OptionalFields = "provider_metadata" | "app_metadata" | "user_metadata"
|
||||
@Entity()
|
||||
@Unique({
|
||||
properties: ["provider", "scope", "entity_id"],
|
||||
name: "IDX_auth_user_provider_scope_entity_id",
|
||||
name: "IDX_auth_identity_provider_scope_entity_id",
|
||||
})
|
||||
export default class AuthUser {
|
||||
export default class AuthIdentity {
|
||||
[OptionalProps]: OptionalFields
|
||||
|
||||
@PrimaryKey({ columnType: "text" })
|
||||
@@ -43,11 +43,11 @@ export default class AuthUser {
|
||||
|
||||
@BeforeCreate()
|
||||
onCreate() {
|
||||
this.id = generateEntityId(this.id, "authusr")
|
||||
this.id = generateEntityId(this.id, "authid")
|
||||
}
|
||||
|
||||
@OnInit()
|
||||
onInit() {
|
||||
this.id = generateEntityId(this.id, "authusr")
|
||||
this.id = generateEntityId(this.id, "authid")
|
||||
}
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
export { default as AuthUser } from "./auth-user"
|
||||
export { default as AuthIdentity } from "./auth-identity"
|
||||
|
||||
Reference in New Issue
Block a user