Coder Social home page Coder Social logo

3scale-haproxy's Introduction

3scale-haproxy

PoC: 3scale HAProxy SPOA for authentication

How to run it?

Start the agent:

go mod vendor
go run main.go

Or you can use the published docker: quay.io/jmprusi/3scale-haproxy:latest

Install HAProxy:

brew install haproxy

Configure your credentials:

vi examples/haproxy.conf

(..)
    tcp-request content set-var(req.service_id) str("1234567")    # <------ Replace with your serviceID
    tcp-request content set-var(req.access_token) str("XXXXXXXXXXXXXXXXXXXXXXXXXXXX")  # <----------- Replace with your accesstoken
    tcp-request content set-var(req.system_url) str("https://yourtenant-admin.3scale.net")  # <-------- Replace with your admin portal direction

    filter spoe engine 3scale-api-authorization config spoe-api-authorization.conf

    http-request deny deny_status 403 unless { var(txn.3scale.authorized) -m int eq 1 }

    http-request set-header Host echo-api.3scale.net   #  <--------- Put your API Backend host here... 
    server echo_api1 echo-api.3scale.net:80 check      #  <--------- And here.
(..)

Run haproxy!

cd examples
haproxy -f haproxy.conf

Test it:

curl http://localhost/  <--- Should fail..
curl http://localhost/?user_key=XXXXXXXXXXXXXXX <------- Test with the proper user_key.

3scale-haproxy's People

Contributors

jmprusi avatar

Stargazers

 avatar

Watchers

 avatar  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.