Class SaslAuthenticatorTest
java.lang.Object
org.apache.kafka.common.security.authenticator.SaslAuthenticatorTest
Tests for the Sasl authenticator. These use a test harness that runs a simple socket server that echos back responses.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic final classstatic class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidTests good path SASL/PLAIN authentication over PLAINTEXT with old version of client that does not support SASL_AUTHENTICATE headers and new version of server.voidTests SASL/PLAIN authentication failure over PLAINTEXT with old version of client that does not support SASL_AUTHENTICATE headers and new version of server.voidTests good path SASL/PLAIN authentication over PLAINTEXT with old version of server that does not support SASL_AUTHENTICATE headers and new version of client.voidTests SASL/PLAIN authentication failure over PLAINTEXT with old version of server that does not support SASL_AUTHENTICATE headers and new version of client.voidTests good path SASL/PLAIN authentication over SSL with old version of client that does not support SASL_AUTHENTICATE headers and new version of server.voidTests SASL/PLAIN authentication failure over SSL with old version of client that does not support SASL_AUTHENTICATE headers and new version of server.voidTests good path SASL/PLAIN authentication over SSL with old version of server that does not support SASL_AUTHENTICATE headers and new version of client.voidTests SASL/PLAIN authentication failure over SSL with old version of server that does not support SASL_AUTHENTICATE headers and new version of client.voidTests good path SASL/SCRAM authentication over PLAINTEXT with old version of client that does not support SASL_AUTHENTICATE headers and new version of server.voidTests SASL/SCRAM authentication failure over PLAINTEXT with old version of client that does not support SASL_AUTHENTICATE headers and new version of server.voidTests good path SASL/SCRAM authentication over PLAINTEXT with old version of server that does not support SASL_AUTHENTICATE headers and new version of client.voidTests SASL/SCRAM authentication failure over PLAINTEXT with old version of server that does not support SASL_AUTHENTICATE headers and new version of client.voidTests good path SASL/SCRAM authentication over SSL with old version of client that does not support SASL_AUTHENTICATE headers and new version of server.voidTests SASL/SCRAM authentication failure over SSL with old version of client that does not support SASL_AUTHENTICATE headers and new version of server.voidTests good path SASL/SCRAM authentication over SSL with old version of server that does not support SASL_AUTHENTICATE headers and new version of client.voidTests SASL/SCRAM authentication failure over SSL with old version of server that does not support SASL_AUTHENTICATE headers and new version of client.voidsetup()voidteardown()voidTests that unsupported version of ApiVersionsRequest before SASL handshake request returns error response and does not result in authentication failure.voidtestAsyncAuthBadCredentials(NioServerType serverType) Make sure invalid credentials in asynchronous SASL authentication cause the auth to fail.voidtestAsyncAuthDelay(NioServerType serverType) Make sure delays in asynchronous SASL authentication aren't fatal.voidtestAsyncAuthDelayInSynchronous(NioServerType serverType) Make sure delays in synchronous SASL authentication aren't fatal.voidtestAsyncAuthTimeout(NioServerType serverType) Make sure timeouts in asynchronous SASL authentication cause the auth to fail.voidTest SASL/PLAIN with sasl.authentication.max.handshake.receive.size configvoidTest SASL/PLAIN with listener.name.sasl_plaintext.plain.sasl.authentication.max.receive.size configvoidTest that callback handlers are only applied to connections for the mechanisms configured for the handler.voidSecond re-authentication must fail if it is sooner than one second after the firstvoidRe-authentication must fail if mechanism changesvoidRe-authentication must fail if principal changesvoidtestClientAuthenticateCallbackHandler(NioServerType serverType) Tests SASL client authentication callback handler override.voidtestClientDynamicJaasConfiguration(NioServerType serverType) Tests dynamic JAAS configuration property for SASL clients.voidVerify that messages from SaslExceptions thrown in the server during authentication are not propagated to the client since these may contain sensitive data.voidtestClientLoginCallbackOverride(NioServerType serverType) Tests SASL login callback class override.voidtestClientLoginOverride(NioServerType serverType) Tests SASL login class override.voidvoidvoidtestDisabledMechanism(NioServerType serverType) Tests that mechanisms with default implementation in Kafka may be disabled in the Kafka server by removing from the enabled mechanism list.voidTests that Kafka requests that are forbidden until successful authentication result in authentication failure and do not cause any failures in the server.voidTests that hostname verification is performed on the host name or address specified by the client without using reverse DNS lookup.voidvoidTests OAUTHBEARER fails the connection when the client presents a token with insufficient scope .voidtestInvalidApiVersionsRequest(NioServerType serverType) Tests that invalid ApiVersionRequest is handled by the server correctly and returns an INVALID_REQUEST error.voidtestInvalidApiVersionsRequestSequence(NioServerType serverType) Tests that ApiVersionsRequest after Kafka SASL handshake request flow, but prior to actual SASL authentication, results in authentication failure.voidtestInvalidLoginModule(NioServerType serverType) Tests that connections cannot be created if the login module class is unavailable.voidtestInvalidMechanism(NioServerType serverType) Tests that clients using invalid SASL mechanisms fail authentication.voidtestInvalidPasswordSaslPlain(NioServerType serverType) Tests that SASL/PLAIN clients with invalid password fail authentication.voidtestInvalidPasswordSaslScram(NioServerType serverType) Tests that SASL/SCRAM clients fail authentication if password is invalid.voidvoidtestInvalidSaslPacket(NioServerType serverType) Tests that any invalid data during Kafka SASL handshake request flow or the actual SASL authentication flow result in authentication failure and do not cause any failures in the server.voidtestInvalidUsernameSaslPlain(NioServerType serverType) Tests that SASL/PLAIN clients with invalid username fail authentication.voidtestJaasConfigurationForListener(NioServerType serverType) voidvoidtestLogMessageWithAuthenticationFailure(NioServerType serverType) Verify the selector log message from the exception thrown in the server during authenticationvoidtestMechanismPluggability(NioServerType serverType) Tests that mechanisms that are not supported in Kafka can be plugged in without modifying Kafka code if Sasl client and server providers are available.voidtestMissingPasswordSaslPlain(NioServerType serverType) Tests that SASL/PLAIN clients with missing password in JAAS configuration fail authentication.voidtestMissingUsernameSaslPlain(NioServerType serverType) Tests that SASL/PLAIN clients without valid username fail authentication.voidtestMtlsClientAuthOverSaslSslListenerNONE(boolean sendApiVersions, boolean usePPV2) voidtestMtlsClientAuthOverSaslSslListenerREQUESTED(boolean sendApiVersions, boolean usePPV2) voidtestMtlsClientAuthOverSaslSslListenerREQUIRED(boolean sendApiVersions, boolean usePPV2) voidtestMultipleServerMechanisms(NioServerType serverType) Tests that servers supporting multiple SASL mechanisms work with clients using any of the enabled mechanisms.voidvoidtestPacketSizeTooBig(NioServerType serverType) Tests that packets that are too big during Kafka SASL handshake request flow or the actual SASL authentication flow result in authentication failure and do not cause any failures in the server.voidvoidvoidvoidvoidvoidvoidtestPrincipalBuilderException(NioServerType serverType) Tests that connections are failed and closed properly if principal builder throws an exception while building the principal.voidtestPrincipalBuiltOncePerAuthentication(NioServerType serverType) voidvoidtestPublicCredential(NioServerType serverType) voidvoidtestRepeatedValidSaslPlainOverSsl(NioServerType serverType) Tests good path SASL/PLAIN client and server channels using SSL transport layer.voidtestSaslAuthenticationMaxReceiveSize(NioServerType serverType) Test SASL/PLAIN with sasl.server.max.receive.size configvoidTests that unsupported version of SASL handshake request returns error response and fails authentication.voidtestSaslPlainClientCredentialUpdate(NioServerType serverType) voidtestSaslUnsupportedClientVersions(NioServerType serverType) Tests correct negotiation of handshake and authenticate api versions by having the server return a higher version than supported on the client.voidtestScramUsernameWithSpecialCharacters(NioServerType serverType) Tests SASL/SCRAM with username containing characters that need to be encoded.voidtestServerAuthenticateCallbackHandler(NioServerType serverType) Tests SASL server authentication callback handler override.voidtestServerDynamicJaasConfiguration(NioServerType serverType) Tests dynamic JAAS configuration property for SASL server.voidtestServerLoginCallbackOverride(NioServerType serverType) Tests SASL server login callback class override.voidtestServerLoginOverride(NioServerType serverType) Tests SASL server login class override.voidvoidvoidvoidvoidvoidvoidtestSwitchoverDisabled(NioServerType serverType) voidTests dynamic update of SASL/PLAIN credentials with directory layout similar to Kubernetes secrets file in Cloud.voidtestTokenAuthenticationOverSaslScram(NioServerType serverType) voidtestTokenReauthenticationOverSaslScram(NioServerType serverType) voidTests that Kafka ApiVersionsRequests are handled by the SASL server authenticator prior to SASL handshake flow and that subsequent authentication succeeds when transport layer is PLAINTEXT.voidSeetestUnauthenticatedApiVersionsRequestOverSslHandshakeVersion0(NioServerType)for test scenario.voidTests that Kafka ApiVersionsRequests are handled by the SASL server authenticator prior to SASL handshake flow and that subsequent authentication succeeds when transport layer is SSL.voidSeetestUnauthenticatedApiVersionsRequestOverPlaintextHandshakeVersion0(NioServerType)for test scenario.voidtestUnknownUserSaslScram(NioServerType serverType) Tests that SASL/SCRAM clients without valid username fail authentication.voidTests that SASL/SCRAM clients fail authentication if credentials are not available for the specific SCRAM mechanism.voidtestValidApiVersionsRequest(NioServerType serverType) Tests that valid ApiVersionRequest is handled by the server correctly and returns an NONE error.voidtestValidEndpointIdentificationCN(NioServerType serverType) Tests that server certificate with CN containing valid hostname is accepted by a client that connects using hostname and validates server endpoint.voidtestValidEndpointIdentificationSanDns(NioServerType serverType) Tests that server certificate with SubjectAltName containing the valid hostname is accepted by a client that connects using the hostname and validates server endpoint.voidtestValidEndpointIdentificationSanIp(NioServerType serverType) Tests that server certificate with SubjectAltName containing valid IP address is accepted by a client that connects using IP address and validates server endpoint.voidvoidtestValidSaslOauthBearerMechanism(NioServerType serverType) Tests OAUTHBEARER client and server channels.voidTests OAUTHBEARER client channels without tokens for the server.voidtestValidSaslPlainOverPlaintext(NioServerType serverType) Tests good path SASL/PLAIN client and server channels using PLAINTEXT transport layer.voidtestValidSaslPlainOverSsl(NioServerType serverType) Tests good path SASL/PLAIN client and server channels using SSL transport layer.voidtestValidSaslScramMechanisms(NioServerType serverType) Tests all supported SCRAM client and server channels.voidtestValidSaslScramSha256(NioServerType serverType) Tests good path SASL/SCRAM-SHA-256 client and server channels.
-
Constructor Details
-
SaslAuthenticatorTest
public SaslAuthenticatorTest()
-
-
Method Details
-
setup
-
teardown
-
testValidSaslPlainOverSsl
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testValidSaslPlainOverSsl(NioServerType serverType) throws Exception Tests good path SASL/PLAIN client and server channels using SSL transport layer. Also tests successful re-authentication.- Throws:
Exception
-
testValidSaslPlainOverPlaintext
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testValidSaslPlainOverPlaintext(NioServerType serverType) throws Exception Tests good path SASL/PLAIN client and server channels using PLAINTEXT transport layer. Also tests successful re-authentication.- Throws:
Exception
-
testValidProxyProtocol2TrafficHeaderAuth
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(names="TCP") public void testValidProxyProtocol2TrafficHeaderAuth(NioServerType serverType) throws Exception - Throws:
Exception
-
testNoValidateProxyProtocol2TrafficHeaderAuth
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(names="TCP") public void testNoValidateProxyProtocol2TrafficHeaderAuth(NioServerType serverType) throws Exception - Throws:
Exception
-
testInvalidProxyProtocol2TrafficHeaderAuth
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(names="TCP") public void testInvalidProxyProtocol2TrafficHeaderAuth(NioServerType serverType) throws Exception - Throws:
Exception
-
testPrincipalBuiltOncePerAuthentication
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(names="TCP") public void testPrincipalBuiltOncePerAuthentication(NioServerType serverType) throws Exception - Throws:
Exception
-
testSaslAuthenticationMaxReceiveSize
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testSaslAuthenticationMaxReceiveSize(NioServerType serverType) throws Exception Test SASL/PLAIN with sasl.server.max.receive.size config- Throws:
Exception
-
testAuthConfiguredSaslMechanismMaxReceiveSize
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testAuthConfiguredSaslMechanismMaxReceiveSize(NioServerType serverType) throws Exception Test SASL/PLAIN with listener.name.sasl_plaintext.plain.sasl.authentication.max.receive.size config- Throws:
Exception
-
testAuthConfiguredSaslHandshakeMaxReceiveSize
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testAuthConfiguredSaslHandshakeMaxReceiveSize(NioServerType serverType) throws Exception Test SASL/PLAIN with sasl.authentication.max.handshake.receive.size config- Throws:
Exception
-
testInvalidPasswordSaslPlain
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testInvalidPasswordSaslPlain(NioServerType serverType) throws Exception Tests that SASL/PLAIN clients with invalid password fail authentication.- Throws:
Exception
-
testInvalidUsernameSaslPlain
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testInvalidUsernameSaslPlain(NioServerType serverType) throws Exception Tests that SASL/PLAIN clients with invalid username fail authentication.- Throws:
Exception
-
testMissingUsernameSaslPlain
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testMissingUsernameSaslPlain(NioServerType serverType) throws Exception Tests that SASL/PLAIN clients without valid username fail authentication.- Throws:
Exception
-
testMissingPasswordSaslPlain
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testMissingPasswordSaslPlain(NioServerType serverType) throws Exception Tests that SASL/PLAIN clients with missing password in JAAS configuration fail authentication.- Throws:
Exception
-
testSaslPlainClientCredentialUpdate
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testSaslPlainClientCredentialUpdate(NioServerType serverType) throws Exception - Throws:
Exception
-
testPropsFileBasedSaslPlainClientCredentialUpdate
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testPropsFileBasedSaslPlainClientCredentialUpdate(NioServerType serverType) throws Exception - Throws:
Exception
-
testJsonFileBasedSaslPlainClientCredentialUpdate
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testJsonFileBasedSaslPlainClientCredentialUpdate(NioServerType serverType) throws Exception - Throws:
Exception
-
testSymLinkedFileBasedSaslPlainClientCredentialUpdate
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testSymLinkedFileBasedSaslPlainClientCredentialUpdate(NioServerType serverType) throws Exception Tests dynamic update of SASL/PLAIN credentials with directory layout similar to Kubernetes secrets file in Cloud. TMP/secrets is the base directory TMP/secrets/..data is the data directory TMP/secrets/..data -> TMP/secrets/..{id} (timestamp is used as id in Cloud, here we use an index) TMP/secrets/..{id}/credential.props is the file containing credentials TMP/secrets/credential.props -> TMP/secrets/..data/credential.props Client is configured with `TMP/secrets/credential.props` as the credential path and TMP/secrets/..data as the directory to watch.- Throws:
Exception
-
testClientExceptionDoesNotContainSensitiveData
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testClientExceptionDoesNotContainSensitiveData(NioServerType serverType) throws Exception Verify that messages from SaslExceptions thrown in the server during authentication are not propagated to the client since these may contain sensitive data.- Throws:
Exception
-
testLogMessageWithAuthenticationFailure
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(names="TCP") public void testLogMessageWithAuthenticationFailure(NioServerType serverType) throws Exception Verify the selector log message from the exception thrown in the server during authentication- Throws:
Exception
-
testMechanismPluggability
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testMechanismPluggability(NioServerType serverType) throws Exception Tests that mechanisms that are not supported in Kafka can be plugged in without modifying Kafka code if Sasl client and server providers are available.- Throws:
Exception
-
testMultipleServerMechanisms
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testMultipleServerMechanisms(NioServerType serverType) throws Exception Tests that servers supporting multiple SASL mechanisms work with clients using any of the enabled mechanisms. Also tests successful re-authentication over multiple mechanisms.- Throws:
Exception
-
testValidSaslScramSha256
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testValidSaslScramSha256(NioServerType serverType) throws Exception Tests good path SASL/SCRAM-SHA-256 client and server channels. Also tests successful re-authentication.- Throws:
Exception
-
testValidSaslScramMechanisms
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testValidSaslScramMechanisms(NioServerType serverType) throws Exception Tests all supported SCRAM client and server channels. Also tests that all supported SCRAM mechanisms can be supported simultaneously on a server.- Throws:
Exception
-
testInvalidPasswordSaslScram
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testInvalidPasswordSaslScram(NioServerType serverType) throws Exception Tests that SASL/SCRAM clients fail authentication if password is invalid.- Throws:
Exception
-
testUnknownUserSaslScram
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testUnknownUserSaslScram(NioServerType serverType) throws Exception Tests that SASL/SCRAM clients without valid username fail authentication.- Throws:
Exception
-
testScramUsernameWithSpecialCharacters
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testScramUsernameWithSpecialCharacters(NioServerType serverType) throws Exception Tests SASL/SCRAM with username containing characters that need to be encoded.- Throws:
Exception
-
testTokenAuthenticationOverSaslScram
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testTokenAuthenticationOverSaslScram(NioServerType serverType) throws Exception - Throws:
Exception
-
testTokenReauthenticationOverSaslScram
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testTokenReauthenticationOverSaslScram(NioServerType serverType) throws Exception - Throws:
Exception
-
testUnauthenticatedApiVersionsRequestOverPlaintextHandshakeVersion0
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testUnauthenticatedApiVersionsRequestOverPlaintextHandshakeVersion0(NioServerType serverType) throws Exception Tests that Kafka ApiVersionsRequests are handled by the SASL server authenticator prior to SASL handshake flow and that subsequent authentication succeeds when transport layer is PLAINTEXT. This test simulates SASL authentication using a (non-SASL) PLAINTEXT client and sends ApiVersionsRequest straight after connection to the server is established, before any SASL-related packets are sent. This test is run with SaslHandshake version 0 and no SaslAuthenticate headers.- Throws:
Exception
-
testUnauthenticatedApiVersionsRequestOverPlaintextHandshakeVersion1
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testUnauthenticatedApiVersionsRequestOverPlaintextHandshakeVersion1(NioServerType serverType) throws Exception SeetestUnauthenticatedApiVersionsRequestOverSslHandshakeVersion0(NioServerType)for test scenario. This test is run with SaslHandshake version 1 and SaslAuthenticate headers.- Throws:
Exception
-
testUnauthenticatedApiVersionsRequestOverSslHandshakeVersion0
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testUnauthenticatedApiVersionsRequestOverSslHandshakeVersion0(NioServerType serverType) throws Exception Tests that Kafka ApiVersionsRequests are handled by the SASL server authenticator prior to SASL handshake flow and that subsequent authentication succeeds when transport layer is SSL. This test simulates SASL authentication using a (non-SASL) SSL client and sends ApiVersionsRequest straight after SSL handshake, before any SASL-related packets are sent. This test is run with SaslHandshake version 0 and no SaslAuthenticate headers.- Throws:
Exception
-
testUnauthenticatedApiVersionsRequestOverSslHandshakeVersion1
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testUnauthenticatedApiVersionsRequestOverSslHandshakeVersion1(NioServerType serverType) throws Exception SeetestUnauthenticatedApiVersionsRequestOverPlaintextHandshakeVersion0(NioServerType)for test scenario. This test is run with SaslHandshake version 1 and SaslAuthenticate headers.- Throws:
Exception
-
testApiVersionsRequestWithServerUnsupportedVersion
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testApiVersionsRequestWithServerUnsupportedVersion(NioServerType serverType) throws Exception Tests that unsupported version of ApiVersionsRequest before SASL handshake request returns error response and does not result in authentication failure. This test is similar totestUnauthenticatedApiVersionsRequest(SecurityProtocol, short, NioServerType)where a non-SASL client is used to send requests that are processed bySaslServerAuthenticatorof the server prior to client authentication.- Throws:
Exception
-
testSaslUnsupportedClientVersions
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testSaslUnsupportedClientVersions(NioServerType serverType) throws Exception Tests correct negotiation of handshake and authenticate api versions by having the server return a higher version than supported on the client. Note, that due to KAFKA-9577 this will require a workaround to effectively bump SASL_HANDSHAKE in the future.- Throws:
Exception
-
testInvalidApiVersionsRequest
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testInvalidApiVersionsRequest(NioServerType serverType) throws Exception Tests that invalid ApiVersionRequest is handled by the server correctly and returns an INVALID_REQUEST error.- Throws:
Exception
-
testForBrokenSaslHandshakeVersionBump
@Test public void testForBrokenSaslHandshakeVersionBump() -
testValidApiVersionsRequest
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testValidApiVersionsRequest(NioServerType serverType) throws Exception Tests that valid ApiVersionRequest is handled by the server correctly and returns an NONE error.- Throws:
Exception
-
testSaslHandshakeRequestWithUnsupportedVersion
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testSaslHandshakeRequestWithUnsupportedVersion(NioServerType serverType) throws Exception Tests that unsupported version of SASL handshake request returns error response and fails authentication. This test is similar totestUnauthenticatedApiVersionsRequest(SecurityProtocol, short, NioServerType)where a non-SASL client is used to send requests that are processed bySaslServerAuthenticatorof the server prior to client authentication.- Throws:
Exception
-
testInvalidSaslPacket
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testInvalidSaslPacket(NioServerType serverType) throws Exception Tests that any invalid data during Kafka SASL handshake request flow or the actual SASL authentication flow result in authentication failure and do not cause any failures in the server.- Throws:
Exception
-
testInvalidApiVersionsRequestSequence
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testInvalidApiVersionsRequestSequence(NioServerType serverType) throws Exception Tests that ApiVersionsRequest after Kafka SASL handshake request flow, but prior to actual SASL authentication, results in authentication failure. This is similar totestUnauthenticatedApiVersionsRequest(SecurityProtocol, short, NioServerType)where a non-SASL client is used to send requests that are processed bySaslServerAuthenticatorof the server prior to client authentication.- Throws:
Exception
-
testPacketSizeTooBig
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testPacketSizeTooBig(NioServerType serverType) throws Exception Tests that packets that are too big during Kafka SASL handshake request flow or the actual SASL authentication flow result in authentication failure and do not cause any failures in the server.- Throws:
Exception
-
testDisallowedKafkaRequestsBeforeAuthentication
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testDisallowedKafkaRequestsBeforeAuthentication(NioServerType serverType) throws Exception Tests that Kafka requests that are forbidden until successful authentication result in authentication failure and do not cause any failures in the server.- Throws:
Exception
-
testInvalidLoginModule
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testInvalidLoginModule(NioServerType serverType) throws Exception Tests that connections cannot be created if the login module class is unavailable.- Throws:
Exception
-
testClientAuthenticateCallbackHandler
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testClientAuthenticateCallbackHandler(NioServerType serverType) throws Exception Tests SASL client authentication callback handler override.- Throws:
Exception
-
testServerAuthenticateCallbackHandler
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testServerAuthenticateCallbackHandler(NioServerType serverType) throws Exception Tests SASL server authentication callback handler override.- Throws:
Exception
-
testAuthenticateCallbackHandlerMechanisms
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testAuthenticateCallbackHandlerMechanisms(NioServerType serverType) throws Exception Test that callback handlers are only applied to connections for the mechanisms configured for the handler. Test enables two mechanisms `PLAIN` and `DIGEST-MD5` on the servers with different callback handlers for the two mechanisms. Verifies that clients using both mechanisms authenticate successfully.- Throws:
Exception
-
testClientLoginOverride
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testClientLoginOverride(NioServerType serverType) throws Exception Tests SASL login class override.- Throws:
Exception
-
testServerLoginOverride
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testServerLoginOverride(NioServerType serverType) throws Exception Tests SASL server login class override.- Throws:
Exception
-
testClientLoginCallbackOverride
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testClientLoginCallbackOverride(NioServerType serverType) throws Exception Tests SASL login callback class override.- Throws:
Exception
-
testServerLoginCallbackOverride
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testServerLoginCallbackOverride(NioServerType serverType) throws Exception Tests SASL server login callback class override.- Throws:
Exception
-
testDisabledMechanism
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testDisabledMechanism(NioServerType serverType) throws Exception Tests that mechanisms with default implementation in Kafka may be disabled in the Kafka server by removing from the enabled mechanism list.- Throws:
Exception
-
testInvalidMechanism
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testInvalidMechanism(NioServerType serverType) throws Exception Tests that clients using invalid SASL mechanisms fail authentication.- Throws:
Exception
-
testClientDynamicJaasConfiguration
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testClientDynamicJaasConfiguration(NioServerType serverType) throws Exception Tests dynamic JAAS configuration property for SASL clients. Invalid client credentials are set in the static JVM-wide configuration instance to ensure that the dynamic property override is used during authentication.- Throws:
Exception
-
testServerDynamicJaasConfiguration
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testServerDynamicJaasConfiguration(NioServerType serverType) throws Exception Tests dynamic JAAS configuration property for SASL server. Invalid server credentials are set in the static JVM-wide configuration instance to ensure that the dynamic property override is used during authentication.- Throws:
Exception
-
testJaasConfigurationForListener
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testJaasConfigurationForListener(NioServerType serverType) throws Exception - Throws:
Exception
-
oldSaslPlainPlaintextServerWithoutSaslAuthenticateHeader
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void oldSaslPlainPlaintextServerWithoutSaslAuthenticateHeader(NioServerType serverType) throws Exception Tests good path SASL/PLAIN authentication over PLAINTEXT with old version of server that does not support SASL_AUTHENTICATE headers and new version of client.- Throws:
Exception
-
oldSaslPlainPlaintextClientWithoutSaslAuthenticateHeader
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void oldSaslPlainPlaintextClientWithoutSaslAuthenticateHeader(NioServerType serverType) throws Exception Tests good path SASL/PLAIN authentication over PLAINTEXT with old version of client that does not support SASL_AUTHENTICATE headers and new version of server.- Throws:
Exception
-
oldSaslScramPlaintextServerWithoutSaslAuthenticateHeader
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void oldSaslScramPlaintextServerWithoutSaslAuthenticateHeader(NioServerType serverType) throws Exception Tests good path SASL/SCRAM authentication over PLAINTEXT with old version of server that does not support SASL_AUTHENTICATE headers and new version of client.- Throws:
Exception
-
oldSaslScramPlaintextClientWithoutSaslAuthenticateHeader
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void oldSaslScramPlaintextClientWithoutSaslAuthenticateHeader(NioServerType serverType) throws Exception Tests good path SASL/SCRAM authentication over PLAINTEXT with old version of client that does not support SASL_AUTHENTICATE headers and new version of server.- Throws:
Exception
-
oldSaslPlainSslServerWithoutSaslAuthenticateHeader
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void oldSaslPlainSslServerWithoutSaslAuthenticateHeader(NioServerType serverType) throws Exception Tests good path SASL/PLAIN authentication over SSL with old version of server that does not support SASL_AUTHENTICATE headers and new version of client.- Throws:
Exception
-
oldSaslPlainSslClientWithoutSaslAuthenticateHeader
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void oldSaslPlainSslClientWithoutSaslAuthenticateHeader(NioServerType serverType) throws Exception Tests good path SASL/PLAIN authentication over SSL with old version of client that does not support SASL_AUTHENTICATE headers and new version of server.- Throws:
Exception
-
oldSaslScramSslServerWithoutSaslAuthenticateHeader
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void oldSaslScramSslServerWithoutSaslAuthenticateHeader(NioServerType serverType) throws Exception Tests good path SASL/SCRAM authentication over SSL with old version of server that does not support SASL_AUTHENTICATE headers and new version of client.- Throws:
Exception
-
oldSaslScramSslClientWithoutSaslAuthenticateHeader
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void oldSaslScramSslClientWithoutSaslAuthenticateHeader(NioServerType serverType) throws Exception Tests good path SASL/SCRAM authentication over SSL with old version of client that does not support SASL_AUTHENTICATE headers and new version of server.- Throws:
Exception
-
oldSaslPlainPlaintextServerWithoutSaslAuthenticateHeaderFailure
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void oldSaslPlainPlaintextServerWithoutSaslAuthenticateHeaderFailure(NioServerType serverType) throws Exception Tests SASL/PLAIN authentication failure over PLAINTEXT with old version of server that does not support SASL_AUTHENTICATE headers and new version of client.- Throws:
Exception
-
oldSaslPlainPlaintextClientWithoutSaslAuthenticateHeaderFailure
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void oldSaslPlainPlaintextClientWithoutSaslAuthenticateHeaderFailure(NioServerType serverType) throws Exception Tests SASL/PLAIN authentication failure over PLAINTEXT with old version of client that does not support SASL_AUTHENTICATE headers and new version of server.- Throws:
Exception
-
oldSaslScramPlaintextServerWithoutSaslAuthenticateHeaderFailure
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void oldSaslScramPlaintextServerWithoutSaslAuthenticateHeaderFailure(NioServerType serverType) throws Exception Tests SASL/SCRAM authentication failure over PLAINTEXT with old version of server that does not support SASL_AUTHENTICATE headers and new version of client.- Throws:
Exception
-
oldSaslScramPlaintextClientWithoutSaslAuthenticateHeaderFailure
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void oldSaslScramPlaintextClientWithoutSaslAuthenticateHeaderFailure(NioServerType serverType) throws Exception Tests SASL/SCRAM authentication failure over PLAINTEXT with old version of client that does not support SASL_AUTHENTICATE headers and new version of server.- Throws:
Exception
-
oldSaslPlainSslServerWithoutSaslAuthenticateHeaderFailure
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void oldSaslPlainSslServerWithoutSaslAuthenticateHeaderFailure(NioServerType serverType) throws Exception Tests SASL/PLAIN authentication failure over SSL with old version of server that does not support SASL_AUTHENTICATE headers and new version of client.- Throws:
Exception
-
oldSaslPlainSslClientWithoutSaslAuthenticateHeaderFailure
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void oldSaslPlainSslClientWithoutSaslAuthenticateHeaderFailure(NioServerType serverType) throws Exception Tests SASL/PLAIN authentication failure over SSL with old version of client that does not support SASL_AUTHENTICATE headers and new version of server.- Throws:
Exception
-
oldSaslScramSslServerWithoutSaslAuthenticateHeaderFailure
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void oldSaslScramSslServerWithoutSaslAuthenticateHeaderFailure(NioServerType serverType) throws Exception Tests SASL/SCRAM authentication failure over SSL with old version of server that does not support SASL_AUTHENTICATE headers and new version of client.- Throws:
Exception
-
oldSaslScramSslClientWithoutSaslAuthenticateHeaderFailure
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void oldSaslScramSslClientWithoutSaslAuthenticateHeaderFailure(NioServerType serverType) throws Exception Tests SASL/SCRAM authentication failure over SSL with old version of client that does not support SASL_AUTHENTICATE headers and new version of server.- Throws:
Exception
-
testValidSaslOauthBearerMechanism
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testValidSaslOauthBearerMechanism(NioServerType serverType) throws Exception Tests OAUTHBEARER client and server channels.- Throws:
Exception
-
testCannotReauthenticateWithDifferentPrincipal
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testCannotReauthenticateWithDifferentPrincipal(NioServerType serverType) throws Exception Re-authentication must fail if principal changes- Throws:
Exception
-
testAsyncAuthDelayInSynchronous
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(names="TCP") public void testAsyncAuthDelayInSynchronous(NioServerType serverType) throws Exception Make sure delays in synchronous SASL authentication aren't fatal.- Throws:
Exception
-
testAsyncAuthDelay
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(names="TCP") public void testAsyncAuthDelay(NioServerType serverType) throws Exception Make sure delays in asynchronous SASL authentication aren't fatal.- Throws:
Exception
-
testAsyncAuthTimeout
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(names="TCP") @Disabled("KSECURITY-1592") public void testAsyncAuthTimeout(NioServerType serverType) throws Exception Make sure timeouts in asynchronous SASL authentication cause the auth to fail.- Throws:
Exception
-
testAsyncAuthBadCredentials
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testAsyncAuthBadCredentials(NioServerType serverType) throws Exception Make sure invalid credentials in asynchronous SASL authentication cause the auth to fail.- Throws:
Exception
-
testReauthenticateWithLargeReauthValue
-
testCorrelationId
@Test public void testCorrelationId() -
testConvertListOffsetResponseToSaslHandshakeResponse
@Test public void testConvertListOffsetResponseToSaslHandshakeResponse() -
testCannotReauthenticateWithDifferentMechanism
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testCannotReauthenticateWithDifferentMechanism(NioServerType serverType) throws Exception Re-authentication must fail if mechanism changes- Throws:
Exception
-
testCannotReauthenticateAgainFasterThanOneSecond
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testCannotReauthenticateAgainFasterThanOneSecond(NioServerType serverType) throws Exception Second re-authentication must fail if it is sooner than one second after the first- Throws:
Exception
-
testRepeatedValidSaslPlainOverSsl
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testRepeatedValidSaslPlainOverSsl(NioServerType serverType) throws Exception Tests good path SASL/PLAIN client and server channels using SSL transport layer. Repeatedly tests successful re-authentication over several seconds.- Throws:
Exception
-
testValidSaslOauthBearerMechanismWithoutServerTokens
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testValidSaslOauthBearerMechanismWithoutServerTokens(NioServerType serverType) throws Exception Tests OAUTHBEARER client channels without tokens for the server.- Throws:
Exception
-
testInsufficientScopeSaslOauthBearerMechanism
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testInsufficientScopeSaslOauthBearerMechanism(NioServerType serverType) throws Exception Tests OAUTHBEARER fails the connection when the client presents a token with insufficient scope .- Throws:
Exception
-
testValidEndpointIdentificationSanDns
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testValidEndpointIdentificationSanDns(NioServerType serverType) throws Exception Tests that server certificate with SubjectAltName containing the valid hostname is accepted by a client that connects using the hostname and validates server endpoint.- Throws:
Exception
-
testValidEndpointIdentificationSanIp
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testValidEndpointIdentificationSanIp(NioServerType serverType) throws Exception Tests that server certificate with SubjectAltName containing valid IP address is accepted by a client that connects using IP address and validates server endpoint.- Throws:
Exception
-
testValidEndpointIdentificationCN
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testValidEndpointIdentificationCN(NioServerType serverType) throws Exception Tests that server certificate with CN containing valid hostname is accepted by a client that connects using hostname and validates server endpoint.- Throws:
Exception
-
testEndpointIdentificationNoReverseLookup
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testEndpointIdentificationNoReverseLookup(NioServerType serverType) throws Exception Tests that hostname verification is performed on the host name or address specified by the client without using reverse DNS lookup. Certificate is created with hostname, client connection uses IP address. Endpoint validation must fail.- Throws:
Exception
-
testPrincipalBuilderException
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testPrincipalBuilderException(NioServerType serverType) throws Exception Tests that connections are failed and closed properly if principal builder throws an exception while building the principal.- Throws:
Exception
-
testSwitchoverDisabled
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testSwitchoverDisabled(NioServerType serverType) throws Exception - Throws:
Exception
-
testPublicCredential
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testPublicCredential(NioServerType serverType) throws Exception - Throws:
Exception
-
testSslClientAuthDisabledForSaslSslListener
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testSslClientAuthDisabledForSaslSslListener(NioServerType serverType) throws Exception - Throws:
Exception
-
testSslClientAuthRequestedForSaslSslListener
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testSslClientAuthRequestedForSaslSslListener(NioServerType serverType) throws Exception - Throws:
Exception
-
testSslClientAuthRequiredForSaslSslListener
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testSslClientAuthRequiredForSaslSslListener(NioServerType serverType) throws Exception - Throws:
Exception
-
testSslClientAuthRequestedOverriddenForSaslSslListener
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testSslClientAuthRequestedOverriddenForSaslSslListener(NioServerType serverType) throws Exception - Throws:
Exception
-
testSslClientAuthRequiredOverriddenForSaslSslListener
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testSslClientAuthRequiredOverriddenForSaslSslListener(NioServerType serverType) throws Exception - Throws:
Exception
-
testServerSidePendingSendDuringReauthentication
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(NioServerType.class) public void testServerSidePendingSendDuringReauthentication(NioServerType serverType) throws Exception - Throws:
Exception
-
testMtlsClientAuthOverSaslSslListenerNONE
-
testMtlsClientAuthOverSaslSslListenerREQUESTED
-
testMtlsClientAuthOverSaslSslListenerREQUIRED
-
testPp2ValidateSslClientAuthDisabledForSaslSslListener
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(names="TCP") public void testPp2ValidateSslClientAuthDisabledForSaslSslListener(NioServerType serverType) throws Exception - Throws:
Exception
-
testPp2NoValidateSslClientAuthDisabledForSaslSslListener
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(names="TCP") public void testPp2NoValidateSslClientAuthDisabledForSaslSslListener(NioServerType serverType) throws Exception - Throws:
Exception
-
testPp2ValidateSslClientAuthRequestedForSaslSslListener
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(names="TCP") public void testPp2ValidateSslClientAuthRequestedForSaslSslListener(NioServerType serverType) throws Exception - Throws:
Exception
-
testPp2NoValidateSslClientAuthRequestedForSaslSslListener
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(names="TCP") public void testPp2NoValidateSslClientAuthRequestedForSaslSslListener(NioServerType serverType) throws Exception - Throws:
Exception
-
testPp2ValidateSslClientAuthRequiredForSaslSslListener
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(names="TCP") public void testPp2ValidateSslClientAuthRequiredForSaslSslListener(NioServerType serverType) throws Exception - Throws:
Exception
-
testPp2NoValidateSslClientAuthRequiredForSaslSslListener
@ParameterizedTest(name="{displayName}.protocol={0}") @EnumSource(names="TCP") public void testPp2NoValidateSslClientAuthRequiredForSaslSslListener(NioServerType serverType) throws Exception - Throws:
Exception
-