Suppose we have a number of (stateless, HTTP-based) (micro)services and a bunch of "daemons", which do all kinds of background processing by actually using said services.
Now, I want to have a way for services and daemons to be able to mutually authenticate and authorize. For example, a daemon that performs full-text indexing of Orders needs:
- Read-only access to the Orders, Customers (which itself needs read-only access to Companies service) and Inventory services
- Read and write access to the OrdersSearch service in order to be able to update the full-text index.
There are also applications, which operate "on behalf" of the user. For example, Inventory web app needs read and write access to the Inventory service, but the Inventory service itself needs to verify permissions of the user operating the application.
All that said, how do I achieve what I just described? I'd prefer not to use gigantic enterprisey frameworks or standards. From what I've read, Two-Legged OAuth2 is what I need, but I'm not exactly sure.
I was thinkinking of establishing an Authorization service which will be used to answer questions like "Hey, I'm Inventory service. What permissions the Customer service that is calling me right now has for me?", but that has two major weak with distributing shared secrets.