Search in sources :

Example 11 with IcObjectClassImpl

use of eu.bcvsolutions.idm.ic.impl.IcObjectClassImpl in project CzechIdMng by bcvsolutions.

the class ConnIdIcConvertUtil method convertConnIdObjectClass.

public static IcObjectClass convertConnIdObjectClass(ObjectClass objectClass) {
    if (objectClass == null) {
        return null;
    }
    IcObjectClassImpl objectClassDto = new IcObjectClassImpl(objectClass.getObjectClassValue());
    objectClassDto.setDisplayName(objectClass.getDisplayNameKey());
    return objectClassDto;
}
Also used : IcObjectClassImpl(eu.bcvsolutions.idm.ic.impl.IcObjectClassImpl)

Example 12 with IcObjectClassImpl

use of eu.bcvsolutions.idm.ic.impl.IcObjectClassImpl in project CzechIdMng by bcvsolutions.

the class CzechIdMIcConnectorService method readObject.

@Override
public IcConnectorObject readObject(IcConnectorInstance connectorInstance, IcConnectorConfiguration connectorConfiguration, IcObjectClass objectClass, IcUidAttribute uid) {
    Assert.notNull(connectorInstance);
    Assert.notNull(connectorInstance.getConnectorKey());
    Assert.notNull(connectorConfiguration);
    Assert.notNull(uid);
    String key = connectorInstance.getConnectorKey().toString();
    LOG.debug("Read object - CzechIdM (Uid= {} {})", uid, key);
    if (objectClass == null) {
        objectClass = new IcObjectClassImpl(IcObjectClassInfo.ACCOUNT);
    }
    IcConnector connector = this.getConnectorInstance(connectorInstance, connectorConfiguration);
    if (!(connector instanceof IcCanRead)) {
        throw new IcException(MessageFormat.format("Connector [{0}] not supports read operation!", key));
    }
    IcConnectorObject object = ((IcCanRead) connector).read(uid, objectClass);
    LOG.debug("Readed object - CzechIdM ({}) Uid= {}", object, uid);
    return object;
}
Also used : IcObjectClassImpl(eu.bcvsolutions.idm.ic.impl.IcObjectClassImpl) IcConnectorObject(eu.bcvsolutions.idm.ic.api.IcConnectorObject) IcCanRead(eu.bcvsolutions.idm.ic.api.operation.IcCanRead) IcConnector(eu.bcvsolutions.idm.ic.api.IcConnector) IcException(eu.bcvsolutions.idm.ic.exception.IcException) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString)

Example 13 with IcObjectClassImpl

use of eu.bcvsolutions.idm.ic.impl.IcObjectClassImpl in project CzechIdMng by bcvsolutions.

the class CzechIdMIcConnectorService method createObject.

@Override
public IcUidAttribute createObject(IcConnectorInstance connectorInstance, IcConnectorConfiguration connectorConfiguration, IcObjectClass objectClass, List<IcAttribute> attributes) {
    Assert.notNull(connectorInstance);
    Assert.notNull(connectorInstance.getConnectorKey());
    Assert.notNull(connectorConfiguration);
    Assert.notNull(attributes);
    String key = connectorInstance.getConnectorKey().toString();
    LOG.debug("Create object - CzechIdM ({} {})", key, attributes.toString());
    if (objectClass == null) {
        objectClass = new IcObjectClassImpl(IcObjectClassInfo.ACCOUNT);
    }
    IcConnector connector = this.getConnectorInstance(connectorInstance, connectorConfiguration);
    if (!(connector instanceof IcCanCreate)) {
        throw new IcException(MessageFormat.format("Connector [{0}] not supports create operation!", key));
    }
    IcUidAttribute uid = ((IcCanCreate) connector).create(objectClass, attributes);
    LOG.debug("Created object - CzechIdM ({} {}) Uid= {}", key, attributes.toString(), uid);
    return null;
}
Also used : IcObjectClassImpl(eu.bcvsolutions.idm.ic.impl.IcObjectClassImpl) IcCanCreate(eu.bcvsolutions.idm.ic.api.operation.IcCanCreate) IcConnector(eu.bcvsolutions.idm.ic.api.IcConnector) IcException(eu.bcvsolutions.idm.ic.exception.IcException) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) IcUidAttribute(eu.bcvsolutions.idm.ic.api.IcUidAttribute)

Example 14 with IcObjectClassImpl

use of eu.bcvsolutions.idm.ic.impl.IcObjectClassImpl in project CzechIdMng by bcvsolutions.

the class CzechIdMIcConnectorService method deleteObject.

@Override
public void deleteObject(IcConnectorInstance connectorInstance, IcConnectorConfiguration connectorConfiguration, IcObjectClass objectClass, IcUidAttribute uid) {
    Assert.notNull(connectorInstance);
    Assert.notNull(connectorInstance.getConnectorKey());
    Assert.notNull(connectorConfiguration);
    Assert.notNull(uid);
    String key = connectorInstance.getConnectorKey().toString();
    LOG.debug("Delete object - CzechIdM (Uid= {} {})", uid, key);
    if (objectClass == null) {
        objectClass = new IcObjectClassImpl(IcObjectClassInfo.ACCOUNT);
    }
    IcConnector connector = this.getConnectorInstance(connectorInstance, connectorConfiguration);
    if (!(connector instanceof IcCanDelete)) {
        throw new IcException(MessageFormat.format("Connector [{0}] not supports delete operation!", key));
    }
    ((IcCanDelete) connector).delete(uid, objectClass);
    LOG.debug("Deleted object - CzechIdM ({}) Uid= {}", key, uid);
}
Also used : IcCanDelete(eu.bcvsolutions.idm.ic.api.operation.IcCanDelete) IcObjectClassImpl(eu.bcvsolutions.idm.ic.impl.IcObjectClassImpl) IcConnector(eu.bcvsolutions.idm.ic.api.IcConnector) IcException(eu.bcvsolutions.idm.ic.exception.IcException) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString)

