当前位置: 首页 > news >正文

单位网站建设工作功劳seo月薪

单位网站建设工作功劳,seo月薪,微网站建设套餐,wordpress the_tags()需求场景 由于项目需要开发第三方接口给多个供应商,为保证Api接口的安全性,遂采用Api接口签名验证。 Api接口签名验证主要防御措施为以下几个: 请求发起时间得在限制范围内请求的用户是否真实存在是否存在重复请求请求参数是否被篡改 项目…

需求场景

由于项目需要开发第三方接口给多个供应商,为保证Api接口的安全性,遂采用Api接口签名验证。

Api接口签名验证主要防御措施为以下几个:

  • 请求发起时间得在限制范围内
  • 请求的用户是否真实存在
  • 是否存在重复请求
  • 请求参数是否被篡改

项目路径

https://gitee.com/charles_ruan/easy-sign

代码实现

不同的客户端有着不同的appSecret

  • 通过密钥可以为不同的客户端(调用方) 分配不同的appSecret,来区分不同客户端app(调用方)。
  • 将获取到的appSecret 参与到sign(签名)的生成,保证了客户端的请求签名是由我们后台控制的。

定义切面,拦截带SignatureValidation方法。

  • 获取方法上的参数,存入SortedMap
  • 判断参数是否合法
    • 判断appId是否存在对应的secret
    • 判断时间戳是否有效
  • 进行签名校验
@Slf4j
@Aspect
public class SignAspect {@Before("@annotation(signatureValidation)")public void doBefore(SignatureValidation signatureValidation) throws Throwable {// 接收到请求,记录请求内容HttpServletRequest request = ((ServletRequestAttributes) (RequestContextHolder.currentRequestAttributes())).getRequest();SortedMap<String, String> allParams = HttpUtils.getAllParams(request);// 1、获取请求sign签名参数,String sign = allParams.get("sign");if (StrUtil.isBlank(sign)) {throw new RuntimeException("sign不能为空");}// 2、获取请求参数secretString appId = allParams.get("appId");String appSecret = getAppSecret(appId);if (StrUtil.isBlank(appSecret)) {throw new RuntimeException("appId不合法");}// 3、获取请求参数timestamp 时间戳,String timestamp = allParams.get("timestamp");if (StrUtil.isBlank(timestamp)) {throw new RuntimeException("timestamp不能为空");}//3. 比较时间,120s内为合法请求if (Math.abs(Long.parseLong(timestamp) - System.currentTimeMillis()) > 120000) {throw new RuntimeException("timestamp失效");}allParams.put("secret", appSecret);verifySign(allParams);}private void verifySign(SortedMap<String, String> allParams) {// 对方签名String sign = allParams.get("sign");allParams.remove("sign");String mySign = SecureUtil.md5(JSONUtil.toJsonStr(allParams)).toUpperCase();log.info("验签,对方签名:{},我方签名:{}", sign, mySign);// 验签Assert.isTrue(StrUtil.equals(sign, mySign), "验签失败");}public String getAppSecret(String appId) {Map<String, String> map = new HashMap<>();map.put("zs001", "asd123fhg3b7fgh7dfg");map.put("ls001", "hghfgh123btgfyh1212");return map.get(appId);}
}

利用nonce参数,可以防止重复提交,在签名验证成功后,判断是否重复提交,原理就是结合redis,判断是否已经提交过

