Browse Source

Merge pull request #16356 from thingsboard/fix/two-factor-auth-test-compilation

Fixed TwoFactorAuthTest compilation on lts-4.3
pull/16393/head
Viacheslav Klimov 1 month ago
committed by GitHub
parent
commit
778c2f3d1b
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 6
      application/src/test/java/org/thingsboard/server/controller/TwoFactorAuthTest.java

6
application/src/test/java/org/thingsboard/server/controller/TwoFactorAuthTest.java

@ -154,7 +154,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();
@ -164,7 +164,7 @@ public class TwoFactorAuthTest extends AbstractControllerTest {
@Test
public void testWsQueryToken_preVerificationTokenRejected() throws Exception {
configureTotpTwoFa();
logInWithPreVerificationToken(username, password);
logInWithMfaToken(username, password, Authority.PRE_VERIFICATION_TOKEN);
// The server accepts the handshake and closes the session right away from afterConnectionEstablished().
// connectBlocking() returns false when that close frame is processed before it checks the open state,
@ -179,7 +179,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);

Loading…
Cancel
Save