Search in sources :

Example 6 with PasswordEncoderProperties

use of org.apereo.cas.configuration.model.core.authentication.PasswordEncoderProperties in project cas by apereo.

the class DefaultPasswordEncoderTests method verifyPasswordEncoderBySHA1.

@Test
public void verifyPasswordEncoderBySHA1() {
    final PasswordEncoderProperties p = new PasswordEncoderProperties();
    p.setType(PasswordEncoderProperties.PasswordEncoderTypes.DEFAULT.name());
    p.setEncodingAlgorithm("SHA-1");
    p.setCharacterEncoding("UTF-8");
    final PasswordEncoder e = Beans.newPasswordEncoder(p);
    assertTrue(e.matches("asd123", "2891baceeef1652ee698294da0e71ba78a2a4064"));
}
Also used : PasswordEncoder(org.springframework.security.crypto.password.PasswordEncoder) StandardPasswordEncoder(org.springframework.security.crypto.password.StandardPasswordEncoder) PasswordEncoderProperties(org.apereo.cas.configuration.model.core.authentication.PasswordEncoderProperties) Test(org.junit.Test)

Aggregations

PasswordEncoderProperties (org.apereo.cas.configuration.model.core.authentication.PasswordEncoderProperties)6 PasswordEncoder (org.springframework.security.crypto.password.PasswordEncoder)5 StandardPasswordEncoder (org.springframework.security.crypto.password.StandardPasswordEncoder)5 Test (org.junit.Test)4 SecureRandom (java.security.SecureRandom)1 DefaultPasswordEncoder (org.apereo.cas.util.crypto.DefaultPasswordEncoder)1 Before (org.junit.Before)1 BeanCreationException (org.springframework.beans.factory.BeanCreationException)1 ClassPathResource (org.springframework.core.io.ClassPathResource)1 BCryptPasswordEncoder (org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder)1 NoOpPasswordEncoder (org.springframework.security.crypto.password.NoOpPasswordEncoder)1 Pbkdf2PasswordEncoder (org.springframework.security.crypto.password.Pbkdf2PasswordEncoder)1 SCryptPasswordEncoder (org.springframework.security.crypto.scrypt.SCryptPasswordEncoder)1