之前写的登录逻辑
//判断账号密码
enroll = caClient.enroll(walletName, loginForm.getPassword());
Identity user = Identities.newX509Identity(orgEnum.getMspId(), enroll);
wallet.put(walletName, user);
//判断是否有证书,但if不可能为true
if (wallet.get(walletName) == null){
throw new CoinException("Invalid walletName or Password!");
}
现在的登录逻辑
//判断账号密码
enroll = caClient.enroll(walletName, loginForm.getPassword());
//账号密码正确,再判断是否有证书
if (wallet.get(walletName) == null){
Identity user = Identities.newX509Identity(orgEnum.getMspId(), enroll);
wallet.put(walletName, user);
}
每次enroll时,无论账号密码是否改变,得到的Enrollment都会变化,证书文件也会发生改变,导致每次登录的时候都会对账号对应的证书重写。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)