User Management module in Microservices Application - microservices

We have created a User Registration microservice that currently only registers the Users, Now we are planning to have the User profile management module. So our question is should we create a new microservice for User Profile management or use the same User Registration microservice.
what is the best practice?
Thanks

Related

Can a microservice contain two entities or each entity should have its own microservice?

I am new to the microservice architecture and I am developing, using Spring Boot and Cloud, an User microservice which role will be to perform basic CRUD on users at the moment. However, each User must have a Role (Admin, Developer, Project Manager) and these roles should have their own table. My question is should Role entity, together with its associated database table, be part of the User microservice ?

Spring Boot, Spring Security - Pass current logged in user details from one micro-service to another micro-service

I am using 2 microservices. One is for UI (Web + API) and another one for the backend service(REST API). And using Feign Client to connect from UI to the backend API.
Now I need to pass the current logged in user details from the Web service to the backend API service.
I am getting the user details using SecurityContextHolder.getContext().getAuthentication().getDetails().
What is a good way to pass the user details? I need user details in all the API endpoints for auditing.
Is it good to pass user details using #RequestParam?

Custom Role Based Authorization in Spring Boot

I am developing a web application where I have React as my Frontend and Spring boot as the Backend REST API. I have authentication mechanism setup where user can login with email and password. My application will be used by a group of people for a company. The admin user will login initially and sends invites to other people in the group with predefined access privileges available in the application. How can I implement this type of role based access in spring boot.
I gone across Spring security for role based access, but I didn't find how to create custom fine grained roles based on our web application. Please someone help just to give me the path I need to go.
P.S: I want to implement the way AWS or other cloud providers implement there IAM roles to assign it to different users in their organization but not as complex but a similar functionality

How to integrate Keycloak user data into app db

I have a spring boot application and a user column in my app db. The problem is now that my user informations are divided up at the spring boot db and the Keycloak db.
I found this older posts where there synced the data manually (redundant on both dbs), isn't there a best practice way, isn't this a standard usecase, I am wondering why there is no information about this?
How to integrate or make use of KeyCloak user database in my application?
Keycloak provider and user storage
I would say that the standard use-case is you connect
Keycloak to your application's database, which contains users' information (keycloak is just a server to authenticate your users).
To be able to connect from Keycloak to your application's database, you need to implement new Service provider interface (User Storage SPI) as mentioned in the documentation.

How to migrate users from user service database to spring boot auth server database?

I am building a micro service bases spring boot application. In order to protect my rest APIs, i have implemented spring boot authorization server to provide oauth2 tokens to users. Currently i have users in master database under the table users. Authorization server is authenticating users from the authorization database under its users table. Do i need to migrate all my users from my master database to authorization server database? or should i call an API to user service and authenticate users?
This depends on your overall architecture, but in General you do not need to migrate users, you can check the permissions of users by calling the API of the service that stores these users.
In my opinion, this is the preferred way to divide microservices into an authentication/authorization microservice and a user information storage microservice, since user information is not related to authentication/authorization and has low connectivity, so you can easily change the authentication/authorization microservice in the future.
But there are also opposite points of view, in favor of combining authentication/authorization microservices and user storage. The main advantage of this approach is the simplicity of managing and supporting a single microservice.

Resources