All Downloads are FREE. Search and download functionalities are using the official Maven repository.

restx.security.BCryptCredentialsStrategy Maven / Gradle / Ivy

The newest version!
package restx.security;

import org.mindrot.jbcrypt.BCrypt;

/**
 * A BCrypt based credentials checker.
 *
 * This is the most recommended credentials checker at the time being.
 */
public class BCryptCredentialsStrategy implements CredentialsStrategy {
    @Override
    public boolean checkCredentials(String userName, String providedPasswordHash, String storedCredentials) {
        return BCrypt.checkpw(providedPasswordHash, storedCredentials);
    }

    @Override
    public String cryptCredentialsForStorage(String userName, String providedPasswordHash) {
        return BCrypt.hashpw(providedPasswordHash, BCrypt.gensalt());
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy