feat: support PKCS#8 (#623)

This commit is contained in:
Livio Spring 2024-07-09 15:55:50 +02:00 committed by GitHub
parent fc6716bf22
commit e5a428d4be
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 134 additions and 37 deletions

View file

@ -9,6 +9,7 @@ import (
"golang.org/x/oauth2"
"github.com/muhlemmer/gu"
"github.com/zitadel/oidc/v3/pkg/crypto"
)
@ -344,12 +345,12 @@ func AppendClientIDToAudience(clientID string, audience []string) []string {
}
func GenerateJWTProfileToken(assertion *JWTProfileAssertionClaims) (string, error) {
privateKey, err := crypto.BytesToPrivateKey(assertion.PrivateKey)
privateKey, algorithm, err := crypto.BytesToPrivateKey(assertion.PrivateKey)
if err != nil {
return "", err
}
key := jose.SigningKey{
Algorithm: jose.RS256,
Algorithm: algorithm,
Key: &jose.JSONWebKey{Key: privateKey, KeyID: assertion.PrivateKeyID},
}
signer, err := jose.NewSigner(key, &jose.SignerOptions{})