Giter VIP home page Giter VIP logo

aegis's Introduction

Based on Java8 + Spring Boot to create Http Request interception and verification framework 😋

Spend 10 minutes to learn it to do something, it will help you check Http Request parameters.

It can defend replay attack, check parameters are modified(digital signature), check request is timed out

🐾 Quick Start | 🌚 🇨🇳 简体中文


What Is Aegis?

Aegis is a pursuit of simple framework, so that uses the latest technology, intercepts every http request, then checks the parameters, and you can change every check strategy if you wanted. If you like to try something interesting, I believe you will love it. If you think this item is good can star support it 😊

Quick Start

Run with Maven

Create a basic Maven project

<dependency>
    <groupId>com.github.com.erictao2</groupId>
    <artifactId>aegis-api</artifactId>
    <version>1.0.1</version>
</dependency>

You must use Spirng Boot in you porject.

Then add annotation in you Controller or Method, please refer to the documentation for specific annotation usage!

Contents

Aegis Annotation

Now Aegis has 3 annotations for you to use

DefendModify

This annotation will help you verify the signature in the request, if some one modifyed you request parameters, aegis will reject this request.let's see:

@RestController
// You also can use annotation in Controller class
//@DefendModify
public class DemoController {

    @GetMapping("/1")
    //@DefendModify(name ="reqSign", algorithm = "md5", key = "aegis-key")
    @DefendModify
    public String test1(){
        return "test1-demo" ;
    }
}

you URL must like this http://localhost:8080/1?parameterOne=oneoneone&reqSign=f4da2ed1dca4bfd481d83cfb89f12ab6 or include these parameters in request body(JSON)

In the URL reqSign = (Use some algorithm encryption for others paramets, default is MD5 )

DefendTimeout

This annotation will help you verify request is timed out.let's see:

@RestController
// You also can use annotation in Controller class
//@DefendTimeout
public class DemoController {

    @GetMapping("/2")
    //@DefendTimeout(name ="timestamp", timeout = 1000, timeUnit = {TimeUnit.MILLISECONDS})
    @DefendTimeout
    public String test2(){
        return "test2-demo" ;
    }
}

you URL must like this http://localhost:8080/2?timestamp=1550653175000 or include these parameters in request body(JSON)

DefendReplay

This annotation will help you defend replay attack.let's see:

@RestController
// You also can use annotation in Controller class
//@DefendReplay
public class DemoController {
    @GetMapping("/3")
    //@DefendReplay(name = "reqNo", prefix = "aegisReqNo", timeout = 1000 , timeUnit = {TimeUnit.MILLISECONDS})
    @DefendReplay
    public String test3(){
        return "test3-demo" ;
    }


}

you URLmust like this http://localhost:8080/3?ReqNo=ds1&timestamp=1533205566000 or include these parameters in request body(JSON)

When you send a request with parameter of reqNo, and Other request already send same reqNo, if the time difference(timestamp) between the two requests is less than the set time(timeout in the annotation), last request will be rejected.

Contact

Licenses

Please see Apache License

aegis's People

Contributors

erictao2 avatar

Watchers

 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.