Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #17108: cannot login in Rudder 6.1 #2901

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -44,11 +44,13 @@ import java.nio.charset.StandardCharsets
import java.security.MessageDigest
import java.security.SecureRandom
import java.util.Collection

import com.normation.rudder._
import com.normation.rudder.api._
import com.normation.rudder.domain.logger.ApplicationLogger
import com.normation.rudder.domain.logger.PluginLogger
import com.normation.rudder.rest.RoleApiMapping
import org.bouncycastle.crypto.DataLengthException
import org.bouncycastle.util.encoders.Hex
import org.springframework.security.core.GrantedAuthority
import org.springframework.security.core.userdetails.UserDetails
Expand Down Expand Up @@ -115,7 +117,13 @@ object PasswordEncoder {
OpenBSDBCrypt.generate("2b", rawPassword.toString.toCharArray, salt, RudderConfig.RUDDER_BCRYPT_COST)
}
override def matches(rawPassword: CharSequence, encodedPassword: String): Boolean = {
OpenBSDBCrypt.checkPassword(encodedPassword, rawPassword.toString.toCharArray)
try {
OpenBSDBCrypt.checkPassword(encodedPassword, rawPassword.toString.toCharArray)
} catch {
case e =>
ApplicationLogger.error(s"Invalid password format: ${e.getMessage}")
false
}
}
}
}
Expand Down