mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-15 10:25:11 +00:00
feat(action v2): add JWT and JWE payload type options (#11196)
# Which Problems Are Solved The payload in actions V2 is currently sent as JSON to the target endpoint. It might get exposed to intermediary infrastructure or logging systems. For these scenarios there needs to be an application-layer encryption, where the provider of the endpoint can define an key to be used for the encryption. # How the Problems Are Solved - Added an additional option to the target to specify the payload type: `JSON` (current and default), `JWT`, `JWE` (api and console) - added endpoints to upload and manage public keys (to be used for encryption) for a target - updated all action v2 executions (interceptors, oidc, saml, ...) to provide the `GetActiveSigningWebKey` from queries - implemented jwt and jwe in the exections incl. refactoring of code and tests - changes to the authn_keys table: - added a `fingerprint` column - dropped not null constraint on expiration - moved the `GetSignerOnce` into its own package to prevent circular dependencies # Additional Changes None # Additional Context closes #11061 --------- Co-authored-by: Marco A. <[email protected]> Co-authored-by: conblem <[email protected]> Co-authored-by: Silvan <[email protected]>
This commit is contained in:
co-authored by
Marco A.
conblem
Silvan
parent
72c8f0192c
commit
791d0587aa
@@ -18,9 +18,10 @@ type Worker struct {
|
||||
river.WorkerDefaults[*exec_repo.Request]
|
||||
|
||||
config WorkerConfig
|
||||
now nowFunc
|
||||
now NowFunc
|
||||
|
||||
targetEncAlg crypto.EncryptionAlgorithm
|
||||
targetEncAlg crypto.EncryptionAlgorithm
|
||||
activeSigningKey GetActiveSigningWebKey
|
||||
}
|
||||
|
||||
// Timeout implements the Timeout-function of [river.Worker].
|
||||
@@ -45,7 +46,7 @@ func (w *Worker) Work(ctx context.Context, job *river.Job[*exec_repo.Request]) e
|
||||
return river.JobCancel(fmt.Errorf("unable to unmarshal targets because %w", err))
|
||||
}
|
||||
|
||||
_, err = CallTargets(ctx, targets, exec_repo.ContextInfoFromRequest(job.Args), w.targetEncAlg)
|
||||
_, err = CallTargets(ctx, targets, exec_repo.ContextInfoFromRequest(job.Args), w.targetEncAlg, w.activeSigningKey)
|
||||
if err != nil {
|
||||
// If there is an error returned from the targets, it means that the execution was interrupted
|
||||
return river.JobCancel(fmt.Errorf("interruption during call of targets because %w", err))
|
||||
@@ -53,8 +54,8 @@ func (w *Worker) Work(ctx context.Context, job *river.Job[*exec_repo.Request]) e
|
||||
return nil
|
||||
}
|
||||
|
||||
// nowFunc makes [time.Now] mockable
|
||||
type nowFunc func() time.Time
|
||||
// NowFunc makes [time.Now] mockable
|
||||
type NowFunc func() time.Time
|
||||
|
||||
type WorkerConfig struct {
|
||||
Workers uint8
|
||||
@@ -65,11 +66,14 @@ type WorkerConfig struct {
|
||||
func NewWorker(
|
||||
config WorkerConfig,
|
||||
targetEncAlg crypto.EncryptionAlgorithm,
|
||||
activeSigningKey GetActiveSigningWebKey,
|
||||
now NowFunc,
|
||||
) *Worker {
|
||||
return &Worker{
|
||||
config: config,
|
||||
now: time.Now,
|
||||
targetEncAlg: targetEncAlg,
|
||||
config: config,
|
||||
now: now,
|
||||
targetEncAlg: targetEncAlg,
|
||||
activeSigningKey: activeSigningKey,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user