public class TenantContext extends Object implements org.apache.kafka.common.protocol.MessageContext
TenantContext
is built
from the authentication context and passed through to the serde in order to add or
remove the tenant prefix. We use EntityType
to determine which transformation
is needed.
Note also that there are additional transformations/validations done inside
MultiTenantRequestContext
.Modifier and Type | Field and Description |
---|---|
static String |
DELIMITER |
String |
prefix |
protected int |
prefixSizeInBytes |
io.confluent.kafka.multitenant.MultiTenantPrincipal |
principal |
Constructor and Description |
---|
TenantContext(io.confluent.kafka.multitenant.MultiTenantPrincipal principal) |
Modifier and Type | Method and Description |
---|---|
String |
addTenantPrefix(String value) |
static String |
extractTenant(String prefixedName) |
static String |
extractTenantPrefix(String prefixedName) |
boolean |
hasTenantPrefix(String value) |
static boolean |
hasTenantPrefix(String prefix,
String prefixedName) |
static boolean |
isTenantPrefixed(String prefixedName) |
protected boolean |
isTransformRequired(org.apache.kafka.common.config.ConfigResource.Type resourceType) |
protected boolean |
isTransformRequired(org.apache.kafka.common.resource.ResourceType resourceType) |
String |
prefix() |
String |
prefixedWildcard() |
int |
prefixSizeInBytes() |
org.apache.kafka.common.protocol.Message |
read(org.apache.kafka.common.protocol.EntityType entityType,
org.apache.kafka.common.protocol.Message value) |
String |
read(org.apache.kafka.common.protocol.EntityType entityType,
String value) |
String |
removeAllTenantPrefixes(String message) |
static String |
removePrefix(String value) |
String |
removeTenantPrefix(String value) |
org.apache.kafka.common.TopicPartition |
removeTenantPrefix(org.apache.kafka.common.TopicPartition tp) |
int |
sizeOfRemovedPrefixes(String message) |
org.apache.kafka.common.protocol.Message |
write(org.apache.kafka.common.protocol.EntityType entityType,
org.apache.kafka.common.protocol.Message value) |
String |
write(org.apache.kafka.common.protocol.EntityType entityType,
String value) |
public static final String DELIMITER
public final io.confluent.kafka.multitenant.MultiTenantPrincipal principal
public final String prefix
protected final int prefixSizeInBytes
public TenantContext(io.confluent.kafka.multitenant.MultiTenantPrincipal principal)
public static boolean isTenantPrefixed(String prefixedName)
public String prefix()
public int prefixSizeInBytes()
public org.apache.kafka.common.TopicPartition removeTenantPrefix(org.apache.kafka.common.TopicPartition tp)
public boolean hasTenantPrefix(String value)
public int sizeOfRemovedPrefixes(String message)
public String prefixedWildcard()
public String write(org.apache.kafka.common.protocol.EntityType entityType, String value)
write
in interface org.apache.kafka.common.protocol.MessageContext
public org.apache.kafka.common.protocol.Message write(org.apache.kafka.common.protocol.EntityType entityType, org.apache.kafka.common.protocol.Message value)
write
in interface org.apache.kafka.common.protocol.MessageContext
public String read(org.apache.kafka.common.protocol.EntityType entityType, String value)
read
in interface org.apache.kafka.common.protocol.MessageContext
public org.apache.kafka.common.protocol.Message read(org.apache.kafka.common.protocol.EntityType entityType, org.apache.kafka.common.protocol.Message value)
read
in interface org.apache.kafka.common.protocol.MessageContext
protected boolean isTransformRequired(org.apache.kafka.common.resource.ResourceType resourceType)
protected boolean isTransformRequired(org.apache.kafka.common.config.ConfigResource.Type resourceType)