mirror of
https://github.com/zitadel/zitadel.git
synced 2025-03-02 18:11:45 +00:00
fix: ignore undecryptable keys from view (#1528)
This commit is contained in:
parent
a393d549fb
commit
efc90b382c
@ -1,10 +1,12 @@
|
|||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/caos/zitadel/internal/domain"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/caos/logging"
|
||||||
|
|
||||||
"github.com/caos/zitadel/internal/crypto"
|
"github.com/caos/zitadel/internal/crypto"
|
||||||
|
"github.com/caos/zitadel/internal/domain"
|
||||||
"github.com/caos/zitadel/internal/errors"
|
"github.com/caos/zitadel/internal/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -90,15 +92,16 @@ func SigningKeyFromKeyView(key *KeyView, alg crypto.EncryptionAlgorithm) (*Signi
|
|||||||
}
|
}
|
||||||
|
|
||||||
func PublicKeysFromKeyView(keys []*KeyView, alg crypto.EncryptionAlgorithm) ([]*PublicKey, error) {
|
func PublicKeysFromKeyView(keys []*KeyView, alg crypto.EncryptionAlgorithm) ([]*PublicKey, error) {
|
||||||
converted := make([]*PublicKey, len(keys))
|
convertedKeys := make([]*PublicKey, 0, len(keys))
|
||||||
var err error
|
for _, key := range keys {
|
||||||
for i, key := range keys {
|
converted, err := PublicKeyFromKeyView(key, alg)
|
||||||
converted[i], err = PublicKeyFromKeyView(key, alg)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
logging.Log("MODEL-adB3f").WithError(err).Debug("cannot convert to public key") //TODO: change log level to warning when keys can be revoked
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
convertedKeys = append(convertedKeys, converted)
|
||||||
}
|
}
|
||||||
return converted, nil
|
return convertedKeys, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
func PublicKeyFromKeyView(key *KeyView, alg crypto.EncryptionAlgorithm) (*PublicKey, error) {
|
func PublicKeyFromKeyView(key *KeyView, alg crypto.EncryptionAlgorithm) (*PublicKey, error) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user