himanshu
himanshu

Reputation: 144

Multitenant SAAS Application Development

I have developed a java web application using java, spring webmvc and hibernate. right now it can be used by single organization. I want to convert it to multitenant SaaS application.

I was not able to find material where I can see any example how to convert single tenant application to multi tenant or sample of multitenant application from scratch.

Any help is great.

Upvotes: 2

Views: 3174

Answers (3)

Youssouf Maiga
Youssouf Maiga

Reputation: 7831

Here are a good article for multitenancy Dynamic Multi Tenancy with Spring Boot, Hibernate implementing multitenancy in different ways :

  • Database per Tenant pattern
  • Schema per Tenant pattern
  • Shared database with Discriminator Column pattern using Hibernate Filters
  • Shared database with Discriminator Column pattern using Postgres Row Level

You will face the following problematics :

  • Configuration values shared OR tenant specific

  • How to identify a tenant : base on URL, base on query param, based on HEADER, ... : for a request, you can imagine a ThreadLocal or a InheritableThreadLocal to keep the current tenant information.

  • Data isolation : shared schema, a database per tenant, a schema per tenant

  • Authentication/Authorization : Same source ? If you have a tool like Keycloak, it can be a realm per tenant

Upvotes: 0

PHP Developer
PHP Developer

Reputation: 81

It is simple. Only you need to consider few things:

  1. Authenticate and Identify the Tenant
  2. Store the Tenant Identity in SESSION.
  3. In ALL database tables, keep the TENANT ID. This helps to retrieve data easily.
  4. Pass the TENANT ID to retrieve the data of each Tenant.

See the Blog SaaS Multi-Tenant application development

Upvotes: 0

Joel Hudon
Joel Hudon

Reputation: 3215

Article by Steve Ebersole on Multi-tenancy in Hibernate

Article on how to do it in MySQL 5 Multi-Tenant Strategy for SaaS using MySQL5

From Ibm Securing a multitenant SaaS application with Spring Security, Spring MVC and Apache directory.

SaaS Security PoC - Example Application server

From Wikipedia See Multitenancy

Upvotes: 7

Related Questions