Search in sources :

Example 11 with ProvisioningContext

use of eu.bcvsolutions.idm.acc.domain.ProvisioningContext in project CzechIdMng by bcvsolutions.

the class DefaultProvisioningExecutorIntegrationTest method updateProvisioningOperation.

private SysProvisioningOperationDto updateProvisioningOperation(SysSystemEntityDto systemEntity, String firstname) {
    ProvisioningContext context = new ProvisioningContext();
    Map<ProvisioningAttributeDto, Object> accoutObject = createAccountObject(systemEntity, firstname);
    context.setAccountObject(accoutObject);
    // 
    // prepare provisioning operation
    SysSystemMappingDto systemMapping = helper.getDefaultMapping(systemEntity.getSystem());
    IcObjectClass objectClass = new IcObjectClassImpl(schemaObjectClassService.get(systemMapping.getObjectClass()).getObjectClassName());
    IcConnectorObject connectorObject = new IcConnectorObjectImpl(null, objectClass, null);
    SysProvisioningOperationDto.Builder operationBuilder = new SysProvisioningOperationDto.Builder().setOperationType(ProvisioningOperationType.UPDATE).setSystemEntity(systemEntity).setProvisioningContext(new ProvisioningContext(accoutObject, connectorObject));
    return operationBuilder.build();
}
Also used : ProvisioningContext(eu.bcvsolutions.idm.acc.domain.ProvisioningContext) IcObjectClassImpl(eu.bcvsolutions.idm.ic.impl.IcObjectClassImpl) IcObjectClass(eu.bcvsolutions.idm.ic.api.IcObjectClass) IcConnectorObject(eu.bcvsolutions.idm.ic.api.IcConnectorObject) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) IcConnectorObject(eu.bcvsolutions.idm.ic.api.IcConnectorObject) ProvisioningAttributeDto(eu.bcvsolutions.idm.acc.dto.ProvisioningAttributeDto) IcConnectorObjectImpl(eu.bcvsolutions.idm.ic.impl.IcConnectorObjectImpl) SysProvisioningOperationDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto)

Example 12 with ProvisioningContext

use of eu.bcvsolutions.idm.acc.domain.ProvisioningContext in project CzechIdMng by bcvsolutions.

the class DefaultSysProvisioningOperationServiceUnitTest method testReplaceArrayGuardedStringsInAccountObject.

@Test
public void testReplaceArrayGuardedStringsInAccountObject() {
    ProvisioningContext context = new ProvisioningContext();
    Map<ProvisioningAttributeDto, Object> accoutObject = new HashMap<>();
    context.setAccountObject(accoutObject);
    // 
    // fill properties
    ProvisioningAttributeDto guarded = new ProvisioningAttributeDto("guarded", AttributeMappingStrategyType.SET);
    GuardedString guardedOne = new GuardedString("one");
    GuardedString guardedTwo = new GuardedString("two");
    accoutObject.put(guarded, new GuardedString[] { guardedOne, guardedTwo });
    // 
    // run
    Map<String, Serializable> confidentiaValues = service.replaceGuardedStrings(context);
    // 
    // check
    assertEquals(2, confidentiaValues.size());
    assertEquals(guardedOne.asString(), confidentiaValues.get(service.createAccountObjectPropertyKey(guarded.getKey(), 0)));
    assertEquals(guardedTwo.asString(), confidentiaValues.get(service.createAccountObjectPropertyKey(guarded.getKey(), 1)));
    assertEquals(2, ((Object[]) accoutObject.get(guarded)).length);
    assertEquals(service.createAccountObjectPropertyKey(guarded.getKey(), 0), ((ConfidentialString) ((Object[]) accoutObject.get(guarded))[0]).getKey());
    assertEquals(service.createAccountObjectPropertyKey(guarded.getKey(), 1), ((ConfidentialString) ((Object[]) accoutObject.get(guarded))[1]).getKey());
}
Also used : ProvisioningContext(eu.bcvsolutions.idm.acc.domain.ProvisioningContext) Serializable(java.io.Serializable) HashMap(java.util.HashMap) ProvisioningAttributeDto(eu.bcvsolutions.idm.acc.dto.ProvisioningAttributeDto) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) ConfidentialString(eu.bcvsolutions.idm.core.security.api.domain.ConfidentialString) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) AbstractVerifiableUnitTest(eu.bcvsolutions.idm.test.api.AbstractVerifiableUnitTest) Test(org.junit.Test)

Example 13 with ProvisioningContext

use of eu.bcvsolutions.idm.acc.domain.ProvisioningContext in project CzechIdMng by bcvsolutions.

the class DefaultSysProvisioningOperationServiceUnitTest method testReplaceSingleGuardedStringsInAccountObject.

@Test
public void testReplaceSingleGuardedStringsInAccountObject() {
    ProvisioningContext context = new ProvisioningContext();
    Map<ProvisioningAttributeDto, Object> accoutObject = new HashMap<>();
    context.setAccountObject(accoutObject);
    // 
    // fill properties
    ProvisioningAttributeDto normal = new ProvisioningAttributeDto("normal", AttributeMappingStrategyType.SET);
    String normalValue = "one";
    accoutObject.put(normal, normalValue);
    ProvisioningAttributeDto guarded = new ProvisioningAttributeDto("guarded", AttributeMappingStrategyType.SET);
    GuardedString guardedValue = new GuardedString("one");
    accoutObject.put(guarded, guardedValue);
    // 
    // run
    Map<String, Serializable> confidentiaValues = service.replaceGuardedStrings(context);
    // 
    // check
    assertEquals(1, confidentiaValues.size());
    assertEquals(guardedValue.asString(), confidentiaValues.get(service.createAccountObjectPropertyKey(guarded.getKey(), 0)));
    assertEquals(normalValue, accoutObject.get(normal));
    assertNotEquals(guardedValue, accoutObject.get(guardedValue));
}
Also used : ProvisioningContext(eu.bcvsolutions.idm.acc.domain.ProvisioningContext) Serializable(java.io.Serializable) HashMap(java.util.HashMap) ProvisioningAttributeDto(eu.bcvsolutions.idm.acc.dto.ProvisioningAttributeDto) ConfidentialString(eu.bcvsolutions.idm.core.security.api.domain.ConfidentialString) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) AbstractVerifiableUnitTest(eu.bcvsolutions.idm.test.api.AbstractVerifiableUnitTest) Test(org.junit.Test)

