use of org.pentaho.platform.security.userroledao.ws.UserRoleSecurityInfo in project pentaho-kettle by pentaho.
the class UserRoleDelegateTest method setUp.
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
when(roleWebService.getUserRoleSecurityInfo()).thenReturn(new UserRoleSecurityInfo());
delegate = new UserRoleDelegate(log, roleListWebService, roleWebService);
delegate.managed = true;
delegate.updateUserRoleInfo();
}
use of org.pentaho.platform.security.userroledao.ws.UserRoleSecurityInfo in project pentaho-kettle by pentaho.
the class UserRoleHelperTest method convertFromProxyPentahoUsers_ReturnsEmptyList_WhenUsersAreAbsent.
@Test
public void convertFromProxyPentahoUsers_ReturnsEmptyList_WhenUsersAreAbsent() throws Exception {
UserRoleSecurityInfo info = new UserRoleSecurityInfo();
info.setUsers(null);
IRoleSupportSecurityManager manager = mockSecurityManager(false);
List<IUser> users = convertFromProxyPentahoUsers(info, manager);
assertNotNull(users);
assertTrue(users.isEmpty());
}
use of org.pentaho.platform.security.userroledao.ws.UserRoleSecurityInfo in project pentaho-platform by pentaho.
the class UserRoleWebServiceBase method testGetUserRoleSecurityInfo.
@Test
public void testGetUserRoleSecurityInfo() throws Exception {
IUserRoleWebService service = getUserRoleWebService();
mockUserAsAdmin(false);
try {
service.getUserRoleSecurityInfo();
Assert.fail();
} catch (UserRoleException e) {
// should this be 0001, not admin?
Assert.assertTrue(e.getMessage().indexOf("ERROR_0001") >= 0);
}
mockUserAsAdmin(true);
UserRoleSecurityInfo info = service.getUserRoleSecurityInfo();
Assert.assertNotNull(info);
Assert.assertEquals(2, info.getRoles().size());
Assert.assertEquals(2, info.getUsers().size());
Assert.assertEquals(2, info.getAssignments().size());
}
use of org.pentaho.platform.security.userroledao.ws.UserRoleSecurityInfo in project pentaho-kettle by pentaho.
the class UserRoleHelperTest method convertFromProxyPentahoUsers_CopiesEachUser.
@Test
public void convertFromProxyPentahoUsers_CopiesEachUser() throws Exception {
UserRoleSecurityInfo info = new UserRoleSecurityInfo();
info.setUsers(Arrays.asList(pentahoUser("user1"), pentahoUser("user2")));
IRoleSupportSecurityManager manager = mockSecurityManager(false);
List<IUser> users = convertFromProxyPentahoUsers(info, manager);
assertNotNull(users);
assertEquals(2, users.size());
assertEquals("user1", users.get(0).getName());
assertEquals("user2", users.get(1).getName());
}
use of org.pentaho.platform.security.userroledao.ws.UserRoleSecurityInfo in project pentaho-platform by pentaho.
the class UserRoleEndpointIT method main.
public static void main(String[] args) throws Exception {
// test against a live server, dev use only
System.setProperty("com.sun.xml.ws.monitoring.endpoint", "true");
System.setProperty("com.sun.xml.ws.monitoring.client", "true");
System.setProperty("com.sun.xml.ws.monitoring.registrationDebug", "FINE");
System.setProperty("com.sun.xml.ws.monitoring.runtimeDebug", "true");
Service service = Service.create(new URL("http://localhost:8080/pentaho/webservices/userRoleService?wsdl"), new QName("http://www.pentaho.org/ws/1.0", "userRoleService"));
IUserRoleWebService userRoleWebService = service.getPort(IUserRoleWebService.class);
((BindingProvider) userRoleWebService).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "admin");
((BindingProvider) userRoleWebService).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "password");
// accept cookies to maintain session on server
((BindingProvider) userRoleWebService).getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true);
UserRoleSecurityInfo info = userRoleWebService.getUserRoleSecurityInfo();
// should be Authenticated
System.out.println(info.getDefaultRoles().get(0));
}
Aggregations