samedi 17 octobre 2020

Spring Boot Website : How to manage User Login Session through microservices?

I would like to create a website split by multiple Web Apps in Spring Boot. Each Web App must be independent, with the exception that I would like to centralize the login management and keep Users connected through every Apps.

Example :

  • App1 : Must be public
  • App2 : User must be authenticated
  • App3 : User must be authenticated

I would like If a user goes to the App2, the website ask him to login. If he goes after that to the App3, I don't want the website asks him to login again.

My first idea was to share Login Sessions between micro-services, but I have read that it' not a good way. Create a Gateway seems the best practice.

So I tried to use these dependencies :

  • For URL redirection : Spring Cloud
  • For User authentication : Spring Security

Spring Security seems not compatible with Spring Cloud so I haven't figured out how to redirect requests and to check user authentication at the same time.

If anybody could help me please or has an easy sample to show me, I would be grateful :)

Thanks

Aucun commentaire:

Enregistrer un commentaire