use of org.apache.syncope.common.lib.to.DomainTO in project syncope by apache.
the class DomainITCase method create.
@Test
public void create() {
DomainTO domain = new DomainTO();
domain.setKey("last");
domain.setAdminCipherAlgorithm(CipherAlgorithm.SSHA512);
domain.setAdminPwd("password");
try {
domainService.create(domain);
fail("This should not happen");
} catch (SyncopeClientException e) {
assertEquals(ClientExceptionType.NotFound, e.getType());
}
}
use of org.apache.syncope.common.lib.to.DomainTO in project syncope by apache.
the class DomainITCase method update.
@Test
public void update() {
DomainTO two = domainService.read("Two");
assertNotNull(two);
try {
// 1. change admin pwd for domain Two
two.setAdminCipherAlgorithm(CipherAlgorithm.AES);
two.setAdminPwd("password3");
domainService.update(two);
// 2. attempt to access with old pwd -> fail
try {
new SyncopeClientFactoryBean().setAddress(ADDRESS).setDomain("Two").setContentType(clientFactory.getContentType()).create(ADMIN_UNAME, "password2").self();
} catch (AccessControlException e) {
assertNotNull(e);
}
// 3. access with new pwd -> succeed
new SyncopeClientFactoryBean().setAddress(ADDRESS).setDomain("Two").setContentType(clientFactory.getContentType()).create(ADMIN_UNAME, "password3").self();
} finally {
restoreTwo();
}
}
use of org.apache.syncope.common.lib.to.DomainTO in project syncope by apache.
the class DomainITCase method delete.
@Test
public void delete() {
DomainTO two = domainService.read("Two");
assertNotNull(two);
try {
domainService.delete(two.getKey());
try {
domainService.read(two.getKey());
fail("This should not happen");
} catch (SyncopeClientException e) {
assertEquals(ClientExceptionType.NotFound, e.getType());
}
} finally {
restoreTwo();
}
}
use of org.apache.syncope.common.lib.to.DomainTO in project syncope by apache.
the class DomainDataBinderImpl method getDomainTO.
@Override
public DomainTO getDomainTO(final Domain domain) {
DomainTO domainTO = new DomainTO();
domainTO.setKey(domain.getKey());
domainTO.setAdminCipherAlgorithm(domain.getAdminCipherAlgorithm());
domainTO.setAdminPwd(domainTO.getAdminPwd());
return domainTO;
}
use of org.apache.syncope.common.lib.to.DomainTO in project syncope by apache.
the class DomainLogic method delete.
@PreAuthorize("hasRole('" + StandardEntitlement.DOMAIN_DELETE + "') and authentication.details.domain == " + "T(org.apache.syncope.common.lib.SyncopeConstants).MASTER_DOMAIN")
public DomainTO delete(final String key) {
Domain domain = domainDAO.find(key);
if (domain == null) {
LOG.error("Could not find domain '" + key + "'");
throw new NotFoundException(key);
}
DomainTO deleted = binder.getDomainTO(domain);
domainDAO.delete(key);
return deleted;
}
Aggregations