33import me .chanjar .weixin .common .bean .WxAccessToken ;
44import me .chanjar .weixin .common .util .ToStringUtils ;
55import me .chanjar .weixin .common .util .http .ApacheHttpClientBuilder ;
6- import org .apache .http .ssl .SSLContexts ;
76
8- import javax .net .ssl .SSLContext ;
97import java .io .File ;
10- import java .io .FileInputStream ;
11- import java .security .KeyStore ;
128import java .util .concurrent .locks .Lock ;
139import java .util .concurrent .locks .ReentrantLock ;
1410
2016public class WxMpInMemoryConfigStorage implements WxMpConfigStorage {
2117
2218 protected volatile String appId ;
23- protected volatile String subAppId ;
24- protected volatile String subMchId ;
2519 protected volatile String secret ;
26- protected volatile String partnerId ;
27- protected volatile String partnerKey ;
28- protected volatile String notifyURL ;
29- protected volatile String tradeType ;
3020 protected volatile String token ;
3121 protected volatile String accessToken ;
3222 protected volatile String aesKey ;
@@ -54,8 +44,6 @@ public class WxMpInMemoryConfigStorage implements WxMpConfigStorage {
5444 */
5545 protected volatile File tmpDirFile ;
5646
57- protected volatile SSLContext sslContext ;
58-
5947 protected volatile ApacheHttpClientBuilder apacheHttpClientBuilder ;
6048
6149 @ Override
@@ -257,41 +245,6 @@ public String toString() {
257245 return ToStringUtils .toSimpleString (this );
258246 }
259247
260- @ Override
261- public String getPartnerId () {
262- return this .partnerId ;
263- }
264-
265- public void setPartnerId (String partnerId ) {
266- this .partnerId = partnerId ;
267- }
268-
269- @ Override
270- public String getPartnerKey () {
271- return this .partnerKey ;
272- }
273-
274- public void setPartnerKey (String partnerKey ) {
275- this .partnerKey = partnerKey ;
276- }
277-
278-
279- public String getNotifyURL () {
280- return notifyURL ;
281- }
282-
283- public void setNotifyURL (String notifyURL ) {
284- this .notifyURL = notifyURL ;
285- }
286-
287- public String getTradeType () {
288- return tradeType ;
289- }
290-
291- public void setTradeType (String tradeType ) {
292- this .tradeType = tradeType ;
293- }
294-
295248 @ Override
296249 public File getTmpDirFile () {
297250 return this .tmpDirFile ;
@@ -301,38 +254,6 @@ public void setTmpDirFile(File tmpDirFile) {
301254 this .tmpDirFile = tmpDirFile ;
302255 }
303256
304- @ Override
305- public SSLContext getSslContext () {
306- return this .sslContext ;
307- }
308-
309- @ Override
310- public void setSslContext (SSLContext context ) {
311- this .sslContext = context ;
312- }
313-
314- @ Override
315- public void setSslContextFilePath (String filePath ) {
316- if (null == partnerId ) {
317- throw new IllegalArgumentException ("请设置partnerId的值" );
318- }
319-
320- File file = new File (filePath );
321- if (!file .exists ()) {
322- throw new RuntimeException ("证书文件:【" + file .getPath () + "】不存在!" );
323- }
324-
325- try {
326- FileInputStream inputStream = new FileInputStream (file );
327- KeyStore keystore = KeyStore .getInstance ("PKCS12" );
328- char [] partnerId2charArray = partnerId .toCharArray ();
329- keystore .load (inputStream , partnerId2charArray );
330- this .sslContext = SSLContexts .custom ().loadKeyMaterial (keystore , partnerId2charArray ).build ();
331- } catch (Exception e ) {
332- throw new RuntimeException ("证书文件有问题,请核实!" , e );
333- }
334- }
335-
336257 @ Override
337258 public ApacheHttpClientBuilder getApacheHttpClientBuilder () {
338259 return this .apacheHttpClientBuilder ;
@@ -347,26 +268,4 @@ public boolean autoRefreshToken() {
347268 return true ;
348269 }
349270
350- @ Override
351- public boolean useSandboxForWxPay () {
352- return false ;
353- }
354-
355- @ Override
356- public String getSubAppId () {
357- return subAppId ;
358- }
359-
360- public void setSubAppId (String subAppId ) {
361- this .subAppId = subAppId ;
362- }
363-
364- @ Override
365- public String getSubMchId () {
366- return subMchId ;
367- }
368-
369- public void setSubMchId (String subMchId ) {
370- this .subMchId = subMchId ;
371- }
372271}
0 commit comments