-
Notifications
You must be signed in to change notification settings - Fork 878
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor NewClientCertificateCredential #15683
Conversation
Not too familiar with identity. Just some minor comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some comments, looks good to my untrained eye.
@@ -43,7 +43,7 @@ func createClientAssertionJWT(clientID string, audience string, cert *certConten | |||
X5t: base64.RawURLEncoding.EncodeToString(cert.fp), | |||
} | |||
if sendCertificateChain { | |||
headerData.X5c = cert.publicCertificates | |||
headerData.X5c = cert.x5c |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do miss the more descriptive name. I know there's reasons, but still. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, one little nit with an error message.
Co-authored-by: Richard Park <[email protected]>
This PR refactors NewClientCertificateCredential to take a slice of certificates and a private key instead of raw certificate data, and adds a helper method to simplify acquiring those in common cases. My motivation is primarily to avoid future problems around encrypted keys. There are many ways to encrypt a certificate's key, and the standard library doesn't support all of them. For example, its method for decrypting legacy PEM encryption is deprecated. Taking only raw cert data may oblige us to support such encryption schemes by writing our own decryption code or adding an external dependency, and asking customers to adopt an ugly workaround in the meantime.
before
after
LoadCerts
handles common cases and can become more comprehensive over time; its capabilities are an implementation detail.