Oriental Nippon Development
Back to portfolio
Case studyTasukaru

Tasukaru Healthcare: Multi-Tenant Auth from Single-Company Software

Tasukaru’s healthcare platform served one company well. We turned it into multi-tenant SaaS by rebuilding authentication and authorization (identity, tenancy and permissions) without rewriting the product from scratch.

Industry
Healthcare & Social Care
Region
Japan

Outcomes

  • Single-company app productized into multi-tenant SaaS
  • Tenant isolation enforced on every protected request
  • Facility-scoped logins without username collisions

Stack

Ory Kratos · Ory Keto

Written byAbdullah Chaudhary

Tasukaru built healthcare software that their own organization already relied on every day. The workflows were proven. The domain logic was paid for in real usage. What they needed next was commercial: sell that same system to other facilities as a multi-tenant product, without cloning servers per customer or risking cross-facility data leaks.

Oriental Nippon partnered with Tasukaru on the control plane that makes that shift possible. This case study focuses on authentication and authorization only: how we took single-tenant identity assumptions and replaced them with a SaaS-grade tenant boundary.

For the general patterns behind this work, see the companion article: Authentication and Authorization When Productizing SaaS.

Starting point: one company, fragile auth assumptions

Tasukaru’s application worked well for a single organization:

ProblemImpact
Plain login IDs (admin, reception) with no tenant baked inSame username can exist across customers, creating collisions
“You are in the app” ≠ “You are in this facility”No tenant boundary enforcement in the application logic
App-level roles, no shared policy enginePermissions hardcoded and scattered; hard to audit
Shared parent-domain cookies leak across hostsA valid session does not mean a safe tenant

Result: The product invited accidental cross-tenant access the moment a second paying facility came online.

What we changed: identity + authorization for many facilities

We kept the healthcare product Tasukaru’s teams already trusted, and replaced the fragile auth layer with a multi-tenant control plane built on Ory Kratos (identity) and Ory Keto (authorization).

LayerBeforeAfter
Identity (Ory Kratos)Plain login ID, single orgCompound ID {branchid}:{loginid}; identity traits carry the branch
Tenant addressOne shared hostSubdomain (when enabled) fixes the facility before login
Session check“Is the cookie valid?”Valid session and traits.branch matches the request subdomain
Permissions (Ory Keto)Ad-hoc / app-local rolesCentral RBAC on every protected path
Downstream trustClient or session guessesGateway injects trusted user + branch headers after authz passes

The key difference: Login resolves the branch first (from the hostname, or via a public lookup on the root domain), then creates a Kratos browser flow and submits the compound identifier. After login, every API call hits an internal authz step that asks Kratos who is this? and Keto are they allowed?, and rejects the request if the session’s branch does not match the subdomain on the wire.

The request flow on Tasukaru

On the multi-facility platform, each facility can live on its own subdomain, authenticate through Ory Kratos, and stay isolated from every other facility, even when cookies live on a shared parent domain.

Mental model we shipped

LayerRoleToolDecision
1. Tenant resolutionWhere are they coming from?URL hostnametokyo.example.com → tenant tokyo
2. IdentityWho are they?Ory KratosSession for tokyo:admin with branch trait
3. Tenant matchAre they in the right place?Auth gatewayDoes session.branch == URL tenant?
4. PermissionsWhat can they do?Ory Ketotokyo:admin can GET /reports?
5. Trust handoffWho do we tell downstream?Injected headersAPI receives X-Tenant: tokyo as truth

Rules we enforced on Tasukaru:

  1. Tenant = facility (branch).
  2. URL (subdomain) chooses the tenant before login when enabled.
  3. Kratos login uses tenant-scoped identity: branchid:loginid.
  4. Every API request re-checks session validity, branch match, and Keto permission.
  5. Downstream services trust server-injected headers only.

Outcome

Tasukaru kept their healthcare domain product. Facilities can onboard as tenants on one codebase. Isolation is architectural: cookies alone never decide which customer’s data you see.

If you have a single-company system ready to sell as SaaS, the same auth and authorization control plane is where we start. Contact Oriental Nippon to talk through your stack.

Related blog

From Internal Users to SaaS Customers: Rebuilding Auth for Multi-Tenancy