Skip to content

增加自动更新证书功能 #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

Merged
merged 15 commits into from
Aug 27, 2019
Merged

增加自动更新证书功能 #3

merged 15 commits into from
Aug 27, 2019

Conversation

z1cheng
Copy link
Contributor

@z1cheng z1cheng commented Aug 22, 2019

增加AutoUpdateCertificatesVerifier类,在原CertificatesVerifier基础上增加证书自动更新功能

Copy link
Contributor

@xy-peng xy-peng left a 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);
Copy link
Contributor

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)))
Copy link
Contributor

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);
Copy link
Contributor

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);
```

### 自动更新证书功能
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

有一些注意事项需要补充说明好

@xy-peng xy-peng merged commit c7deb46 into wechatpay-apiv3:master Aug 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants