
Principal that represents the authenticated identity of the Kafka client.
We can split this authentication and security configuration into two aspects:
- Security protocol: defines how a Kafka client and Gateway broker should communicate and secure the connection.
- Authentication mechanism: defines how a client can authenticate itself when opening the connection.
- PLAINTEXT: Brokers don’t need client authentication; all communication is exchanged without network security.
- SSL: With SSL-only clients don’t need any client authentication but communication between the client and Gateway broker will be encrypted.
- mTLS: This security protocol is not originally intended to provide authentication, but you can use the mTLS option below to enable an authentication. mTLS leverages SSL mutual authentication to identify a Kafka client.
Principalfor mTLS connection can be detected from the subject certificate using the same feature as in Apache Kafka, the SSL principal mapping. - SASL PLAINTEXT: Brokers don’t need any client authentication and all communication is exchanged without any network security.
- SASL SSL: Authentication from the client is mandatory against Gateway and communication will be encrypted using TLS.
- DELEGATED_SASL_PLAINTEXT: Authentication from the client is mandatory but will be forwarded to Kafka for checking. Gateway will intercept exchanged authentication data to detect authenticated principals:
- All communication between the client and gateway broker is exchanged without any network security.
- All credentials are managed by your backend kafka, we only provide authorization on the Gateway side based on the exchanged principal.
| Clients ⟶ GW transit in plaintext | Clients ⟶ GW transit is encrypted | |
|---|---|---|
| Anonymous access only | Security protocol: PLAINTEXTAuthentication mechanism: None | Security protocol: SSLAuthentication mechanism: None |
| Credentials managed by Gateway | Security protocol: SASL_PLAINTEXTAuthentication mechanism: PLAIN | Security protocol: SASL_SSLAuthentication mechanism: PLAIN |
| Gateway configured with OAuth | Security protocol: SASL_PLAINTEXTAuthentication mechanism: OAUTHBEARER | Security protocol: SASL_SSLAuthentication mechanism: OAUTHBEARER |
| Clients are identified by certificates (mTLS) | Not possible (mTLS means encryption) | Security protocol: SSLAuthentication mechanism: MTLS |
| Credentials managed by Kafka | Security protocol: DELEGATED_SASL_PLAINTEXTAuthentication mechanism: PLAIN, SCRAM-SHA-256, SCRAM-SHA-512, OAUTHBEARER orAWS_MSK_IAM | Security protocol: DELEGATED_SASL_SSLAuthentication mechanism: PLAIN, SCRAM-SHA-256, SCRAM-SHA-512, OAUTHBEARER orAWS_MSK_IAM |
Security protocol
The Gateway broker security scheme is defined by theGATEWAY_SECURITY_PROTOCOL configuration.
Note that you don’t set an authentication mechanism on the client to Gateway side of the proxy, i.e. GATEWAY_SASL_MECHANISM does not exist and is never configured by the user. Instead, Gateway will try to authenticate the client as it presents itself.
For example, if a client is using OAUTHBEARER, Gateway will use the OAuth configuration to try authenticate it. If a client arrives using PLAIN, Gateway will try use either the SSL configuration or validate the token itself, depending on the security protocol.
In addition to all the security protocols that Apache Kafka supports, Gateway adds two new protocols:DELEGATED_SASL_PLAINTEXT and DELEGATED_SASL_SSL for delegating to Kafka.
PLAINTEXT
There is no client authentication to Gateway and all communication is exchanged without any network security. Gateway configuration:SSL
With SSL only, there is no client authentication, but communication between the client and Gateway broker will be encrypted. Gateway configuration:mTLS
Mutual TLS leverages client side certificates to authenticate a Kafka client.Principal for an mTLS connection can be detected from the subject of the certificate using the same feature as Apache Kafka, the SSL principal mapping.
Gateway configuration:
SASL_PLAINTEXT
Authentication from the client is mandatory against Gateway but all communications are exchanged without any network security. Gateway supports Plain and OAuthbearer SASL mechanisms.Plain
Plain mechanism uses Username/Password credentials to authenticate credentials against Gateway. Plain credentials take the form of a JWT token, these are managed in Gateway using the Admin (HTTP) API. See below for the creation of tokens. Gateway configuration:GATEWAY_USER_POOL_SECRET_KEY has to be set to a random base64 encoded value of 256bits long to ensure that tokens aren’t forged. For example: openssl rand -base64 32. Otherwise, a default value for signing tokens will be used.
Client configuration:
- Create the service account, the username
- Generate a token for the service account, the password
OAuthbearer
Oauthbearer uses a OAuth2/OIDC security provider to authenticate a token in Gateway. The Oauth credentials base is managed in the configured provider. This mechanism will also allow you to verify some claims from your OIDC provider (audience and issuer ).
Gateway configuration:
SASL_SSL
Authentication from client is mandatory against Gateway and communication will be encrypted using TLS. Supported authentication mechanisms:- PLAIN
- OAUTHBEARER
Plain
Plain mechanism use Username/Password credentials to authenticate credentials against Gateway. Plain credentials are managed in Gateway using the HTTP API. Gateway configuration:GATEWAY_USER_POOL_SECRET_KEY to a random value to ensure that tokens cannot be forged. Otherwise, a default value for signing tokens will be used.
Client configuration:
OAuthbearer
Oauthbearer uses a OAuth2/OIDC security provider to authenticate a token in Gateway. The Oauth credentials base is managed in the configured provider. This mechanism will also allow you to verify some claims from your OIDC provider (audience and issuer ).
Gateway configuration:
DELEGATED_SASL_PLAINTEXT
Authentication from client is mandatory but will be forwarded to Kafka for checking. Gateway will intercept exchanged authentication data to detect an authenticated principal:- All communication between the client and Gateway broker are exchanged without any network security.
- All credentials are managed by your backing Kafka, we only provide authorization on the Gateway side based on the exchanged principal.
- PLAIN
- SCRAM-SHA-256
- SCRAM-SHA-512
- OAUTHBEARER
- AWS_MSK_IAM
DELEGATED_SASL_SSL
Authentication from the client is mandatory but will be forwarded to Kafka. Gateway will intercept exchanged authentication data to detect an authenticated principal:- All communication between the client and Gateway broker will be encrypted using TLS.
- All credentials are managed by your backing Kafka, we only provide Authorization on the Gateway side based on the exchanged principal.
- PLAIN
- SCRAM-SHA-256
- SCRAM-SHA-512
- OAUTHBEARER
- AWS_MSK_IAM
Principal resolver
When using Confluent Cloud authentication with delegated authentication, Gateway supports automatically resolving API keys to their associated service account. This feature enhances security and improves usability by working with the service account principals instead of raw API keys. See the principal resolver environment variables. Gateway configuration using environment variables:The value of
GATEWAY_CONFLUENT_CLOUD_API_KEY has to be a Confluent Cloud API key because it will be used to access the Confluent Cloud API. Find out more about Confluent Cloud API keys.XIGMNERQXOUKXDQU) to their associated owner, which will be either the user (e.g. u-12345) or the service account (e.g. sa-72839j).
Authentication flow
Automatic security protocol detection (default behavior)
If you don’t specify a security protocol, Gateway will attempt to detect it on startup based on the Kafka configuration. If there’s also no security protocol on the backing Kafka cluster, then we set the security protocol toPLAINTEXT by default.
Here’s our mapping from the Kafka cluster’s defined protocol:
| Kafka cluster security protocol | Gateway cluster inferred security protocol |
|---|---|
| SASL_SSL | DELEGATED_SASL_SSL |
| SASL_PLAINTEXT | DELEGATED_SASL_PLAINTEXT |
| SSL | SSL |
| PLAINTEXT | PLAINTEXT |