Search in sources :

Example 16 with IcUidAttribute

use of eu.bcvsolutions.idm.ic.api.IcUidAttribute in project CzechIdMng by bcvsolutions.

the class ConnIdIcConnectorService method updateObject.

@Override
public IcUidAttribute updateObject(IcConnectorInstance connectorInstance, IcConnectorConfiguration connectorConfiguration, IcObjectClass objectClass, IcUidAttribute uid, List<IcAttribute> replaceAttributes) {
    Assert.notNull(connectorInstance);
    Assert.notNull(connectorInstance.getConnectorKey());
    Assert.notNull(connectorConfiguration);
    Assert.notNull(replaceAttributes);
    Assert.notNull(uid);
    LOG.debug("Update object - ConnId (Uid= {} {} {})", uid, connectorInstance.getConnectorKey().toString(), replaceAttributes.toString());
    ConnectorFacade conn = getConnectorFacade(connectorInstance, connectorConfiguration);
    Set<Attribute> connIdAttributes = new HashSet<>();
    for (IcAttribute icAttribute : replaceAttributes) {
        connIdAttributes.add(ConnIdIcConvertUtil.convertIcAttribute(icAttribute));
    }
    ObjectClass objectClassConnId = ConnIdIcConvertUtil.convertIcObjectClass(objectClass);
    if (objectClassConnId == null) {
        objectClassConnId = ObjectClass.ACCOUNT;
    }
    Uid updatedUid = conn.update(objectClassConnId, ConnIdIcConvertUtil.convertIcUid(uid), connIdAttributes, null);
    LOG.debug("Updated object - ConnId ({} {}) Uid= {})", connectorInstance.getConnectorKey().toString(), replaceAttributes.toString(), updatedUid);
    return ConnIdIcConvertUtil.convertConnIdUid(updatedUid);
}
Also used : Uid(org.identityconnectors.framework.common.objects.Uid) IcObjectClass(eu.bcvsolutions.idm.ic.api.IcObjectClass) ObjectClass(org.identityconnectors.framework.common.objects.ObjectClass) Attribute(org.identityconnectors.framework.common.objects.Attribute) IcAttribute(eu.bcvsolutions.idm.ic.api.IcAttribute) IcUidAttribute(eu.bcvsolutions.idm.ic.api.IcUidAttribute) IcAttribute(eu.bcvsolutions.idm.ic.api.IcAttribute) IcConnectorFacade(eu.bcvsolutions.idm.ic.service.api.IcConnectorFacade) ConnectorFacade(org.identityconnectors.framework.api.ConnectorFacade) HashSet(java.util.HashSet)

Example 17 with IcUidAttribute

use of eu.bcvsolutions.idm.ic.api.IcUidAttribute in project CzechIdMng by bcvsolutions.

the class ConnIdIcConnectorService method authenticateObject.

@Override
public IcUidAttribute authenticateObject(IcConnectorInstance connectorInstance, IcConnectorConfiguration connectorConfiguration, IcObjectClass objectClass, String username, GuardedString password) {
    Assert.notNull(connectorInstance);
    Assert.notNull(connectorInstance.getConnectorKey());
    Assert.notNull(connectorConfiguration);
    Assert.notNull(username);
    LOG.debug("Authenticate object - ConnId (username= {} {})", username, connectorInstance.getConnectorKey().toString());
    ConnectorFacade conn = getConnectorFacade(connectorInstance, connectorConfiguration);
    ObjectClass objectClassConnId = ConnIdIcConvertUtil.convertIcObjectClass(objectClass);
    if (objectClassConnId == null) {
        objectClassConnId = ObjectClass.ACCOUNT;
    }
    try {
        IcUidAttribute uid = ConnIdIcConvertUtil.convertConnIdUid(conn.authenticate(objectClassConnId, username, new org.identityconnectors.common.security.GuardedString(password.asString().toCharArray()), null));
        LOG.debug("Authenticated object - ConnId (Uid= {})", uid);
        return uid;
    } catch (InvalidCredentialException ex) {
        throw new ResultCodeException(IcResultCode.AUTH_FAILED, ex);
    }
}
Also used : IcObjectClass(eu.bcvsolutions.idm.ic.api.IcObjectClass) ObjectClass(org.identityconnectors.framework.common.objects.ObjectClass) ResultCodeException(eu.bcvsolutions.idm.core.api.exception.ResultCodeException) IcConnectorFacade(eu.bcvsolutions.idm.ic.service.api.IcConnectorFacade) ConnectorFacade(org.identityconnectors.framework.api.ConnectorFacade) InvalidCredentialException(org.identityconnectors.framework.common.exceptions.InvalidCredentialException) IcUidAttribute(eu.bcvsolutions.idm.ic.api.IcUidAttribute) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString)

Example 18 with IcUidAttribute

use of eu.bcvsolutions.idm.ic.api.IcUidAttribute 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)

Aggregations

IcUidAttribute (eu.bcvsolutions.idm.ic.api.IcUidAttribute)18 IcConnectorObject (eu.bcvsolutions.idm.ic.api.IcConnectorObject)11 IcObjectClass (eu.bcvsolutions.idm.ic.api.IcObjectClass)11 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)10 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)7 IcUidAttributeImpl (eu.bcvsolutions.idm.ic.impl.IcUidAttributeImpl)6 SysProvisioningOperationDto (eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto)5 IcAttribute (eu.bcvsolutions.idm.ic.api.IcAttribute)5 SysSystemEntityDto (eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto)4 ProvisioningAttributeDto (eu.bcvsolutions.idm.acc.dto.ProvisioningAttributeDto)3 DefaultEventResult (eu.bcvsolutions.idm.core.api.event.DefaultEventResult)3 ResultCodeException (eu.bcvsolutions.idm.core.api.exception.ResultCodeException)3 IcConnector (eu.bcvsolutions.idm.ic.api.IcConnector)3 IcException (eu.bcvsolutions.idm.ic.exception.IcException)3 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)3 Test (org.junit.Test)3 SysProvisioningOperationFilter (eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter)2 SysProvisioningOperation (eu.bcvsolutions.idm.acc.entity.SysProvisioningOperation)2 ProvisioningException (eu.bcvsolutions.idm.acc.exception.ProvisioningException)2 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)2