'How to verify / compare / equal BCrypt hashed Password with a given Password in Quarkus / Wildfly

I have implemented basic auth using security with jpa. All my REST-Endpoints can now verify the Authorization header of a client request. The verfication of the password is done by the framework. Now i need to be able to verify a Password with the stored password hash.

With the default configuration the user password is stored as hash with the function BcryptUtil.bcryptHash(String password). How can i check if a given password string matches the stored bcrypt hash value?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source