All Projects → restran → Fomalhaut

restran / Fomalhaut

Licence: mit
🚀 A Simple API Gateway for Building Security and Flexible Microservices.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Fomalhaut

Capricornus Cloud
Capricornus Cloud provides tools for developers to quickly build distributed systems.
Stars: ✭ 15 (-94.49%)
Mutual labels:  microservice, api-gateway
Up
Up focuses on deploying "vanilla" HTTP servers so there's nothing new to learn, just develop with your favorite existing frameworks such as Express, Koa, Django, Golang net/http or others.
Stars: ✭ 8,439 (+3002.57%)
Mutual labels:  microservice, api-gateway
Kong
🦍 The Cloud-Native API Gateway
Stars: ✭ 30,838 (+11237.5%)
Mutual labels:  microservice, api-gateway
Krakend
Ultra performant API Gateway with middlewares. A project hosted at The Linux Foundation
Stars: ✭ 4,752 (+1647.06%)
Mutual labels:  microservice, api-gateway
Express Gateway
A microservices API Gateway built on top of Express.js
Stars: ✭ 2,583 (+849.63%)
Mutual labels:  microservice, api-gateway
Awesome Ocelot
A curated list of awesome ocelot books, courses, trainings, conference talks, blogs and most inspiring open source contributors
Stars: ✭ 386 (+41.91%)
Mutual labels:  microservice, api-gateway
Altair
Lightweight and Robust API Gateway written in Go
Stars: ✭ 34 (-87.5%)
Mutual labels:  microservice, api-gateway
Aegis
Serverless Golang deploy tool and framework for AWS Lambda
Stars: ✭ 277 (+1.84%)
Mutual labels:  microservice, api-gateway
Tenso
Tenso is an HTTP REST API framework
Stars: ✭ 167 (-38.6%)
Mutual labels:  microservice, api-gateway
Tree Gateway
This is a full featured and free API Gateway
Stars: ✭ 160 (-41.18%)
Mutual labels:  microservice, api-gateway
Kong Docs Cn
微服务 Api 网关 Kong 最新文档中文版
Stars: ✭ 371 (+36.4%)
Mutual labels:  microservice, api-gateway
api-gateway
Api Gateway for a microservices deployment
Stars: ✭ 31 (-88.6%)
Mutual labels:  microservice, api-gateway
Apioak
Full Lifecycle Management API Gateway.
Stars: ✭ 335 (+23.16%)
Mutual labels:  microservice, api-gateway
Microservices
Microservices from Design to Deployment 中文版 《微服务:从设计到部署》
Stars: ✭ 4,637 (+1604.78%)
Mutual labels:  microservice, api-gateway
Ambassador
open source Kubernetes-native API gateway for microservices built on the Envoy Proxy
Stars: ✭ 3,583 (+1217.28%)
Mutual labels:  microservice, api-gateway
Fusio
Open source API management platform
Stars: ✭ 946 (+247.79%)
Mutual labels:  microservice, api-gateway
Dubbo Go Pixiu
Based on the proxy gateway service of dubbo-go, it solves the problem that the external protocol calls the internal Dubbo cluster. At present, it supports HTTP and gRPC[developing].
Stars: ✭ 124 (-54.41%)
Mutual labels:  microservice, api-gateway
Krakend Ce
KrakenD Community Edition. Make your binary of KrakenD API Gateway
Stars: ✭ 245 (-9.93%)
Mutual labels:  microservice, api-gateway
Manba
HTTP API Gateway
Stars: ✭ 3,000 (+1002.94%)
Mutual labels:  microservice, api-gateway
graphcool-gateway-apollo-engine-demo
This demo demonstrates using Apollo Engine with the Graphcool API Gateway pattern
Stars: ✭ 26 (-90.44%)
Mutual labels:  api-gateway

Fomalhaut

travis-ci Coverage Status

fomalhaut is an api gateway acts as the frontend and api router for numerous backend json api servers.

This project is still in development, api may change anytime. If you want to use it, fix what you need.

API is connected to the App and the server database of the bridges, in the App and various API after for these API management and protection brings a series of problems.For example:

  1. How to protect the API from unauthorized access, only by the App initiates normal request?
  2. How to control a different App for many API access permissions?
  3. API access how to log how to view it?

Thus, it is with fomalhaut this project.

Similar items

The environment and dependencies

