GithubHelp home page GithubHelp logo

bridgit's Introduction

bridgit

npm version Build Status Coverage Status

bridgit is a proxy server intend to forward http request to a server with authentication.

Support different authentication protocol. (hawk for now)

Installation

npm install -g bridgit

Commands

hawk

Simply use follow command to start the proxy server for hawk authentication.

bridgit hawk

Initially, the proxy server would intercept request from http://127.0.0.1:3000, encrypt the request with hawk, add the authentication artifact in request header as Authorization, and foward it to the same uri at http://127.0.0.1:8000.

So you can call your RESTful API at http://127.0.0.1:3000/your_api_uri now.

There are several options you can use to customize the proxy server:

bridgit hawk
    [-o, --origin=] # origin to forward
    [-p, --port=] # server port for bridgit to listen on
    [-P, --prefix=] # auth header prefix
    [-i, --id=] # hawk credentials id
    [-k, --key=] # hawk crendentials key
    [-a, --algorithm=] # hawk algorithm
    [-E, --encrypt-payload=] # should include payload when encrypt
    [-c, --config=] # With a specified config file path

You can also use bridgit hawk --help to view available options.

Here are some usage examples:

Use with options

bridgit hawk -i your_id -k your_key -o http://www.google.com

Will start hawk server with your_id and your_key, then proxy request to http://www.google.com.

Use with config file

bridgit hawk -c ~/config.json

Will load ~/config.json as your configuration, and keep global config as defaults.

NOTE: the config file you are using is considered in JSON format, please ensure that.

config

From 1.1.0, default configuration file will be generated under your $HOME directory, named .bridgit.json.

set/get global configurations

bridgit config set <key> <value> or bridgit config get <key>

Here key can be any support option in proxy server command (like hawk).

bridgit config set id your_id # store your_id as id in config file
bridgit config set port 4000 # store 4000 as port in config file
bridgit config get port # print current port config
bridgit config get # print all key-values in config file

NOTE: You should only use fullname for options to set config, shortland name will not take effect.

PS: The options' priority is higher than config file. For example:

bridgit config set id id_config
bridgit hawk --id=id_option

Will result in proxy server using id_options as hawk id.

generate an empty config file

bridgit config new ~/your_config.json

Will create a new empty config file @~/your_config.json.

Todo

  • Test cases coverage
  • Support OAuth2

bridgit's People

Contributors

jkzing avatar lki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

lxkaka

bridgit's Issues

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.