互联网金融系统实现之数据平台交互验证方式

H5调用数据平台验证授信项

 。 (1) mobile : 默认手机号。传入该值合法,页面手机号文本框赋值并不可修改
     (2)  applyNo: 进件号(必填)
     (3) cardId:身份证号
     (4) userName: 用户姓名
     (5)  successDirectUrl: 成功跳转地址(必填)

       String requestIdRes = restTemplate.postForObject(url, null, String.class);
        LOGGER.info("getRequestIdUrl res {}", requestIdRes);
        String requestId = JSONObject.parseObject(requestIdRes).getString("data");
        HashMap<String, Object> map = new HashMap<>();
        map.put("applyNo", requestId);
        map.put("cardId", CommonUtils.decrypt(userIdnoInfo.getIdNo()));
        map.put("mobile", CommonUtils.decrypt(user.getMobile()));
        map.put("userName", userIdnoInfo.getName());
        map.put("token", System.currentTimeMillis());
        map.put("accessToken", MD5Utils.getMD5String(UrlConfig.JWT_SECRET + map.get("token")));
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("custId", user.getToken());
        map.put("relationalParam", jsonObject.toJSONString());
        map.put("color", "blue");
        StringBuilder sb = new StringBuilder();
        sb.append(mobileSuccessdirectUrl).append("/").append(requestId).append("/").append(user.getToken());
        map.put("successDirectUrl", sb.toString());
        LOGGER.info("mobileValid map:{} ", map.toString());
        String token = JwtUtils.sign(map);
        StringBuilder resUrl = new StringBuilder();
        resUrl.append(UrlConfig.MobileCrawler.MOBILE_H5_URL).append("?color=blue&corpId=")
                .append(requestId.substring(0, 3)).append("&token=").append(token);
* 进件号从风控获取,requestid
*token是当前时间戳,最后给数据平台的token是jwt加密后的string串

*accessToken 是密钥和当前时间戳进行md5加密

*JwtUtils是封装的工具栏,具体代码下面有,主要把通用参数放入map

所有参数放入map后,利用jwt把map生产token,发送给数据平台,其实数据平台需要的只是下面几个:

String token = JwtUtils.sign(map);
StringBuilder resUrl = new StringBuilder();
resUrl.append(UrlConfig.MobileCrawler.MOBILE_H5_URL).append("?color=blue&corpId=")
        .append(requestId.substring(0, 3)).append("&token=").append(token);

回头看看数据平台文档:

加密方式

我们会分配一个渠道号(corpId,比如301),每个渠道就相当于一个商户,有自己corpSecret,即密钥,调用的所有步骤都需要加上corpId、token以及accessToken这个参数,accessToken是md5(corpSecret + token)


corpId string
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值