fix: support pkix public keys in oidc

This commit is contained in:
Stavros
2026-03-08 11:38:58 +02:00
parent f80be1ca61
commit e3bd834b85

View File

@@ -204,11 +204,22 @@ func (service *OIDCService) Init() error {
if block == nil {
return errors.New("failed to decode public key")
}
publicKey, err := x509.ParsePKCS1PublicKey(block.Bytes)
if err != nil {
return err
switch block.Type {
case "RSA PRIVATE KEY":
publicKey, err := x509.ParsePKCS1PublicKey(block.Bytes)
if err != nil {
return err
}
service.publicKey = publicKey
case "PUBLIC KEY":
publicKey, err := x509.ParsePKIXPublicKey(block.Bytes)
if err != nil {
return err
}
service.publicKey = publicKey.(crypto.PublicKey)
default:
return errors.New("unsupported public key type")
}
service.publicKey = publicKey
}
// We will reorganize the client into a map with the client ID as the key