/** * Check whether an execution has to be stored, for a given task. * * @param task propagation task * @param execution to be decide whether to store or not * @return true if execution has to be store, false otherwise */ protected boolean hasToBeregistered(final PropagationTask task, final TaskExec execution) { boolean result; boolean failed = ExecStatus.valueOf(execution.getStatus()) != ExecStatus.SUCCESS; switch (task.getOperation()) { case CREATE: result = (failed && task.getResource().getCreateTraceLevel().ordinal() >= TraceLevel.FAILURES.ordinal()) || task.getResource().getCreateTraceLevel() == TraceLevel.ALL; break; case UPDATE: result = (failed && task.getResource().getUpdateTraceLevel().ordinal() >= TraceLevel.FAILURES.ordinal()) || task.getResource().getUpdateTraceLevel() == TraceLevel.ALL; break; case DELETE: result = (failed && task.getResource().getDeleteTraceLevel().ordinal() >= TraceLevel.FAILURES.ordinal()) || task.getResource().getDeleteTraceLevel() == TraceLevel.ALL; break; default: result = false; } return result; }
@Transactional(readOnly = true) @Override public void before(final PropagationTask task, final ConnectorObject beforeObj) { Optional<? extends Provision> provision = task.getResource().getProvision(anyTypeDAO.findGroup()); if (AnyTypeKind.USER == task.getAnyTypeKind() && provision.isPresent() && provision.get().getMapping() != null userDAO.findAllGroupKeys(user).forEach(groupKey -> { Group group = groupDAO.find(groupKey); if (group != null && groupDAO.findAllResourceKeys(groupKey).contains(task.getResource().getKey())) { LOG.debug("Evaluating connObjectLink for {}", group); JexlContext jexlContext = new MapContext();
LOG.debug("Create {} on {}", attributes, task.getResource().getKey()); result = connector.create( new ObjectClass(task.getObjectClassName()), attributes, null, propagationAttempted); task.getResource().getProvision(task.getAnyType()).ifPresent(provision -> { if (provision.getUidOnCreate() != null) { anyUtilsFactory.getInstance(task.getAnyTypeKind()). LOG.debug("Update {} on {}", strictlyModified, task.getResource().getKey());
@Transactional(readOnly = true) @Override public void before(final PropagationTask task, final ConnectorObject beforeObj) { if (AnyTypeKind.USER == task.getAnyTypeKind()) { User user = userDAO.find(task.getEntityKey()); if (user != null && user.getPassword() != null) { Attribute missing = AttributeUtil.find( PropagationTaskExecutor.MANDATORY_MISSING_ATTR_NAME, task.getAttributes()); ConnInstance connInstance = task.getResource().getConnector(); String cipherAlgorithm = getCipherAlgorithm(connInstance); if (missing != null && missing.getValue() != null && missing.getValue().size() == 1 && missing.getValue().get(0).equals(OperationalAttributes.PASSWORD_NAME) && cipherAlgorithmMatches(getCipherAlgorithm(connInstance), user.getCipherAlgorithm())) { String password = user.getPassword().toLowerCase(); byte[] decodedPassword = DatatypeConverter.parseHexBinary(password); String base64EncodedPassword = Base64.getEncoder().encodeToString(decodedPassword); String cipherPlusPassword = ("{" + cipherAlgorithm.toLowerCase() + "}" + base64EncodedPassword); Attribute passwordAttribute = AttributeBuilder.buildPassword( new GuardedString(cipherPlusPassword.toCharArray())); Set<Attribute> attributes = new HashSet<>(task.getAttributes()); attributes.add(passwordAttribute); attributes.remove(missing); task.setAttributes(attributes); } } } }
@Transactional(readOnly = true) @Override public void before(final PropagationTask task, final ConnectorObject beforeObj) { if (AnyTypeKind.USER == task.getAnyTypeKind()) { User user = userDAO.find(task.getEntityKey()); if (user != null && user.getPassword() != null) { Attribute missing = AttributeUtil.find( PropagationTaskExecutor.MANDATORY_MISSING_ATTR_NAME, task.getAttributes()); ConnInstance connInstance = task.getResource().getConnector(); if (missing != null && missing.getValue() != null && missing.getValue().size() == 1 && missing.getValue().get(0).equals(OperationalAttributes.PASSWORD_NAME) && cipherAlgorithmMatches(getCipherAlgorithm(connInstance), user.getCipherAlgorithm())) { Attribute passwordAttribute = AttributeBuilder.buildPassword( new GuardedString(user.getPassword().toCharArray())); Set<Attribute> attributes = new HashSet<>(task.getAttributes()); attributes.add(passwordAttribute); attributes.remove(missing); Attribute hashedPasswordAttribute = AttributeBuilder.build( AttributeUtil.createSpecialName("HASHED_PASSWORD"), Boolean.TRUE); attributes.add(hashedPasswordAttribute); task.setAttributes(attributes); } } } }
isValid = task.getOperation() != null && !task.getAttributes().isEmpty() && task.getResource() != null;
if (task.getAnyTypeKind() == null || !resources.contains(task.getResource().getKey())) { LOG.debug("Delete {} on {}", beforeObj.getUid(), task.getResource().getKey());
List<PropagationActions> actions = getPropagationActions(task.getResource()); String resource = task.getResource().getKey(); Result result; try { provision = task.getResource().getProvision(new ObjectClass(task.getObjectClassName())).orElse(null); orgUnit = task.getResource().getOrgUnit(); connector = connFactory.getConnector(task.getResource()); : ExecStatus.NOT_ATTEMPTED.name()); LOG.debug("Successfully propagated to {}", task.getResource()); result = Result.SUCCESS; } catch (Exception e) {
propagationTaskTO.setOldConnObjectKey(propagationTask.getOldConnObjectKey()); propagationTaskTO.setAttributes(propagationTask.getSerializedAttributes()); propagationTaskTO.setResource(propagationTask.getResource().getKey()); propagationTaskTO.setObjectClassName(propagationTask.getObjectClassName()); propagationTaskTO.setAnyTypeKind(propagationTask.getAnyTypeKind());