mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-15 18:25:13 +00:00
# Which Problems Are Solved This PR adds the OTP SMS Challenge needed for CreateSession API https://github.com/zitadel/zitadel/issues/11035 # How the Problems Are Solved - Introduce `OTPSMSChallengeCommand` (validate/execute/events) for session creation checks - Introduce `GetOTPCryptoGeneratorConfigWithDefault` to fetch per-instance secret generator settings - Add unit tests # Additional Changes Refactor tests in `session_check_recovery_code_test.go` to make the helper functions reusable in `session_challenge_otp_sms_test.go` # Additional Context Related to https://github.com/zitadel/zitadel/issues/11035
49 lines
1.7 KiB
Go
49 lines
1.7 KiB
Go
package domainmock
|
|
|
|
import (
|
|
"context"
|
|
|
|
"go.uber.org/mock/gomock"
|
|
|
|
"github.com/zitadel/zitadel/backend/v3/domain"
|
|
"github.com/zitadel/zitadel/backend/v3/storage/database"
|
|
"github.com/zitadel/zitadel/backend/v3/storage/database/repository"
|
|
)
|
|
|
|
type SecretGeneratorSettingsRepo struct {
|
|
domain.SecretGeneratorSettingsRepository
|
|
mock *MockSecretGeneratorSettingsRepository
|
|
}
|
|
|
|
func NewSecretGeneratorSettingsRepo(ctrl *gomock.Controller) *SecretGeneratorSettingsRepo {
|
|
return &SecretGeneratorSettingsRepo{
|
|
mock: NewMockSecretGeneratorSettingsRepository(ctrl),
|
|
SecretGeneratorSettingsRepository: repository.SecretGeneratorSettingsRepository(),
|
|
}
|
|
}
|
|
|
|
func (r *SecretGeneratorSettingsRepo) EXPECT() *MockSecretGeneratorSettingsRepositoryMockRecorder {
|
|
r.mock.ctrl.T.Helper()
|
|
return r.mock.EXPECT()
|
|
}
|
|
|
|
func (r *SecretGeneratorSettingsRepo) Get(ctx context.Context, client database.QueryExecutor, opts ...database.QueryOption) (*domain.SecretGeneratorSettings, error) {
|
|
r.mock.ctrl.T.Helper()
|
|
return r.mock.Get(ctx, client, opts...)
|
|
}
|
|
|
|
func (r *SecretGeneratorSettingsRepo) List(ctx context.Context, client database.QueryExecutor, opts ...database.QueryOption) ([]*domain.SecretGeneratorSettings, error) {
|
|
r.mock.ctrl.T.Helper()
|
|
return r.mock.List(ctx, client, opts...)
|
|
}
|
|
|
|
func (r *SecretGeneratorSettingsRepo) Set(ctx context.Context, client database.QueryExecutor, settings *domain.SecretGeneratorSettings) error {
|
|
r.mock.ctrl.T.Helper()
|
|
return r.mock.Set(ctx, client, settings)
|
|
}
|
|
|
|
func (r *SecretGeneratorSettingsRepo) Delete(ctx context.Context, client database.QueryExecutor, condition database.Condition) (int64, error) {
|
|
r.mock.ctrl.T.Helper()
|
|
return r.mock.Delete(ctx, client, condition)
|
|
}
|