From 0850e76aff122d4d4d596e0b6db8a2248998eee1 Mon Sep 17 00:00:00 2001 From: "Jegor G." <125032988+jegorbunov@users.noreply.github.com> Date: Mon, 25 Nov 2024 20:23:28 +0200 Subject: [PATCH] Fix error checks during certificatePath reading and parsing in azuread --- azuread/configuration.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azuread/configuration.go b/azuread/configuration.go index 8c274a15..7876ae03 100644 --- a/azuread/configuration.go +++ b/azuread/configuration.go @@ -184,11 +184,11 @@ func (p *azureFedAuthConfig) provideActiveDirectoryToken(ctx context.Context, se case p.certificatePath != "": var certData []byte certData, err = os.ReadFile(p.certificatePath) - if err != nil { + if err == nil { var certs []*x509.Certificate var key crypto.PrivateKey certs, key, err = azidentity.ParseCertificates(certData, []byte(p.clientSecret)) - if err != nil { + if err == nil { cred, err = azidentity.NewClientCertificateCredential(tenant, p.clientID, certs, key, nil) } }