mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-11 00:25:12 +00:00
# Which Problems Are Solved As part of #11035 , this PR implements the password check logic for session validation # How the Problems Are Solved - Add system config to default configuration of `domain` package for easy initialization. Intialize the system settings when Zitadel starts up - Add password hasher verify logic to the default configuration of `domain` package. Initialize it when Zitadel starts up. - Add settings repositories with their mocks - Implement the logic for doing a password check # Additional Context This is a cherry-picked PR + minor changes, coming from https://github.com/zitadel/zitadel/pull/11164 - Relates to #11035 - Depends on https://github.com/zitadel/zitadel/pull/11777
49 lines
1.6 KiB
Go
49 lines
1.6 KiB
Go
package domainmock
|
|
|
|
import (
|
|
context "context"
|
|
|
|
gomock "go.uber.org/mock/gomock"
|
|
|
|
domain "github.com/zitadel/zitadel/backend/v3/domain"
|
|
database "github.com/zitadel/zitadel/backend/v3/storage/database"
|
|
"github.com/zitadel/zitadel/backend/v3/storage/database/repository"
|
|
)
|
|
|
|
type LockoutSettingsRepo struct {
|
|
domain.LockoutSettingsRepository
|
|
mock *MockLockoutSettingsRepository
|
|
}
|
|
|
|
func NewLockoutSettingsRepo(ctrl *gomock.Controller) *LockoutSettingsRepo {
|
|
return &LockoutSettingsRepo{
|
|
mock: NewMockLockoutSettingsRepository(ctrl),
|
|
LockoutSettingsRepository: repository.LockoutSettingsRepository(),
|
|
}
|
|
}
|
|
|
|
func (lsr *LockoutSettingsRepo) EXPECT() *MockLockoutSettingsRepositoryMockRecorder {
|
|
lsr.mock.ctrl.T.Helper()
|
|
return lsr.mock.EXPECT()
|
|
}
|
|
|
|
func (lsr *LockoutSettingsRepo) Get(ctx context.Context, client database.QueryExecutor, opts ...database.QueryOption) (*domain.LockoutSettings, error) {
|
|
lsr.mock.ctrl.T.Helper()
|
|
return lsr.mock.Get(ctx, client, opts...)
|
|
}
|
|
|
|
func (lsr *LockoutSettingsRepo) List(ctx context.Context, client database.QueryExecutor, opts ...database.QueryOption) ([]*domain.LockoutSettings, error) {
|
|
lsr.mock.ctrl.T.Helper()
|
|
return lsr.mock.List(ctx, client, opts...)
|
|
}
|
|
|
|
func (lsr *LockoutSettingsRepo) Set(ctx context.Context, client database.QueryExecutor, settings *domain.LockoutSettings) error {
|
|
lsr.mock.ctrl.T.Helper()
|
|
return lsr.mock.Set(ctx, client, settings)
|
|
}
|
|
|
|
func (lsr *LockoutSettingsRepo) Delete(ctx context.Context, client database.QueryExecutor, condition database.Condition) (int64, error) {
|
|
lsr.mock.ctrl.T.Helper()
|
|
return lsr.mock.Delete(ctx, client, condition)
|
|
}
|