Commit 31be844d authored by Ing. František DVOŘÁK's avatar Ing. František DVOŘÁK
Browse files

LDAP attribute options: fix operational attributes usage (Active Directory password)

parent 2e479685
Pipeline #1734 passed with stage
in 2 minutes and 36 seconds
......@@ -866,6 +866,7 @@ public abstract class AbstractLdapConnector<C extends AbstractLdapConfiguration>
} else {
List<Value> ldapValues = shcemaTranslator.toLdapValues(ldapAttributeType, connIdAttrValues);
// Do NOT set attributeType here. The attributeType may not match the type of the value.
LOG.info("create: connIdAttr.name {0}, ldapAttributeType.name {1}", connIdAttr.getName(), ldapAttributeType.getName());
entry.put(connIdAttr.getName(), ldapValues.toArray(new Value[ldapValues.size()]));
// no simple way how to check if he attribute was added. It may end up with ERR_04451. So let's just
// hope that it worked well. It should - unless there is a connector bug.
......@@ -1187,8 +1188,10 @@ public abstract class AbstractLdapConnector<C extends AbstractLdapConfiguration>
if (schemaTranslator.isPolyAttribute(ldapAttributeType, connIdValues)) {
addLdapModificationPoly(dn, ldapModifications, modOp, ldapAttributeType, connIdValues);
} else {
} else if (schemaTranslator.isTaggedAttribute(nativeName)) {
addLdapModificationSimple(dn, ldapModifications, modOp, nativeName, ldapAttributeType, connIdValues);
} else {
addLdapModificationSimple(dn, ldapModifications, modOp, ldapAttributeType.getName(), ldapAttributeType, connIdValues);
}
}
......@@ -1202,11 +1205,13 @@ public abstract class AbstractLdapConnector<C extends AbstractLdapConfiguration>
// Do NOT set AttributeType here
// The attributeType might not match the Value class
// e.g. human-readable jpegPhoto attribute will expect StringValue
LOG.info("addLdapModificationSimple/empty: nativeName {0}, ldapAttributeType.name {1}", nativeName, ldapAttributeType.getName());
ldapModifications.add(new DefaultModification(modOp, nativeName));
} else {
// Do NOT set AttributeType here
// The attributeType might not match the Value class
// e.g. human-readable jpegPhoto attribute will expect StringValue
LOG.info("addLdapModificationSimple/non-empty: nativeName {0}, ldapAttributeType.name {1}", nativeName, ldapAttributeType.getName());
DefaultAttribute ldapAttribute = new DefaultAttribute(nativeName, ldapValues.toArray(new Value[ldapValues.size()]));
ldapModifications.add(new DefaultModification(modOp, ldapAttribute));
}
......
......@@ -137,6 +137,11 @@ public class LdapSchemaTranslator extends AbstractSchemaTranslator<LdapConfigura
return Map.class.isAssignableFrom(connIdAttributeInfo.getType());
}
@Override
public boolean isTaggedAttribute(String name) {
return name != null && name.contains(";");
}
@Override
public Map<String, List<Value>> toLdapPolyValues(AttributeType ldapAttributeType, List<Object> connIdValues) {
Map<String, List<Value>> ldapValueMap = new HashMap<>();
......
......@@ -554,6 +554,10 @@ public abstract class AbstractSchemaTranslator<C extends AbstractLdapConfigurati
return false;
}
public boolean isTaggedAttribute(String name) {
return false;
}
public List<Value> toLdapValues(AttributeType ldapAttributeType, List<Object> icfAttributeValues) {
List<Value> ldapValues = new ArrayList<>(icfAttributeValues.size());
for (Object icfValue: icfAttributeValues) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment