aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-webserver-auth/src
diff options
context:
space:
mode:
authorWouter Admiraal <wouter.admiraal@sonarsource.com>2021-04-29 11:26:05 +0200
committersonartech <sonartech@sonarsource.com>2021-04-29 20:03:27 +0000
commit9fcb622a986e9b8110cccf1be0467cd43a8f58dc (patch)
treef0c1c2811ce26545e1db5b4cc2a399c4bd1fd6d4 /server/sonar-webserver-auth/src
parentdb8f11adf1df8de48ca9a4ec00e820f6636db6d5 (diff)
downloadsonarqube-9fcb622a986e9b8110cccf1be0467cd43a8f58dc.tar.gz
sonarqube-9fcb622a986e9b8110cccf1be0467cd43a8f58dc.zip
SONAR-14320 Fix unit test
Diffstat (limited to 'server/sonar-webserver-auth/src')
-rw-r--r--server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/CredentialsLocalAuthenticationTest.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/CredentialsLocalAuthenticationTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/CredentialsLocalAuthenticationTest.java
index 7cac4072035..2d7ab741fb3 100644
--- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/CredentialsLocalAuthenticationTest.java
+++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/CredentialsLocalAuthenticationTest.java
@@ -310,9 +310,13 @@ public class CredentialsLocalAuthenticationTest {
.setCryptedPassword(DigestUtils.sha1Hex("--" + salt + "--" + password + "--"))
.setSalt(salt);
+ assertThatThrownBy(() -> underTest.authenticate(dbSession, userInvalidHash, "WHATEVER", AuthenticationEvent.Method.BASIC))
+ .isInstanceOf(AuthenticationException.class)
+ .hasMessage("invalid hash stored");
+
UserDto userInvalidIterations = newUserDto()
.setHashMethod(PBKDF2.name())
- .setCryptedPassword("$$")
+ .setCryptedPassword("a$")
.setSalt(salt);
assertThatThrownBy(() -> underTest.authenticate(dbSession, userInvalidIterations, "WHATEVER", AuthenticationEvent.Method.BASIC))