Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MicroService Architecture Pattern #3

Open
othreecodes opened this issue Oct 27, 2018 · 1 comment
Open

MicroService Architecture Pattern #3

othreecodes opened this issue Oct 27, 2018 · 1 comment

Comments

@othreecodes
Copy link
Member

Do authentication globally, and authorization in every microservice

pros

  • global authentication is easier to manage/control
  • fine grained object permissions are possible

cons

  • slightly more code in the micro services
  • needs some effort to have an overview what you can do with which permission
@othreecodes
Copy link
Member Author

Approach 2: Global Authentication, Service Authorization
This approach is likely the best fit for most people. Keep the clunky authentication layer at your front-end global services layer. Then, when the front-end calls the back-end microservices to do an actual job, it can provide a security context. This allows the microservices to not care how someone is authenticated, but is still able to maintain the business logic decision making of what actions this security context is allowed to perform.

Let us take an analogous model of logging into your desktop computer — Windows, Mac, Linux does not matter. You enter your credentials and a login process authenticates you and then creates a desktop process assigned to your user context. All applications launched from that point on are associated with your user context and all file system, network, etc. access is authorized using that single user context. Your applications and the kernel do not care how you obtained that security context, but they will sure as heck keep you within the boundaries of what you are allowed to access.

This is essentially what I meant by saying “I do not believe user-level authorization stops at the gateway.” The authentication can stop, but as calls are made into the back-end microservices, a security or user context should come along with any calls such that the microservices can enact their own business logic of what the caller is allowed to do.

Note: This requires that you have strong authentication and authorization between your services (by using something like Istio and its mTLS). You must be certain that when you get a request to do something in your microservice with a given security context that the security context can be trusted. If any service within your microservices mesh is able to call you and provide a faked security context… That is just a recipe for disaster.

https://codeburst.io/i-believe-it-really-depends-on-your-environment-and-how-well-protected-the-different-pieces-are-7919bfa6bc86

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant