Interface TenantCredentialsMapper<T>

Type Parameters:
T - The type of the tenant id

@Incubating public interface TenantCredentialsMapper<T>
Supplies tenant-specific credential to use to connect to the database. This feature may be used on its own or in conjunction with schema-based or discriminator-based multitenancy.

When a tenant credentials mapper is set, ConnectionProvider.getConnection(String, String) is used to acquire JDBC connections. This typically requires that the JDBC DataSource correctly implements the method DataSource.getConnection(String, String).

Since:
7.3
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    password(T tenantIdentifier)
    The password of the database user for data belonging to the tenant with the given identifier.
    user(T tenantIdentifier)
    The name of the database user for data belonging to the tenant with the given identifier.
  • Method Details

    • user

      @Nonnull String user(@Nonnull T tenantIdentifier)
      The name of the database user for data belonging to the tenant with the given identifier.
      Parameters:
      tenantIdentifier - The tenant identifier
      Returns:
      The name of the database schema belonging to that tenant
    • password

      @Nonnull String password(@Nonnull T tenantIdentifier)
      The password of the database user for data belonging to the tenant with the given identifier.
      Parameters:
      tenantIdentifier - The tenant identifier
      Returns:
      The name of the database schema belonging to that tenant