From 5e9ec9ed23e2a89cc71062140e24588d100852af Mon Sep 17 00:00:00 2001 From: Viacheslav Klimov Date: Thu, 15 Oct 2026 10:23:34 +0300 Subject: [PATCH] Use logInWithMfaToken in WebSocket 2FA tests --- .../thingsboard/server/controller/TwoFactorAuthTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/application/src/test/java/org/thingsboard/server/controller/TwoFactorAuthTest.java b/application/src/test/java/org/thingsboard/server/controller/TwoFactorAuthTest.java index 361c1c4fec..f2b5ba2f45 100644 --- a/application/src/test/java/org/thingsboard/server/controller/TwoFactorAuthTest.java +++ b/application/src/test/java/org/thingsboard/server/controller/TwoFactorAuthTest.java @@ -152,7 +152,7 @@ public class TwoFactorAuthTest extends AbstractControllerTest { @Test public void testWsAuthCmd_preVerificationTokenRejected() throws Exception { configureTotpTwoFa(); - logInWithPreVerificationToken(username, password); + logInWithMfaToken(username, password, Authority.PRE_VERIFICATION_TOKEN); wsClient = buildAndConnectWebSocketClient(); @@ -162,7 +162,7 @@ public class TwoFactorAuthTest extends AbstractControllerTest { @Test public void testWsQueryToken_preVerificationTokenRejected() throws Exception { configureTotpTwoFa(); - logInWithPreVerificationToken(username, password); + logInWithMfaToken(username, password, Authority.PRE_VERIFICATION_TOKEN); wsClient = buildAndConnectWebSocketClient("/api/ws?token=" + token); @@ -172,7 +172,7 @@ public class TwoFactorAuthTest extends AbstractControllerTest { @Test public void testWs_accessTokenAcceptedAfterTwoFa() throws Exception { TotpTwoFaAccountConfig totpTwoFaAccountConfig = configureTotpTwoFa(); - logInWithPreVerificationToken(username, password); + logInWithMfaToken(username, password, Authority.PRE_VERIFICATION_TOKEN); JsonNode tokenPair = readResponse(doPost("/api/auth/2fa/verification/check?providerType=TOTP&verificationCode=" + getCorrectTotp(totpTwoFaAccountConfig)) .andExpect(status().isOk()), JsonNode.class); validateAndSetJwtToken(tokenPair, username);