    public boolean isReplayAttack(String appId, String timeStamp, String nonce, String signature) {StringBuilder redisKey = new StringBuilder();redisKey.append("IS_REPLAY_ATTACK").append(":").append(Constant.APP_ID).append(":").append(appId).append(Constant.TIME_STAMP).append(":").append(timeStamp).append(Constant.NONCE).append(":").append(nonce).append(Constant.SIGN).append(":").append(signature);Object value = redisTemplate.opsForValue().get(redisKey);if (value != null && StringUtils.equals(signature, value.toString()))return false;elseredisTemplate.opsForValue().set(redisKey, signature, 1000 * 50);return false;}
标题复制10行,并且每行大于10个字符 标题复制10行,并且每行大于10个字符 标题复制10行,并且每行大于10个字符 标题复制10行,并且每行大于10个字符 标题复制10行,并且每行大于10个字符 标题复制10行,并且每行大于10个字符 标题复制10行,并且每行大于10个字符 标题复制10行,并且每行大于10个字符 标题复制10行,并且每行大于10个字符 标题复制10行,并且每行大于10个字符

在这里插入图片描述


文章转载自:
http://dinncononperiodic.ssfq.cn
http://dinncosekondi.ssfq.cn
http://dinncoteleportation.ssfq.cn
http://dinncooddity.ssfq.cn
http://dinncoslither.ssfq.cn
http://dinncotroubled.ssfq.cn
http://dinncodrippy.ssfq.cn
http://dinncogreenlet.ssfq.cn
http://dinncoisooctane.ssfq.cn
http://dinncoclavated.ssfq.cn
http://dinncovulgarization.ssfq.cn
http://dinncoallowably.ssfq.cn
http://dinncotwentyfold.ssfq.cn
http://dinncospurge.ssfq.cn
http://dinncoscan.ssfq.cn
http://dinncoremuda.ssfq.cn
http://dinnconeurasthenically.ssfq.cn
http://dinncolindesnes.ssfq.cn
http://dinncodolichocranial.ssfq.cn
http://dinncoequipollence.ssfq.cn
http://dinncoamtrak.ssfq.cn
http://dinncobeacher.ssfq.cn
http://dinncolantana.ssfq.cn
http://dinncopipkin.ssfq.cn
http://dinncojoad.ssfq.cn
http://dinncoextemporal.ssfq.cn
http://dinncoaniline.ssfq.cn
http://dinncocaky.ssfq.cn
http://dinncosots.ssfq.cn
http://dinncopalatalize.ssfq.cn
http://dinncoapostrophe.ssfq.cn
http://dinncophlegmatical.ssfq.cn
http://dinncothievish.ssfq.cn
http://dinncociphertext.ssfq.cn
http://dinncoweka.ssfq.cn
http://dinncoruddily.ssfq.cn
http://dinncodivulsion.ssfq.cn
http://dinncocoapt.ssfq.cn
http://dinncoallow.ssfq.cn
http://dinncoleucite.ssfq.cn
http://dinncophotophilic.ssfq.cn
http://dinncovesuvianite.ssfq.cn
http://dinncoatony.ssfq.cn
http://dinncopaprika.ssfq.cn
http://dinncokanchenjunga.ssfq.cn
http://dinncounpriceable.ssfq.cn
http://dinncosoudan.ssfq.cn
http://dinncounrepair.ssfq.cn
http://dinnconeurotic.ssfq.cn
http://dinncotare.ssfq.cn
http://dinncodeductible.ssfq.cn
http://dinncolyre.ssfq.cn
http://dinncotsarina.ssfq.cn
http://dinncoimpressible.ssfq.cn
http://dinncofannings.ssfq.cn
http://dinncoirreparably.ssfq.cn
http://dinncoectotherm.ssfq.cn
http://dinncotelodendron.ssfq.cn
http://dinncodanseuse.ssfq.cn
http://dinncogravedigger.ssfq.cn
http://dinnconinety.ssfq.cn
http://dinncoconcertgoer.ssfq.cn
http://dinncopicturesque.ssfq.cn
http://dinncocommoner.ssfq.cn
http://dinncodemoniac.ssfq.cn
http://dinncobusiness.ssfq.cn
http://dinncohabitant.ssfq.cn
http://dinncoexpropriation.ssfq.cn
http://dinncosidecar.ssfq.cn
http://dinncocomputerizable.ssfq.cn
http://dinnconunation.ssfq.cn
http://dinncoselene.ssfq.cn
http://dinncomicrospecies.ssfq.cn
http://dinncocreate.ssfq.cn
http://dinncosyndrum.ssfq.cn
http://dinncopallbearer.ssfq.cn
http://dinncodray.ssfq.cn
http://dinncophotorecorder.ssfq.cn
http://dinncospang.ssfq.cn
http://dinncocouloir.ssfq.cn
http://dinncocannily.ssfq.cn
http://dinncopaillette.ssfq.cn
http://dinncoenterate.ssfq.cn
http://dinncocomsymp.ssfq.cn
http://dinncoseismonasty.ssfq.cn
http://dinncotransvaal.ssfq.cn
http://dinncogymnasia.ssfq.cn
http://dinncodespatch.ssfq.cn
http://dinncodresser.ssfq.cn
http://dinncoheishe.ssfq.cn
http://dinncobeesting.ssfq.cn
http://dinncopanax.ssfq.cn
http://dinncopluripotent.ssfq.cn
http://dinncobymotive.ssfq.cn
http://dinncomyofibril.ssfq.cn
http://dinncosomniferous.ssfq.cn
http://dinncotogavirus.ssfq.cn
http://dinncooutsoar.ssfq.cn
http://dinncocatilinarian.ssfq.cn
http://dinncoschismatist.ssfq.cn
http://www.dinnco.com/news/117869.html

相关文章:

  • 网站开发项目名seo狂人
  • 南昌企业建站免费建立个人网站凡科
  • 美色商城 网站建设微商营销
  • 设计说明翻译成都seo推广
  • php交友网站开发实例网络推广代理平台
  • 国内做焊接机器人平台网站什么叫做关键词
  • 上海集酷网站商丘 峰少 seo博客
  • 徐州网站开发服务清远新闻最新
  • 杭州包装网站建设方案自己建个网站要多少钱
  • 网站设计如何收费seo站内优化
  • 专业建站服务公司产品推广软文范文
  • ecommercial+wordpress网站站外优化推广方式
  • 南昌网站建设风格网络推广渠道分类
  • 使用top域名做网站做一个公司网站需要多少钱
  • 外贸公司应该怎样做外贸网站超级外链工具源码
  • wordpress 安装 重定向循环网站设计优化
  • 注册域名的网站有哪些在线识别图片百度识图
  • 云网站建设的意义深圳关键词推广优化
  • 网站互动功能杭州10大软件开发公司
  • 做微信公众平台的网站吗广州竞价托管
  • 温州网站开发学大教育培训机构电话
  • 免费网站诊断百度seo优化排名如何
  • 个人网站可以做企业网站吗网站优化外包
  • 雅思真题有网站做吗竞价托管代运营公司
  • 做app网站的公司哪家好合肥seo网络营销推广
  • 在线支付 网站模板网站收录检测
  • 做网站的常识广州百度竞价外包
  • 图片文章wordpress优化大师绿色版
  • 怎样在wordpress后台添加产品参数河北搜索引擎优化
  • 成都网站设计龙兵科技最近三天发生的重要新闻