implement OIDC configuration management with CRUD operations, add admin routes, and enhance error handling

This commit is contained in:
2025-07-23 03:32:00 +08:00
parent 562b9bd17f
commit 58c370ec65
19 changed files with 523 additions and 73 deletions

View File

@ -68,28 +68,6 @@ func (user *userRepo) CheckEmailExists(email string) (bool, error) {
return count > 0, nil
}
func (user *userRepo) ListOidcConfigs(onlyEnabled bool) ([]model.OidcConfig, error) {
var configs []model.OidcConfig
if onlyEnabled {
if err := GetDB().Where("enabled = ?", true).Find(&configs).Error; err != nil {
return nil, err
}
} else {
if err := GetDB().Find(&configs).Error; err != nil {
return nil, err
}
}
return configs, nil
}
func (user *userRepo) GetOidcConfigByName(name string) (*model.OidcConfig, error) {
var config model.OidcConfig
if err := GetDB().Where("name = ?", name).First(&config).Error; err != nil {
return nil, err
}
return &config, nil
}
func (user *userRepo) CreateOrUpdateUserOpenID(userOpenID *model.UserOpenID) error {
if err := GetDB().Save(userOpenID).Error; err != nil {
return err