use of org.pentaho.platform.repository2.userroledao.jackrabbit.security.DefaultPentahoPasswordEncoder in project pentaho-platform by pentaho.
the class SpringSecurityHibernateConfigTest method testGetPasswordEncoder.
@Test
public void testGetPasswordEncoder() throws Exception {
config = new SpringSecurityHibernateConfig(document);
Node node = mock(Node.class);
when(node.getText()).thenReturn(DefaultPentahoPasswordEncoder.class.getName());
when(document.selectSingleNode(anyString())).thenReturn(node);
PasswordEncoder passwordEncoder = config.getPasswordEncoder();
assertTrue(passwordEncoder instanceof DefaultPentahoPasswordEncoder);
}
use of org.pentaho.platform.repository2.userroledao.jackrabbit.security.DefaultPentahoPasswordEncoder in project pentaho-platform by pentaho.
the class DefaultPentahoPasswordEncoderTest method testInvalidCredentials.
@Test
public void testInvalidCredentials() {
DefaultPentahoPasswordEncoder passwordEncoder = new DefaultPentahoPasswordEncoder();
Assert.assertFalse(passwordEncoder.isPasswordValid("password", null, null));
Assert.assertFalse(passwordEncoder.isPasswordValid(passwordEncoder.encodePassword("", null), "password", null));
Assert.assertFalse(passwordEncoder.isPasswordValid(null, null, null));
}
use of org.pentaho.platform.repository2.userroledao.jackrabbit.security.DefaultPentahoPasswordEncoder in project pentaho-platform by pentaho.
the class DefaultPentahoPasswordEncoderTest method testValidCredentials.
@Test
public void testValidCredentials() {
DefaultPentahoPasswordEncoder passwordEncoder = new DefaultPentahoPasswordEncoder();
String password = "helloworld";
String encryptedPassword = new UserRoleWebServiceBase.PasswordEncoderMock().encodePassword(password, null);
Assert.assertTrue(passwordEncoder.isPasswordValid(encryptedPassword, password, null));
}
Aggregations