use of org.apereo.cas.configuration.model.core.authentication.PasswordEncoderProperties in project cas by apereo.
the class DefaultPasswordEncoderTests method verifyPasswordEncoderBySHA256.
@Test
public void verifyPasswordEncoderBySHA256() {
val p = new PasswordEncoderProperties();
p.setType(PasswordEncoderProperties.PasswordEncoderTypes.DEFAULT.name());
p.setEncodingAlgorithm("SHA-256");
p.setCharacterEncoding("UTF-8");
val e = PasswordEncoderUtils.newPasswordEncoder(p, mock(ApplicationContext.class));
assertTrue(e.matches("asd123", "54d5cb2d332dbdb4850293caae4559ce88b65163f1ea5d4e4b3ac49d772ded14"));
}
use of org.apereo.cas.configuration.model.core.authentication.PasswordEncoderProperties in project cas by apereo.
the class DefaultPasswordEncoderTests method verifyPasswordEncoderByCustomClassName.
@Test
public void verifyPasswordEncoderByCustomClassName() {
val p = new PasswordEncoderProperties();
p.setType(StandardPasswordEncoder.class.getName());
p.setSecret("SECRET");
val e = PasswordEncoderUtils.newPasswordEncoder(p, mock(ApplicationContext.class));
assertNotNull(e);
}
use of org.apereo.cas.configuration.model.core.authentication.PasswordEncoderProperties in project cas by apereo.
the class DefaultPasswordEncoderTests method verifyPasswordEncoderBySHA1.
@Test
public void verifyPasswordEncoderBySHA1() {
val p = new PasswordEncoderProperties();
p.setType(PasswordEncoderProperties.PasswordEncoderTypes.DEFAULT.name());
p.setEncodingAlgorithm("SHA-1");
p.setCharacterEncoding("UTF-8");
val e = PasswordEncoderUtils.newPasswordEncoder(p, mock(ApplicationContext.class));
assertTrue(e.matches("asd123", "2891baceeef1652ee698294da0e71ba78a2a4064"));
}
Aggregations