forked from baron/baron-sso
외부 OIDC IdP 연동 계획
This commit is contained in:
23
backend/internal/repository/gorm_federation_repository.go
Normal file
23
backend/internal/repository/gorm_federation_repository.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package repository
|
||||
|
||||
import (
|
||||
"baron-sso-backend/internal/domain"
|
||||
"context"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type GormFederationRepository struct {
|
||||
db *gorm.DB
|
||||
}
|
||||
|
||||
func NewGormFederationRepository(db *gorm.DB) *GormFederationRepository {
|
||||
return &GormFederationRepository{db: db}
|
||||
}
|
||||
|
||||
func (r *GormFederationRepository) FindProviderByID(ctx context.Context, providerID string) (*domain.IdentityProviderConfig, error) {
|
||||
var provider domain.IdentityProviderConfig
|
||||
if err := r.db.WithContext(ctx).First(&provider, "id = ?", providerID).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &provider, nil
|
||||
}
|
||||
Reference in New Issue
Block a user