Supported Python versions: 2.7, 3.3, 3.4, 3.5, 3.6 pypy, pypy3

You need to install Redis first, the corresponding dependency package can be installed by the following command:

pip install -r requirements.txt
## Valid time of access signature, seconds
SIGNATURE_EXPIRE_SECONDS = 3600

HOST = '127.0.0.1'
PORT = 6500

# Is the debug mode
DEBUG = False

# Redis configuration
REDIS_HOST = '127.0.0.1'
REDIS_PORT = 6379
REDIS_DB = 0
REDIS_PASSWORD = 'your_password'

Run

python -m fomalhaut.runserver --port=6500

Related projects

  1. api-gateway-dashboard Web Console for API Gateway
  2. api-python-client Python version of API Client

Design description

This is a gateway to the JSON API, which actually works regardless of what is being transferred behind the protected API, except that the gateway will return an error message to the JSON data if something goes wrong. In the design of the torngas middleware mode. Currently only the GET and POST methods are supported.

img.png

HMAC signature

As with most cloud applications, each Client will be assigned a pair of access_key and secret_key.access_key is used to uniquely identify the Client,secret_key is used to perform HMAC signature and AES encryption.Both the URL of the API request and the Body data are signed by secret_key, and the signature of the data is verified bidirectionally to ensure that the request and the returned data are not tampered with.The signature method uses the HMAC-SHA256.

Special status codes

In order to distinguish the gateway level when there is an error in the implementation of the return data, or behind the real API to provide services to return data, define a special status code 949, if the status code is 949, then the gateway returns.

AES encryption

Although HTTPS is popular in most sites, but if you still can only use HTTP, or there is a middleman attack, there is a risk of data content leakage,thus providing AES encryption function, you can transfer data URL, Headers, Body are encrypted, AES encryption is optional.

Login verification

There are cases where some APIs need to be logged in before they can be accessed, and others do not.fomalhaut has built-in Auth Endpoint (endpoint_name: auth, version: v1) and includes three APIs:

  1. /auth/v1/login/ Login
  2. /auth/v1/token/refresh/ get new access_token with `refresh_token'
  3. /auth/v1/token/alive/ check access_token is valid
  4. /account/v1/logout/ logout
  5. /account/v1/password/change/ Change Password

For APIs that require login, you need to first access /auth/v1/login/ to get access_token, the data returned is as follows:

{
    "code": 200,
    "msg": "",
    "data": {
        "access_token": "abcd",
        "refersh_token": "efgh",
        "expires_in": 168000,
        "user_info": {
        
        }
    }
}
  • expires_in: access_token will expire after many seconds
  • refresh_token: when access_token expires, it is used to get the new access_token
  • user_info: user information returned by the Auth API

/auth/v1/login/ API will check whether the submitted login information is correct according to the configured Auth API, if the login is correct Auth API returns the user information.

/auth/v1/token/refresh/API used to fetch new access_token, submitted data:

{
    "refersh_token": "efgh"
}

Later access requires login to access the API in the url with access_token, for example:

http://api.example.com/api-name/v1/?access_token=abcd

API Gateway will use this access_token to verify the validity of the access_token in redis when accessing the APIs that need to be logged in, and obtain the user's information.The user information is then stored in Headers and passed to the backend API with X-User-Json.The data stored in this Header is base64 encoded data of the JSON string of user_info.

Deploy and use

The built-in Endpoint needs to be configured in the console api-gateway-dashboard

Access log storage

To speed things up, the access logs generated by fomalhaut are temporarily stored in the list in Redis, and a Celery scheduled task is configured in the api-gateway-dashboard project that automatically migrates the access logs to MongoDB.Therefore, these Celery tasks must be run at the same time, in order to ensure the normal operation of fomalhaut.

For more information about how to run these Celery background tasks, see [api-gateway-dashboard] (https://github.com/restran/api-gateway-dashboard) of the relevant documents.

TODO

  • [x] login check, check access_token
  • [x] built-in login, logout and update access_token API
  • [ ] Single sign-on, login in one place, old access_token and refresh_token to be invalidated
  • [x] access to the log store for requesting full content for size limits
  • [x] configuration information in-program cache
  • [ ] API monitoring, access exception can mail alarm
  • [ ] Rate-Limiting
  • [ ] api-android-client
  • [ ] api-swift-client
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].