Reputation: 21
I am new in the field of microservices.
So the question I am asking may seem funny.
In monolithic architectures, there is table called Sections
, which determine the relationship of this table with the user table of permissions and user access.
Now, as we know, in the microservice architecture, each service is related to a one table.
Suppose microservices are implemented like this: there is a simple gateway service and a sections service (as in monolithic architecture).
How can these two services ensure that requests are sent correctly from their peer? Because no confirmation has been applied yet?! If we use JWT tokens, can any service edit this token? Because we want to add the result to the token payload in each service!!! And how is this?
Upvotes: 0
Views: 148
Reputation: 17485
Now, as we know, in the microservice architecture, each service is related to a one table
This is completely wrong understanding. Microservice does not mean that It is only related to one table.
Main focus on Microservice is autonomous and decoupled from other services.
For example if you are managing users then you can have UserService. Now in order to create user and store user information if it is required 2 table or 3 table it does matter.
Along with that you also want one another thing that service map user to role so we can say that RBAC service or authorization service. Now to implement authorization this service need Role, Permission, RolePermissions, UserRole etc. So all this can be part of one service. Now at this point Authorization service does not needs to know everything that belong to user service and it only need UserId and its status.
Now when any user created in UserService, It publish message that UserCreated and then AuthorizationService will consume that message and create that user in Authorization service with only required information.
Upvotes: 1