juspay/hyperswitch

[FEAT] Add multitenancy support for keymanager

Open

#6.227 geöffnet am 23. Sept. 2024

Auf GitHub ansehen
 (6 Kommentare) (0 Reaktionen) (1 zugewiesene Person)Rust (4.676 Forks)batch import
E-mediumRusthacktoberfesthelp wanted

Repository-Metriken

Stars
 (42.690 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 6T 22h) (213 gemergte PRs in 30 T)

Beschreibung

Description:

Cripta is a service which creates keys and maintains it (includes key rotation etc.) individually for different Merchants and Users.

The idea here is to segregate key data for each tenants logically by creating different schemas for different tenants. So in the service we need to maintain the connection between multiple schemas.

[!NOTE] We will get the tenant for which the current request should be run in X-tenant header.

Getting started:

Go through the README for guidelines on the structure and functionality.

Possible implementation:

  1. Add a config entry for multi-tenancy in this structure
[mult_tenancy]
tenant_name = { schema = "tenant_schema" }
  1. Add connections for different schemas for different tenants
struct AppState {
	// This will maintain connection pool for different schemas for tenants
	connections: HashMap<String, DieselConnectionPool>
}
  1. Add SessionState which will have the connections for the particular tenant
struct SessionState {
	pool: DieselConnectionPool
}

impl AppState {
	fn get_session_state(&self,tenant: &str) -> SessionState {
			return self.pool.get(tenant)
	}
}

Reference:

Submission Process:

  • Ask the maintainers for assignment of the issue, you can request for assignment by commenting on the issue itself.
  • Once assigned, submit a pull request (PR).
  • Maintainers will review and provide feedback, if any.
  • Maintainers can unassign issues due to inactivity, read more here.
  • For this issue, please raise a PR on the https://github.com/juspay/hyperswitch-encryption-service repo, and link the issue.

Refer here for Terms and conditions for the contest.

Contributor Guide