private void setName(final PropagationTask task) { Set<Attribute> attrs = new HashSet<>(task.getAttributes()); if (AttributeUtil.find(getEmailAttrName(), attrs) == null) { LOG.warn("Can't find {} attribute to set as __NAME__ attribute value, skipping...", getEmailAttrName()); return; } Name name = AttributeUtil.getNameFromAttributes(attrs); if (name != null) { attrs.remove(name); } attrs.add(new Name(AttributeUtil.find(getEmailAttrName(), attrs).getValue().get(0).toString())); task.setAttributes(attrs); } }
@Transactional @Override public void before(final PropagationTask task, final ConnectorObject beforeObj) { if (task.getOperation() == ResourceOperation.DELETE || task.getOperation() == ResourceOperation.NONE) { return; } if (AnyTypeKind.USER != task.getAnyTypeKind()) { return; } Set<Attribute> attrs = new HashSet<>(task.getAttributes()); if (AttributeUtil.find(getEmailAttrName(), attrs) == null) { LOG.warn("Can't find {} attribute to set as __NAME__ attribute value, skipping...", getEmailAttrName()); return; } Name name = AttributeUtil.getNameFromAttributes(attrs); if (name != null) { attrs.remove(name); } attrs.add(new Name(AttributeUtil.find(getEmailAttrName(), attrs).getValue().get(0).toString())); task.setAttributes(attrs); } }
@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); } } } }
Set<Attribute> attributes = new HashSet<>(task.getAttributes()); Attribute mandatoryMissing = AttributeUtil.find(MANDATORY_MISSING_ATTR_NAME, task.getAttributes()); if (mandatoryMissing != null) { attributes.remove(mandatoryMissing); Attribute mandatoryNullOrEmpty = AttributeUtil.find(MANDATORY_NULL_OR_EMPTY_ATTR_NAME, task.getAttributes()); if (mandatoryNullOrEmpty != null) { attributes.remove(mandatoryNullOrEmpty);
LOG.debug("Group connObjectLinks to propagate for membership: {}", groupConnObjectLinks); Set<Attribute> attributes = new HashSet<>(task.getAttributes());
} else { isValid = task.getOperation() != null && !task.getAttributes().isEmpty() && task.getResource() != null;
setObjectClass(new ObjectClass(task.getObjectClassName())). setUid(uid). setName(AttributeUtil.getNameFromAttributes(task.getAttributes())). build();