João Manolo
João Manolo

Reputation: 245

Spring Security with Multi-Tenant Architecture

I wonder if anyone has worked with Spring Security with a Multi-Tenant architecture.

I'm having a little difficulty performing the implementation and if possible would like to study some examples.

Best Regards

Upvotes: 4

Views: 3214

Answers (1)

In a multitenant application the authentication and authorization will need to capture the tenant details. So you need to have a third tenant details along with username and password in the request. You can have a custom implementation of UserDetailsService that loads the tenant details given a web request. You need to store the UserDetails loaded in a your own implementation of UserDetails. This will take care of authentication.

You will need to do some code to use the tenant token for authorization. Depending on the type of Autorization(Database/JaaS/OAuth/Spring Security based), you need to enhance that module and feed in your tenant details to use tenant.

Upvotes: 3

Related Questions