use of eu.bcvsolutions.idm.core.security.api.dto.LoginDto in project CzechIdMng by bcvsolutions.
the class IdentityTransitiveEvaluatorsIntegrationTest method testUpdateIdentityContract.
@Test(expected = ForbiddenEntityException.class)
public void testUpdateIdentityContract() {
IdmIdentityDto identity = prepareIdentityProfile();
//
try {
loginService.login(new LoginDto(identity.getUsername(), identity.getPassword()));
//
IdmIdentityContractDto contract = identityContractService.getPrimeContract(identity.getId());
//
identityContractService.save(contract, IdmBasePermission.UPDATE);
} finally {
logout();
}
}
use of eu.bcvsolutions.idm.core.security.api.dto.LoginDto in project CzechIdMng by bcvsolutions.
the class RoleForRequestEvaluatorIntegrationTest method deleteRoleAsUser.
private Exception deleteRoleAsUser(IdmIdentityDto user, IdmRoleDto role) {
try {
loginService.login(new LoginDto(user.getUsername(), new GuardedString(TEST_PWD)));
roleService.delete(role, IdmBasePermission.DELETE);
} catch (Exception ex) {
return ex;
} finally {
logout();
}
return null;
}
use of eu.bcvsolutions.idm.core.security.api.dto.LoginDto in project CzechIdMng by bcvsolutions.
the class RoleForRequestEvaluatorIntegrationTest method saveRoleAsUser.
private Exception saveRoleAsUser(IdmIdentityDto user, IdmRoleDto found1, String testDescription) {
try {
loginService.login(new LoginDto(user.getUsername(), new GuardedString(TEST_PWD)));
IdmRoleDto fnd = roleService.get(found1.getId());
fnd.setDescription(testDescription);
roleService.save(fnd, IdmBasePermission.UPDATE);
} catch (Exception ex) {
return ex;
} finally {
logout();
}
return null;
}
use of eu.bcvsolutions.idm.core.security.api.dto.LoginDto in project CzechIdMng by bcvsolutions.
the class RoleForRequestEvaluatorIntegrationTest method getRoleAsUser.
private Page<IdmRoleDto> getRoleAsUser(IdmIdentityDto user, IdmRoleDto role) {
try {
loginService.login(new LoginDto(user.getUsername(), new GuardedString(TEST_PWD)));
//
IdmRoleFilter rf = getRoleFilter("name", role.getName());
Page<IdmRoleDto> readRole = roleService.find(rf, null, IdmBasePermission.READ);
return readRole;
} finally {
logout();
}
}
use of eu.bcvsolutions.idm.core.security.api.dto.LoginDto in project CzechIdMng by bcvsolutions.
the class RoleRequestByIdentityEvaluatorIntegrationTest method testCanReadRoleRequestByIdentity.
@Test
public void testCanReadRoleRequestByIdentity() {
IdmIdentityDto identityOne = helper.createIdentity();
IdmIdentityDto identityTwo = helper.createIdentity();
// create policy
IdmRoleDto role = helper.createRole();
helper.createUuidPolicy(role.getId(), identityOne.getId(), IdmBasePermission.READ);
helper.createIdentityRole(identityTwo, role);
helper.createIdentityRole(identityTwo, roleService.getByCode(InitDemoData.DEFAULT_ROLE_NAME));
IdmRoleRequestDto roleRequest = helper.assignRoles(helper.getPrimeContract(identityOne.getId()), role);
//
try {
loginService.login(new LoginDto(identityTwo.getUsername(), identityTwo.getPassword()));
//
Page<IdmRoleRequestDto> roleRequests = roleRequestService.find(null, IdmBasePermission.READ);
assertEquals(1, roleRequests.getTotalElements());
//
IdmRoleRequestDto read = roleRequestService.get(roleRequest.getId(), IdmBasePermission.READ);
assertEquals(roleRequest, read);
//
IdmConceptRoleRequestFilter filter = new IdmConceptRoleRequestFilter();
filter.setRoleRequestId(roleRequest.getId());
Page<IdmConceptRoleRequestDto> concepts = conceptRoleRequestController.find(filter, null, IdmBasePermission.READ);
assertEquals(1, concepts.getTotalElements());
} finally {
logout();
}
}
Aggregations