1
0
forked from baron/baron-sso

사용자 필드 관리

This commit is contained in:
2026-02-02 17:11:43 +09:00
parent a54c2ab138
commit 12ae5929e3
17 changed files with 648 additions and 103 deletions

View File

@@ -2320,6 +2320,7 @@ func (h *AuthHandler) GetMe(c *fiber.Ctx) error {
Department: dept,
AffiliationType: affType,
CompanyCode: compCode,
Metadata: userResponse.CustomAttributes,
}
if compCode != "" {
@@ -3801,7 +3802,20 @@ func (h *AuthHandler) getKratosProfile(sessionToken string) (*domain.UserProfile
Department: dept,
AffiliationType: affType,
CompanyCode: compCode,
Metadata: make(map[string]any),
}
coreTraits := map[string]bool{
"email": true, "name": true, "phone_number": true,
"grade": true, "companyCode": true, "department": true,
"affiliationType": true,
}
for k, v := range traits {
if !coreTraits[k] {
profile.Metadata[k] = v
}
}
return profile, nil
}
@@ -3826,7 +3840,20 @@ func (h *AuthHandler) getKratosProfileWithCookie(cookie string) (*domain.UserPro
Department: dept,
AffiliationType: affType,
CompanyCode: compCode,
Metadata: make(map[string]any),
}
coreTraits := map[string]bool{
"email": true, "name": true, "phone_number": true,
"grade": true, "companyCode": true, "department": true,
"affiliationType": true,
}
for k, v := range traits {
if !coreTraits[k] {
profile.Metadata[k] = v
}
}
return profile, nil
}