Example 15 with IcObjectClassImpl

use of eu.bcvsolutions.idm.ic.impl.IcObjectClassImpl in project CzechIdMng by bcvsolutions.

the class BasicVirtualConnector method read.

@Override
public IcConnectorObject read(IcUidAttribute uid, IcObjectClass objectClass) {
    Assert.notNull(objectClass, "Object class cannot be null!");
    Assert.notNull(uid, "UID cannot be null!");
    if (!IcObjectClassInfo.ACCOUNT.equals(objectClass.getType())) {
        throw new IcException("Only ACCOUNT object class is supported now!");
    }
    String uidValue = uid.getUidValue();
    if (uidValue == null) {
        throw new IcException("UID value cannot be null!");
    }
    // Find account by UID and System ID
    VsAccountDto account = accountService.findByUidSystem(uidValue, systemId);
    // All attributes from VS account
    List<IcAttribute> vsAttributes = new ArrayList<>();
    // Create uid attribute
    IcAttributeImpl uidAttribute = new IcAttributeImpl(IcAttributeInfo.NAME, uidValue);
    vsAttributes.add(uidAttribute);
    if (account != null) {
        // Create enable attribute
        if (this.virtualConfiguration.isDisableSupported()) {
            IcAttributeImpl enableAttribute = new IcAttributeImpl(IcAttributeInfo.ENABLE, account.isEnable());
            vsAttributes.add(enableAttribute);
        }
        // Attributes from definition and configuration
        UUID accountId = account.getId();
        Arrays.asList(virtualConfiguration.getAttributes()).forEach(virtualAttirbute -> {
            IcAttribute attribute = accountService.getIcAttribute(accountId, virtualAttirbute, formDefinition);
            if (attribute == null) {
                return;
            }
            vsAttributes.add(attribute);
        });
    }
    // Overwrite attributes form VS account with attributes from unresloved
    // requests
    List<IcAttribute> attributes = this.overwriteAttributesByUnresolvedRequests(account, uidValue, vsAttributes);
    if (attributes == null) {
        return null;
    }
    IcConnectorObjectImpl connectorObject = new IcConnectorObjectImpl();
    connectorObject.setUidValue(uidValue);
    connectorObject.setObjectClass(new IcObjectClassImpl(IcObjectClassInfo.ACCOUNT));
    connectorObject.setAttributes(attributes);
    return connectorObject;
}
Also used : IcObjectClassImpl(eu.bcvsolutions.idm.ic.impl.IcObjectClassImpl) IcAttributeImpl(eu.bcvsolutions.idm.ic.impl.IcAttributeImpl) IcAttribute(eu.bcvsolutions.idm.ic.api.IcAttribute) VsAccountDto(eu.bcvsolutions.idm.vs.dto.VsAccountDto) ArrayList(java.util.ArrayList) IcException(eu.bcvsolutions.idm.ic.exception.IcException) UUID(java.util.UUID) IcConnectorObjectImpl(eu.bcvsolutions.idm.ic.impl.IcConnectorObjectImpl)

Aggregations

IcObjectClassImpl (eu.bcvsolutions.idm.ic.impl.IcObjectClassImpl)15 IcConnectorObject (eu.bcvsolutions.idm.ic.api.IcConnectorObject)9 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)7 IcObjectClass (eu.bcvsolutions.idm.ic.api.IcObjectClass)6 SysSchemaObjectClassDto (eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto)5 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)5 SysSystemMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto)5 IcException (eu.bcvsolutions.idm.ic.exception.IcException)5 IcConnectorObjectImpl (eu.bcvsolutions.idm.ic.impl.IcConnectorObjectImpl)5 ProvisioningContext (eu.bcvsolutions.idm.acc.domain.ProvisioningContext)4 SysProvisioningOperationDto (eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto)4 ProvisioningException (eu.bcvsolutions.idm.acc.exception.ProvisioningException)4 IcConnector (eu.bcvsolutions.idm.ic.api.IcConnector)4 IcConnectorConfiguration (eu.bcvsolutions.idm.ic.api.IcConnectorConfiguration)4 ArrayList (java.util.ArrayList)4 ProvisioningAttributeDto (eu.bcvsolutions.idm.acc.dto.ProvisioningAttributeDto)3 IcAttribute (eu.bcvsolutions.idm.ic.api.IcAttribute)3 IcUidAttribute (eu.bcvsolutions.idm.ic.api.IcUidAttribute)3 VsAccountDto (eu.bcvsolutions.idm.vs.dto.VsAccountDto)3 SynchronizationContext (eu.bcvsolutions.idm.acc.domain.SynchronizationContext)2