| | |
| | | |
| | | import cc.mrbird.febs.common.contants.AppContants; |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.utils.LoginUserUtil; |
| | | import cc.mrbird.febs.common.utils.RedisUtils; |
| | | import cc.mrbird.febs.common.utils.SpringContextUtil; |
| | | import cc.mrbird.febs.dapp.entity.DappMemberEntity; |
| | |
| | | String headAddress = request.getHeader("address"); |
| | | String key = request.getHeader("key"); |
| | | String path = request.getServletPath().replace("/dapi", ""); |
| | | log.info("进入拦截:{}, {}", headAddress, path); |
| | | log.info("进入拦截:{}, {}, {}", headAddress, path, key); |
| | | |
| | | String chain = request.getHeader("chain"); |
| | | if (StrUtil.isBlank(headAddress) || StrUtil.isBlank(key)) { |
| | |
| | | } |
| | | String sign = (String) signObj; |
| | | |
| | | String calKey = Hash.sha3(sign + path + headAddress).replace("0x", ""); |
| | | String calKey = LoginUserUtil.sha3(sign + path + headAddress).replace("0x", ""); |
| | | if (!calKey.equals(key)) { |
| | | responseUnAuth(response); |
| | | return false; |
| | |
| | | response.setContentType("application/json; charset=utf-8"); |
| | | response.getWriter().write(new ObjectMapper().writeValueAsString(new FebsResponse().code(HttpStatus.UNAUTHORIZED))); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | String headAddress = "0x971c09aa9735eb98459b17ec8b48932d24cbb931"; |
| | | String path = "/member/walletInfo"; |
| | | String sign = "0x1fd3f82895ca4615daa10ec245d628ca230358e08423df71c8f6c8d3d4163520"; |
| | | // System.out.println(Hash.sha3(sign + path + headAddress)); |
| | | } |
| | | } |