Files
zitadel/backend/v3/domain/defaults.go
T
7c3d26b23b feat: rt sessions OTP email challenge (#11941)
# Which Problems Are Solved

Add OTP Email challenge needed for Create/Set session in the RT model.

# How the Problems Are Solved

Introduce `OTPEmailChallengeCommand` (validate/execute/events) for
session creation checks
Add unit tests

# Additional Changes
Remove unused fields from `session_challenge_otp_sms.go`

# Additional Context
- Related to https://github.com/zitadel/zitadel/issues/11035

---------

Co-authored-by: Marco A. <[email protected]>
2026-03-31 11:50:53 +00:00

63 lines
1.7 KiB
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"
"github.com/zitadel/zitadel/internal/webauthn"
)
var (
pool database.Pool
legacyEventstore eventstore.LegacyEventstore
sysConfig systemdefaults.SystemDefaults
passwordHasher *crypto.Hasher
idpEncryptionAlgo crypto.EncryptionAlgorithm
sessionTokenDecryptor SessionTokenDecryptor
mfaEncryptionAlgo crypto.EncryptionAlgorithm
otpSMSSecretGeneratorConfig *crypto.GeneratorConfig
otpEmailSecretGeneratorConfig *crypto.GeneratorConfig
webauthnConfig *webauthn.Config
)
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
}
func SetSessionTokenDecryptor(decryptor SessionTokenDecryptor) {
sessionTokenDecryptor = decryptor
}
func SetOTPSMSSecretGeneratorConfig(cfg *crypto.GeneratorConfig) {
otpSMSSecretGeneratorConfig = cfg
}
func SetOTPEmailSecretGeneratorConfig(cfg *crypto.GeneratorConfig) {
otpEmailSecretGeneratorConfig = cfg
}
func SetMFAEncryptionAlgorithm(mfaEncryptionAlg crypto.EncryptionAlgorithm) {
mfaEncryptionAlgo = mfaEncryptionAlg
}
func SetWebAuthNConfig(cfg *webauthn.Config) {
webauthnConfig = cfg
}