Book Image

Scala Microservices

By : Selvam Palanimalai, Jatin Puri
Book Image

Scala Microservices

By: Selvam Palanimalai, Jatin Puri

Overview of this book

<p>In this book we will learn what it takes to build great applications using Microservices, the pitfalls associated with such a design and the techniques to avoid them. </p><p>We learn to build highly performant applications using Play Framework. You will understand the importance of writing code that is asynchronous and nonblocking and how Play leverages this paradigm for higher throughput. The book introduces Reactive Manifesto and uses Lagom Framework to implement the suggested paradigms. Lagom teaches us to: build applications that are scalable and resilient to failures, and solves problems faced with microservices like service gateway, service discovery, communication and so on. Message Passing is used as a means to achieve resilience and CQRS with Event Sourcing helps us in modelling data for highly interactive applications. </p><p>The book also shares effective development processes for large teams by using good version control workflow, continuous integration and deployment strategies. We introduce Docker containers and Kubernetes orchestrator. Finally, we look at end to end deployment of a set of scala microservices in kubernetes with load balancing, service discovery and rolling deployments. </p><p></p>
Table of Contents (12 chapters)

Security

There are two parts to this:

  • The authentication and authorization of the user accessing the application
  • Authentication of inter-microservices communication

Here is the workflow of the authentication mechanism:

  1. The user logs in with a username and password.
  2. The web-app sends the credentials to the auth-app.
  3. The auth-app verifies the credentials, please refer to these points:
    • If the credentials are invalid, it responds back to the request initiator on the failure
    • If the credentials are valid, it requests the token-manager for a token
  1. The token-manager generates a unique token and provides back. This token can be used by other microservices to verify if the initiator of the request is from a valid source. Please refer to this point:
    • The tokens are also persisted in a database (H2 database in this case) to maintain history
  1. The token is provided back to the web...