-
Notifications
You must be signed in to change notification settings - Fork 254
增加自动更新证书功能 #3
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
增加自动更新证书功能 #3
Conversation
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.
可以可以,多谢 @EliaszZz
verifier = new AutoUpdateCertificatesVerifier( | ||
listCertificates, | ||
new WechatPay2Credentials(mchId, new PrivateKeySigner(mchSerialNo, merchantPrivateKey)), | ||
apiV3Key.getBytes("utf-8"), 0); |
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.
传0?也建议定义一组枚举常量作为常见的选项
private void autoUpdateCert() throws IOException, GeneralSecurityException { | ||
CloseableHttpClient httpClient = WechatPayHttpClientBuilder.create() | ||
.withCredentials(credentials) | ||
.withValidator(new WechatPay2Validator(new CertificatesVerifier(this.certList))) |
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.
这样商户开发者还是需要更新本地证书,自动更新只是运行时
public AutoUpdateCertificatesVerifier(List<X509Certificate> certList, Credentials credentials, | ||
byte[] apiV3Key) { | ||
//默认证书更新时间为1小时 | ||
this(certList, credentials, apiV3Key, 60); |
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.
no magic number plz
README.md
Outdated
@@ -95,6 +95,33 @@ WechatPayHttpClientBuilder builder = WechatPayHttpClientBuilder.create() | |||
.withWechatpay(wechatpayCertificates); | |||
``` | |||
|
|||
### 自动更新证书功能 |
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.
有一些注意事项需要补充说明好
增加AutoUpdateCertificatesVerifier类,在原CertificatesVerifier基础上增加证书自动更新功能