mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-11 16:45:13 +00:00
# Which Problems Are Solved As part of #11035 , this PR implements the IDP intent check logic for session validation # How the Problems Are Solved - Inject encryption algorithm for IDP intent tokens at DB initialization - Add the IDP intent repository as an invoke option - Rework crypto mocks using gomock - Implement IDP intent check logic - minor - DB: expand IDP Intent deletion testing table with a test case where IDP intent is not found # Noteworthy I did not implement `domain.Transactional` given the doubts that @adlerhurst expressed in https://github.com/zitadel/zitadel/pull/11804 . So, there is no transaction AT ALL in here because the `Execute()` method contains one single DB call (Delete) and `Validate()` just does Get calls. # 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/11804
44 lines
1.4 KiB
Go
44 lines
1.4 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"
|
|
)
|
|
|
|
func NewIDPIntentRepo(ctrl *gomock.Controller) *IDPIntentRepo {
|
|
return &IDPIntentRepo{
|
|
mock: NewMockIDPIntentRepository(ctrl),
|
|
IDPIntentRepository: repository.IDPIntentRepository(),
|
|
}
|
|
}
|
|
|
|
type IDPIntentRepo struct {
|
|
domain.IDPIntentRepository
|
|
mock *MockIDPIntentRepository
|
|
}
|
|
|
|
func (u *IDPIntentRepo) EXPECT() *MockIDPIntentRepositoryMockRecorder {
|
|
return u.mock.EXPECT()
|
|
}
|
|
|
|
func (i *IDPIntentRepo) Get(ctx context.Context, client database.QueryExecutor, opts ...database.QueryOption) (*domain.IDPIntent, error) {
|
|
return i.mock.Get(ctx, client, opts...)
|
|
}
|
|
|
|
func (i *IDPIntentRepo) Create(ctx context.Context, client database.QueryExecutor, intent *domain.IDPIntent) error {
|
|
return i.mock.Create(ctx, client, intent)
|
|
}
|
|
|
|
func (i *IDPIntentRepo) Update(ctx context.Context, client database.QueryExecutor, condition database.Condition, changes ...database.Change) (int64, error) {
|
|
return i.mock.Update(ctx, client, condition, changes...)
|
|
}
|
|
|
|
func (i *IDPIntentRepo) Delete(ctx context.Context, client database.QueryExecutor, condition database.Condition) (int64, error) {
|
|
return i.mock.Delete(ctx, client, condition)
|
|
}
|