mirror of
https://github.com/andwati/zitadel.git
synced 2026-10-18 05:52:51 +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
39 lines
1001 B
Go
39 lines
1001 B
Go
package domain
|
|
|
|
import (
|
|
"github.com/zitadel/zitadel/backend/v3/storage/database"
|
|
"github.com/zitadel/zitadel/backend/v3/storage/eventstore"
|
|
"github.com/zitadel/zitadel/internal/config/systemdefaults"
|
|
"github.com/zitadel/zitadel/internal/crypto"
|
|
)
|
|
|
|
var (
|
|
pool database.Pool
|
|
// tracer tracing.Tracer = tracing.GlobalTracer()
|
|
// runtimeLogger *slog.Logger = logging.New(logging.StreamRuntime, nil)
|
|
legacyEventstore eventstore.LegacyEventstore
|
|
sysConfig systemdefaults.SystemDefaults
|
|
passwordHasher *crypto.Hasher
|
|
idpEncryptionAlgo crypto.EncryptionAlgorithm
|
|
)
|
|
|
|
func SetPool(p database.Pool) {
|
|
pool = p
|
|
}
|
|
|
|
func SetLegacyEventstore(es eventstore.LegacyEventstore) {
|
|
legacyEventstore = es
|
|
}
|
|
|
|
func SetSystemConfig(cfg systemdefaults.SystemDefaults) {
|
|
sysConfig = cfg
|
|
}
|
|
|
|
func SetPasswordHasher(hasher *crypto.Hasher) {
|
|
passwordHasher = hasher
|
|
}
|
|
|
|
func SetIDPEncryptionAlgorithm(idpEncryptionAlg crypto.EncryptionAlgorithm) {
|
|
idpEncryptionAlgo = idpEncryptionAlg
|
|
}
|