Coder Social home page Coder Social logo

webapi's Introduction

WebApi

MD5签名的WebApi框架

1、统一的返回格式

2、全局的错误日志处理

3、请求内容经过MD5加密处理。其中加密信息存放在HttpHeader里。请参考SignatureHeader类。

  appid为接口授权访问的第三方应用ID,同时每个ID对应一个密钥。这里是写死的,可根据需要从数据库或配置文件读取。
  timestamp是一个时间戳,表示当前请求的过期时间。
  nonce是个随机数,增加密码复杂度。
  signature是把请“求参数+应用id+时间戳+随机数”的顺序组成字符串进行MD5加密后的一个签名字符串。

4、每一次请求生成的签名都会存放在redis缓存中,缓存过期时间和请求过期时间一致。目的是防止攻击者截获请求后进行反复请求。可根据需要修改允许重复请求的次数。

webapi's People

Contributors

wcivy avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.