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

New option for tagged attributes + accept tagged attributes in resource schema

parent 3dab8871
......@@ -381,6 +381,13 @@ public abstract class AbstractLdapConfiguration extends AbstractConfiguration {
// MAYBE TODO: respectResourcePasswordPolicyChangeAfterReset? filterWithOrInsteadOfAnd?
// removeLogEntryObjectClassFromFilter? synchronizePasswords? passwordAttributeToSynchronize?
/**
* Additional attributes with options (tags), according to RFC 4512 section 2.5.
*
* Only attributes with existing original attributes in the schema are considered.
*/
private String[] taggedAttributes = { };
@ConfigurationProperty(required = true, order = 1)
public String getHost() {
return host;
......@@ -768,6 +775,15 @@ public abstract class AbstractLdapConfiguration extends AbstractConfiguration {
this.allowUntrustedSsl = allowUntrustedSsl;
}
@ConfigurationProperty(order = 44)
public String[] getTaggedAttributes() {
return taggedAttributes;
}
public void setTaggedAttributes(String[] taggedAttributes) {
this.taggedAttributes = taggedAttributes;
}
@Override
public void validate() {
validateNotBlank(host, "host.blank");
......@@ -821,4 +837,4 @@ public abstract class AbstractLdapConfiguration extends AbstractConfiguration {
}
// TODO: equals, hashCode
}
\ No newline at end of file
}
......@@ -344,6 +344,17 @@ public abstract class AbstractSchemaTranslator<C extends AbstractLdapConfigurati
ldapSyntax==null?null:ldapSyntax.getOid(), connIdType);
AttributeInfo attributeInfo = aib.build();
attrInfoList.put(attributeInfo.getName(), attributeInfo);
if (configuration.getTaggedAttributes() != null) {
for (String taggedAttrName : configuration.getTaggedAttributes()) {
if (taggedAttrName.startsWith(connIdAttributeName + ";")) {
aib.setName(taggedAttrName);
aib.setNativeName(taggedAttrName);
attributeInfo = aib.build();
attrInfoList.put(attributeInfo.getName(), attributeInfo);
}
}
}
}
}
......@@ -1121,6 +1132,10 @@ public abstract class AbstractSchemaTranslator<C extends AbstractLdapConfigurati
}
} else {
ldapAttributeNameFromSchema = ldapAttributeType.getName();
// handle attribute options
String[] a = ldapAttrName.split(";", 2);
if (a.length > 1)
ldapAttributeNameFromSchema = ldapAttributeNameFromSchema + ";" + a[1];
}
if (uidAttributeName.equals(ldapAttributeNameFromSchema)) {
continue;
......@@ -1312,13 +1327,7 @@ public abstract class AbstractSchemaTranslator<C extends AbstractLdapConfigurati
* @return The attribute name, without the options
*/
public String getLdapAttributeName(String attributeId) {
int iSemicolon = attributeId.indexOf(';');
if (iSemicolon < 0) {
return attributeId;
}
return attributeId.substring(0, iSemicolon);
return attributeId;
}
public String getLdapAttributeOption(org.apache.directory.api.ldap.model.entry.Attribute ldapAttribute) {
......
......@@ -142,6 +142,9 @@ structuralObjectClassesToAuxiliary.help=If set to true, adds all additional stru
additionalSearchFilter.display=Additional search filter
additionalSearchFilter.help=Search filter that will be added to all search operations that the connector does.
taggedAttributes.display=Additional attributes with options (tags)
taggedAttributes.help=Extend LDAP schema by additional attributes with options (tags), according to RFC 4512 section 2.5. Only attributes with existing original attributes in the schema are considered.
# LDAP
lockoutStrategy.display=Lockout strategy
......
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