fix
Helius
2022-06-11 035d70437df7b55788b3a1bb5120d43112e82e0c
src/main/java/cc/mrbird/febs/common/interceptor/DappInterceptor.java
@@ -2,6 +2,7 @@
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;
@@ -37,7 +38,7 @@
        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)) {
@@ -54,7 +55,7 @@
        }
        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;
@@ -75,4 +76,11 @@
        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));
    }
}