Search in sources :

Example 1 with DefaultPentahoPasswordEncoder

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);
}
Also used : DefaultPentahoPasswordEncoder(org.pentaho.platform.repository2.userroledao.jackrabbit.security.DefaultPentahoPasswordEncoder) PasswordEncoder(org.springframework.security.authentication.encoding.PasswordEncoder) Node(org.dom4j.Node) DefaultPentahoPasswordEncoder(org.pentaho.platform.repository2.userroledao.jackrabbit.security.DefaultPentahoPasswordEncoder) Test(org.junit.Test)

Example 2 with 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));
}
Also used : DefaultPentahoPasswordEncoder(org.pentaho.platform.repository2.userroledao.jackrabbit.security.DefaultPentahoPasswordEncoder) Test(org.junit.Test)

Example 3 with DefaultPentahoPasswordEncoder

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));
}
Also used : UserRoleWebServiceBase(org.pentaho.test.platform.security.userroledao.ws.UserRoleWebServiceBase) DefaultPentahoPasswordEncoder(org.pentaho.platform.repository2.userroledao.jackrabbit.security.DefaultPentahoPasswordEncoder) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 DefaultPentahoPasswordEncoder (org.pentaho.platform.repository2.userroledao.jackrabbit.security.DefaultPentahoPasswordEncoder)3 Node (org.dom4j.Node)1 UserRoleWebServiceBase (org.pentaho.test.platform.security.userroledao.ws.UserRoleWebServiceBase)1 PasswordEncoder (org.springframework.security.authentication.encoding.PasswordEncoder)1