mirror of
https://github.com/andwati/zitadel.git
synced 2026-10-22 23:42:16 +00:00
fix: add register org and key pairs (#1275)
This commit is contained in:
@@ -2,6 +2,7 @@ package command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/caos/zitadel/internal/api/http"
|
||||
sd "github.com/caos/zitadel/internal/config/systemdefaults"
|
||||
@@ -11,6 +12,7 @@ import (
|
||||
global_model "github.com/caos/zitadel/internal/model"
|
||||
"github.com/caos/zitadel/internal/telemetry/tracing"
|
||||
iam_repo "github.com/caos/zitadel/internal/v2/repository/iam"
|
||||
keypair "github.com/caos/zitadel/internal/v2/repository/keypair"
|
||||
"github.com/caos/zitadel/internal/v2/repository/org"
|
||||
proj_repo "github.com/caos/zitadel/internal/v2/repository/project"
|
||||
usr_repo "github.com/caos/zitadel/internal/v2/repository/user"
|
||||
@@ -39,6 +41,11 @@ type CommandSide struct {
|
||||
//TODO: remove global model, or move to domain
|
||||
multifactors global_model.Multifactors
|
||||
webauthn *webauthn_helper.WebAuthN
|
||||
|
||||
keySize int
|
||||
keyAlgorithm crypto.EncryptionAlgorithm
|
||||
privateKeyLifetime time.Duration
|
||||
publicKeyLifetime time.Duration
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
@@ -48,15 +55,19 @@ type Config struct {
|
||||
|
||||
func StartCommandSide(config *Config) (repo *CommandSide, err error) {
|
||||
repo = &CommandSide{
|
||||
eventstore: config.Eventstore,
|
||||
idGenerator: id.SonyFlakeGenerator,
|
||||
iamDomain: config.SystemDefaults.Domain,
|
||||
eventstore: config.Eventstore,
|
||||
idGenerator: id.SonyFlakeGenerator,
|
||||
iamDomain: config.SystemDefaults.Domain,
|
||||
keySize: config.SystemDefaults.KeyConfig.Size,
|
||||
privateKeyLifetime: config.SystemDefaults.KeyConfig.PrivateKeyLifetime.Duration,
|
||||
publicKeyLifetime: config.SystemDefaults.KeyConfig.PublicKeyLifetime.Duration,
|
||||
}
|
||||
iam_repo.RegisterEventMappers(repo.eventstore)
|
||||
org.RegisterEventMappers(repo.eventstore)
|
||||
usr_repo.RegisterEventMappers(repo.eventstore)
|
||||
usr_grant_repo.RegisterEventMappers(repo.eventstore)
|
||||
proj_repo.RegisterEventMappers(repo.eventstore)
|
||||
keypair.RegisterEventMappers(repo.eventstore)
|
||||
|
||||
//TODO: simplify!!!!
|
||||
repo.idpConfigSecretCrypto, err = crypto.NewAESCrypto(config.SystemDefaults.IDPConfigVerificationKey)
|
||||
@@ -99,6 +110,12 @@ func StartCommandSide(config *Config) (repo *CommandSide, err error) {
|
||||
return nil, err
|
||||
}
|
||||
repo.webauthn = web
|
||||
|
||||
keyAlgorithm, err := crypto.NewAESCrypto(config.SystemDefaults.KeyConfig.EncryptionConfig)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
repo.keyAlgorithm = keyAlgorithm
|
||||
return repo, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user