Skip to content

Commit e887ea6

Browse files
committed
fix: refined sasl eval error msg format and relax test assertions
1 parent 1cfce79 commit e887ea6

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

fluss-common/src/main/java/org/apache/fluss/security/auth/sasl/authenticator/SaslServerAuthenticator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public byte[] evaluateResponse(byte[] token) throws AuthenticationException {
144144
(PrivilegedExceptionAction<byte[]>) () -> saslServer.evaluateResponse(token));
145145
} catch (Exception e) {
146146
throw new AuthenticationException(
147-
String.format("Failed to evaluate SASL response,reason is %s", e.getMessage()));
147+
String.format("Failed to evaluate SASL response: %s", e.getMessage()));
148148
}
149149
}
150150

fluss-rpc/src/test/java/org/apache/fluss/rpc/netty/authenticate/SaslAuthenticationITCase.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ void testClientWrongPassword() {
8080
assertThatThrownBy(() -> testAuthentication(clientConfig))
8181
.cause()
8282
.isExactlyInstanceOf(AuthenticationException.class)
83-
.hasMessage("Authentication failed: Invalid username or password");
83+
.hasMessageContaining("Authentication failed: Invalid username or password");
8484
}
8585

8686
@Test
@@ -140,7 +140,7 @@ void testServerMechanismWithListenerAndMechanism() throws Exception {
140140
assertThatThrownBy(() -> testAuthentication(clientConfig, serverConfig))
141141
.cause()
142142
.isExactlyInstanceOf(AuthenticationException.class)
143-
.hasMessage("Authentication failed: Invalid username or password");
143+
.hasMessageContaining("Authentication failed: Invalid username or password");
144144
clientConfig.setString(
145145
"client.security.sasl.jaas.config",
146146
"org.apache.fluss.security.auth.sasl.plain.PlainLoginModule required username=\"bob\" password=\"bob-secret\";");
@@ -175,7 +175,7 @@ void testSimplifyUsernameAndPassword() throws Exception {
175175
assertThatThrownBy(() -> testAuthentication(clientConfig))
176176
.cause()
177177
.isExactlyInstanceOf(AuthenticationException.class)
178-
.hasMessage("Authentication failed: Invalid username or password");
178+
.hasMessageContaining("Authentication failed: Invalid username or password");
179179
clientConfig.setString("client.security.sasl.password", "alice-secret");
180180
testAuthentication(clientConfig);
181181
}

0 commit comments

Comments
 (0)