Open cgcgbcbc opened 9 years ago
koa's response and request objects are not compatible with node's native ones, so that koa may not be a choice unless abandon node-http-proxy.
Another difficulty is that if the resources are not under user namespace, e.g.
/user/someuser/posts/xxx
/posts/xxx
For authentication for these requests, there are two methods to use:
X-xxx-user
, pass the request to the backend.Another approach is add complex logic in the gateway. This requires we implements mu-gateway as a library. This may be helpful if we want to add A&A for legacy systems without A&A, for example, the open source docker registry, consul, and so on. Then the benefits of this project is that it will provided a single reusable passport system across all the services.
The third method is implement database plugin for common databases like mysql, mongo or postgre, and response for A&A query.
The function we need can be decoupled as three independent micro-service:
authentication service:
Authenticate who the user is, an oAuth2 service may work.
How does this architecture work together with other service? Typically we only need to solve CRUD.
Use koa or express for handling routes, use es6 rest syntax.
Use middleware passport and passport-local-mongoose for fetching user info.