Example 14 with ProvisioningContext

use of eu.bcvsolutions.idm.acc.domain.ProvisioningContext in project CzechIdMng by bcvsolutions.

the class DefaultSysProvisioningOperationServiceUnitTest method testReplaceGuardedStringsInEmptyAccountObject.

@Test
public void testReplaceGuardedStringsInEmptyAccountObject() {
    ProvisioningContext context = new ProvisioningContext();
    Map<ProvisioningAttributeDto, Object> accoutObjet = new HashMap<>();
    context.setAccountObject(accoutObjet);
    Map<String, Serializable> confidentialValues = service.replaceGuardedStrings(context);
    assertEquals(0, confidentialValues.size());
}
Also used : ProvisioningContext(eu.bcvsolutions.idm.acc.domain.ProvisioningContext) Serializable(java.io.Serializable) HashMap(java.util.HashMap) ProvisioningAttributeDto(eu.bcvsolutions.idm.acc.dto.ProvisioningAttributeDto) ConfidentialString(eu.bcvsolutions.idm.core.security.api.domain.ConfidentialString) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) AbstractVerifiableUnitTest(eu.bcvsolutions.idm.test.api.AbstractVerifiableUnitTest) Test(org.junit.Test)

Example 15 with ProvisioningContext

use of eu.bcvsolutions.idm.acc.domain.ProvisioningContext in project CzechIdMng by bcvsolutions.

the class DefaultSysProvisioningOperationServiceUnitTest method testReplaceCollectionGuardedStringsInAccountObject.

@Test
public void testReplaceCollectionGuardedStringsInAccountObject() {
    ProvisioningContext context = new ProvisioningContext();
    Map<ProvisioningAttributeDto, Object> accoutObject = new HashMap<>();
    context.setAccountObject(accoutObject);
    // 
    // fill properties
    ProvisioningAttributeDto guarded = new ProvisioningAttributeDto("guarded", AttributeMappingStrategyType.SET);
    GuardedString guardedOne = new GuardedString("one");
    GuardedString guardedTwo = new GuardedString("two");
    accoutObject.put(guarded, Lists.newArrayList(guardedOne, guardedTwo));
    // 
    // run
    Map<String, Serializable> confidentiaValues = service.replaceGuardedStrings(context);
    // 
    // check
    assertEquals(2, confidentiaValues.size());
    assertEquals(guardedOne.asString(), confidentiaValues.get(service.createAccountObjectPropertyKey(guarded.getKey(), 0)));
    assertEquals(guardedTwo.asString(), confidentiaValues.get(service.createAccountObjectPropertyKey(guarded.getKey(), 1)));
    assertEquals(2, ((List<?>) accoutObject.get(guarded)).size());
    assertEquals(service.createAccountObjectPropertyKey(guarded.getKey(), 0), ((ConfidentialString) ((List<?>) accoutObject.get(guarded)).get(0)).getKey());
    assertEquals(service.createAccountObjectPropertyKey(guarded.getKey(), 1), ((ConfidentialString) ((List<?>) accoutObject.get(guarded)).get(1)).getKey());
}
Also used : ProvisioningContext(eu.bcvsolutions.idm.acc.domain.ProvisioningContext) Serializable(java.io.Serializable) HashMap(java.util.HashMap) List(java.util.List) ProvisioningAttributeDto(eu.bcvsolutions.idm.acc.dto.ProvisioningAttributeDto) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) ConfidentialString(eu.bcvsolutions.idm.core.security.api.domain.ConfidentialString) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) AbstractVerifiableUnitTest(eu.bcvsolutions.idm.test.api.AbstractVerifiableUnitTest) Test(org.junit.Test)

Aggregations

ProvisioningContext (eu.bcvsolutions.idm.acc.domain.ProvisioningContext)16 ProvisioningAttributeDto (eu.bcvsolutions.idm.acc.dto.ProvisioningAttributeDto)11 SysProvisioningOperationDto (eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto)8 IcConnectorObject (eu.bcvsolutions.idm.ic.api.IcConnectorObject)7 IcConnectorObjectImpl (eu.bcvsolutions.idm.ic.impl.IcConnectorObjectImpl)7 SysSystemMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto)6 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)5 SysSystemEntityDto (eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto)5 OperationResult (eu.bcvsolutions.idm.core.api.entity.OperationResult)5 ConfidentialString (eu.bcvsolutions.idm.core.security.api.domain.ConfidentialString)5 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)5 Test (org.junit.Test)5 SysProvisioningArchiveDto (eu.bcvsolutions.idm.acc.dto.SysProvisioningArchiveDto)4 SysSchemaAttributeDto (eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto)4 SysSchemaObjectClassDto (eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto)4 ProvisioningException (eu.bcvsolutions.idm.acc.exception.ProvisioningException)4 AbstractVerifiableUnitTest (eu.bcvsolutions.idm.test.api.AbstractVerifiableUnitTest)4 Serializable (java.io.Serializable)4 HashMap (java.util.HashMap)4 SysProvisioningOperationFilter (eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter)3