Skip to content

Commit

Permalink
Fix error checks during certificatePath reading and parsing in azuread
Browse files Browse the repository at this point in the history
  • Loading branch information
jegorbunov authored Nov 25, 2024
1 parent 573423d commit 0850e76
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions azuread/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down

0 comments on commit 0850e76

Please sign in to comment.