mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 18:57:32 +00:00
fix: v2 human command (#3435)
* add/register human command done * validations * crypto * move clientid * keys * fix: clientID * remove v2 package * tests * tests running * revert old code * instance domain from ctx * chore: rename zitadel app ids * comments * fix: test
This commit is contained in:
@@ -48,6 +48,18 @@ type Commands struct {
|
||||
privateKeyLifetime time.Duration
|
||||
publicKeyLifetime time.Duration
|
||||
tokenVerifier orgFeatureChecker
|
||||
|
||||
v2 *commandNew
|
||||
}
|
||||
|
||||
type commandNew struct {
|
||||
es *eventstore.Eventstore
|
||||
userPasswordAlg crypto.HashAlgorithm
|
||||
phoneAlg crypto.EncryptionAlgorithm
|
||||
emailAlg crypto.EncryptionAlgorithm
|
||||
initCodeAlg crypto.EncryptionAlgorithm
|
||||
zitadelRoles []authz.RoleMapping
|
||||
id id.Generator
|
||||
}
|
||||
|
||||
type orgFeatureChecker interface {
|
||||
@@ -64,6 +76,7 @@ func StartCommands(es *eventstore.Eventstore,
|
||||
otpEncryption,
|
||||
smtpEncryption,
|
||||
smsEncryption,
|
||||
userEncryption,
|
||||
domainVerificationEncryption,
|
||||
oidcEncryption crypto.EncryptionAlgorithm,
|
||||
) (repo *Commands, err error) {
|
||||
@@ -81,7 +94,9 @@ func StartCommands(es *eventstore.Eventstore,
|
||||
smsCrypto: smsEncryption,
|
||||
domainVerificationAlg: domainVerificationEncryption,
|
||||
keyAlgorithm: oidcEncryption,
|
||||
v2: NewCommandV2(es, defaults, userEncryption, authZConfig.RolePermissionMappings),
|
||||
}
|
||||
|
||||
instance_repo.RegisterEventMappers(repo.eventstore)
|
||||
org.RegisterEventMappers(repo.eventstore)
|
||||
usr_repo.RegisterEventMappers(repo.eventstore)
|
||||
@@ -113,6 +128,31 @@ func StartCommands(es *eventstore.Eventstore,
|
||||
return repo, nil
|
||||
}
|
||||
|
||||
func NewCommandV2(
|
||||
es *eventstore.Eventstore,
|
||||
defaults sd.SystemDefaults,
|
||||
userAlg crypto.EncryptionAlgorithm,
|
||||
zitadelRoles []authz.RoleMapping,
|
||||
) *commandNew {
|
||||
instance_repo.RegisterEventMappers(es)
|
||||
org.RegisterEventMappers(es)
|
||||
usr_repo.RegisterEventMappers(es)
|
||||
usr_grant_repo.RegisterEventMappers(es)
|
||||
proj_repo.RegisterEventMappers(es)
|
||||
keypair.RegisterEventMappers(es)
|
||||
action.RegisterEventMappers(es)
|
||||
|
||||
return &commandNew{
|
||||
es: es,
|
||||
userPasswordAlg: crypto.NewBCrypt(defaults.SecretGenerators.PasswordSaltCost),
|
||||
initCodeAlg: userAlg,
|
||||
phoneAlg: userAlg,
|
||||
emailAlg: userAlg,
|
||||
zitadelRoles: zitadelRoles,
|
||||
id: id.SonyFlakeGenerator,
|
||||
}
|
||||
}
|
||||
|
||||
func AppendAndReduce(object interface {
|
||||
AppendEvents(...eventstore.Event)
|
||||
Reduce() error
|
||||
|
Reference in New Issue
Block a user