2 Hello World microservices security
This chapter covers
- Developing a microservice in Spring Boot/Java, running and testing it with curl
- Securing a microservice at the edge with OAuth 2.0
- Enforcing authorization at the service-level with OAuth 2.0 scopes
When you follow microservices architecture, you build the applications as a collection of smaller/modular services or components. A system by itself or a system on behalf of a human user or another system can invoke a microservice. In all three cases we need to properly authenticate and authorize all the requests that reach the microservice. A microservice may also consume one or more other microservices in order to cater a request. In such cases it is also necessary to propagate user context (from upstream services or client applications) to downstream microservices. In this chapter, we explain how the validation of the incoming requests happens and later in the book in chapter 3, we discuss how to propagate the user context to downstream microservices. The focus of this chapter is to get you started with a quite straightforward deployment. The design of the samples presented in this chapter is far from a production deployment. As we proceed in the book, we explain how to fill the gaps and in step by step to build a production grade microservices security design.