Commit 22520195 authored by Radovan Semancik's avatar Radovan Semancik
Browse files

Upgrade to Directory API 2.0.0.AM3 and commons lang3

parent c8c324d7
......@@ -81,7 +81,7 @@
<dependency>
<groupId>org.apache.directory.api</groupId>
<artifactId>api-all</artifactId>
<version>2.0.0.AM2</version>
<version>2.0.0.AM3</version>
<exclusions>
<!-- Exclude SLF4J API from the lib to avoid bundling it with the
connector. The SLF4J is already part of midPoint.
......@@ -124,6 +124,12 @@
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
......
......@@ -26,7 +26,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.directory.api.ldap.extras.controls.permissiveModify.PermissiveModify;
import org.apache.directory.api.ldap.extras.controls.permissiveModify.PermissiveModifyImpl;
import org.apache.directory.api.ldap.extras.controls.vlv.VirtualListViewRequest;
......@@ -67,7 +67,6 @@ import org.apache.directory.api.ldap.model.name.Rdn;
import org.apache.directory.api.ldap.model.schema.AttributeType;
import org.apache.directory.api.ldap.model.schema.LdapSyntax;
import org.apache.directory.api.ldap.model.schema.MatchingRule;
import org.apache.directory.api.ldap.model.schema.MutableAttributeType;
import org.apache.directory.api.ldap.model.schema.Normalizer;
import org.apache.directory.api.ldap.model.schema.SchemaErrorHandler;
import org.apache.directory.api.ldap.model.schema.SchemaManager;
......@@ -112,7 +111,6 @@ import org.identityconnectors.framework.spi.operations.SchemaOp;
import org.identityconnectors.framework.spi.operations.SearchOp;
import org.identityconnectors.framework.spi.operations.SyncOp;
import org.identityconnectors.framework.spi.operations.TestOp;
import org.identityconnectors.framework.spi.operations.UpdateAttributeValuesOp;
import org.identityconnectors.framework.spi.operations.UpdateDeltaOp;
import com.evolveum.polygon.common.SchemaUtil;
......@@ -1329,7 +1327,7 @@ public abstract class AbstractLdapConnector<C extends AbstractLdapConfiguration>
sb.append("null");
} else {
if (value.isHumanReadable()) {
sb.append(value.getValue());
sb.append(value.getString());
} else {
byte[] bytes = value.getBytes();
if (bytes == null) {
......
......@@ -26,7 +26,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Random;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.directory.api.ldap.model.exception.LdapException;
import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException;
import org.apache.directory.api.ldap.model.exception.LdapURLEncodingException;
......@@ -415,7 +415,7 @@ public class ConnectionManager<C extends AbstractLdapConfiguration> implements C
} catch (RuntimeException e) {
try {
connection.close();
} catch (IOException e1) {
} catch (Exception e1) {
LOG.error("Error closing conection (error handling of a bind of a new connection): {1}", e.getMessage(), e);
}
// This is always connection failed, even if other error is indicated.
......@@ -469,7 +469,7 @@ public class ConnectionManager<C extends AbstractLdapConfiguration> implements C
} catch (LdapException e) {
try {
connection.close();
} catch (IOException e1) {
} catch (Exception e1) {
LOG.error("Error closing conection (handling error during creation of a new connection): {1}", e.getMessage(), e);
}
RuntimeException processedException = LdapUtil.processLdapException("Unable to connect to LDAP server "+configuration.getHost()+":"+configuration.getPort(), e);
......@@ -582,7 +582,7 @@ public class ConnectionManager<C extends AbstractLdapConfiguration> implements C
} catch (RuntimeException e) {
try {
connection.close();
} catch (IOException e1) {
} catch (Exception e1) {
LOG.error("Error closing conection (error handling of a bind of a new connection): {1}", e1.getMessage(), e1);
}
// This is a special runAs situation. We really want to throw the real error here.
......@@ -632,7 +632,7 @@ public class ConnectionManager<C extends AbstractLdapConfiguration> implements C
// For example connections that were created for runAs feature.
try {
connection.close();
} catch (IOException e) {
} catch (Exception e) {
LOG.error("Error closing special connection: {0}", e.getMessage(), e);
}
}
......
/**
* Copyright (c) 2015-2018 Evolveum
* Copyright (c) 2015-2019 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -122,7 +122,7 @@ public class LdapUtil {
if (value == null) {
return null;
}
return value.getValue();
return value.getString();
}
public static Integer getIntegerAttribute(Entry entry, String attrName, Integer defaultVal) {
......@@ -642,7 +642,7 @@ public class LdapUtil {
Attribute objectClassAttribute = entry.get(SchemaConstants.OBJECT_CLASS_AT);
for (Value objectClassVal: objectClassAttribute) {
if (ldapObjectClass.getName().equalsIgnoreCase(objectClassVal.getValue())) {
if (ldapObjectClass.getName().equalsIgnoreCase(objectClassVal.getString())) {
return true;
}
}
......@@ -678,7 +678,7 @@ public class LdapUtil {
}
for (Value modifiersNameVal: modifiersNameAttribute) {
for (String modifiersNameToFilterOut: modifiersNamesToFilterOut) {
if (modifiersNameToFilterOut.equals(modifiersNameVal.getValue())) {
if (modifiersNameToFilterOut.equals(modifiersNameVal.getString())) {
return true;
}
}
......
/*
* Copyright (c) 2015-2018 Evolveum
* Copyright (c) 2015-2019 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -19,7 +19,6 @@ package com.evolveum.polygon.connector.ldap.ad;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
......@@ -31,7 +30,6 @@ import javax.net.ssl.HostnameVerifier;
import org.apache.directory.api.ldap.model.constants.SchemaConstants;
import org.apache.directory.api.ldap.model.entry.Entry;
import org.apache.directory.api.ldap.model.entry.Modification;
import org.apache.directory.api.ldap.model.entry.ModificationOperation;
import org.apache.directory.api.ldap.model.exception.LdapException;
import org.apache.directory.api.ldap.model.exception.LdapOperationException;
import org.apache.directory.api.ldap.model.exception.LdapOtherException;
......@@ -45,14 +43,11 @@ import org.apache.directory.api.ldap.model.schema.AttributeType;
import org.apache.directory.api.ldap.model.schema.LdapComparator;
import org.apache.directory.api.ldap.model.schema.LdapSyntax;
import org.apache.directory.api.ldap.model.schema.MatchingRule;
import org.apache.directory.api.ldap.model.schema.MutableAttributeType;
import org.apache.directory.api.ldap.model.schema.MutableMatchingRule;
import org.apache.directory.api.ldap.model.schema.Normalizer;
import org.apache.directory.api.ldap.model.schema.ObjectClass;
import org.apache.directory.api.ldap.model.schema.SchemaErrorHandler;
import org.apache.directory.api.ldap.model.schema.SchemaManager;
import org.apache.directory.api.ldap.model.schema.SchemaObject;
import org.apache.directory.api.ldap.model.schema.comparators.ComparableComparator;
import org.apache.directory.api.ldap.model.schema.comparators.NormalizingComparator;
import org.apache.directory.api.ldap.model.schema.comparators.StringComparator;
import org.apache.directory.api.ldap.model.schema.normalizers.DeepTrimToLowerNormalizer;
......@@ -67,14 +62,11 @@ import org.apache.http.client.config.AuthSchemes;
import org.identityconnectors.common.logging.Log;
import org.identityconnectors.common.security.GuardedString;
import org.identityconnectors.framework.common.exceptions.ConfigurationException;
import org.identityconnectors.framework.common.exceptions.ConnectionFailedException;
import org.identityconnectors.framework.common.exceptions.ConnectorException;
import org.identityconnectors.framework.common.exceptions.ConnectorIOException;
import org.identityconnectors.framework.common.exceptions.ConnectorSecurityException;
import org.identityconnectors.framework.common.exceptions.InvalidAttributeValueException;
import org.identityconnectors.framework.common.exceptions.UnknownUidException;
import org.identityconnectors.framework.common.objects.Attribute;
import org.identityconnectors.framework.common.objects.AttributeBuilder;
import org.identityconnectors.framework.common.objects.AttributeDelta;
import org.identityconnectors.framework.common.objects.AttributeDeltaBuilder;
import org.identityconnectors.framework.common.objects.OperationOptions;
......@@ -106,15 +98,11 @@ import com.evolveum.powerhell.PowerHellException;
import com.evolveum.powerhell.PowerHellExecutionException;
import com.evolveum.powerhell.PowerHellLocalExecImpl;
import com.evolveum.powerhell.PowerHellLocalExecPowerShellImpl;
import com.evolveum.powerhell.PowerHellLocalExecWinRsPowerShellImpl;
import com.evolveum.powerhell.PowerHellSecurityException;
import com.evolveum.powerhell.PowerHellWinRmExecImpl;
import com.evolveum.powerhell.PowerHellWinRmExecPowerShellImpl;
import com.evolveum.powerhell.PowerHellWinRmLoopImpl;
import io.cloudsoft.winrm4j.winrm.WinRmTool;
import io.cloudsoft.winrm4j.winrm.WinRmToolResponse;
import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
import org.apache.cxf.transport.https.httpclient.DefaultHostnameVerifier;
......@@ -505,7 +493,7 @@ public class AdLdapConnector extends AbstractLdapConnector<AdLdapConfiguration>
MatchingRule mrCaseIgnoreMatch = matchingRuleRegistry.get(SchemaConstants.CASE_IGNORE_MATCH_MR_OID);
// Microsoft ignores matching rules. Completely. There is not even a single definition.
if (mrCaseIgnoreMatch == null) {
MutableMatchingRule correctMrCaseIgnoreMatch = new MutableMatchingRule(SchemaConstants.CASE_IGNORE_MATCH_MR_OID);
MatchingRule correctMrCaseIgnoreMatch = new MatchingRule(SchemaConstants.CASE_IGNORE_MATCH_MR_OID);
correctMrCaseIgnoreMatch.setSyntaxOid(SchemaConstants.DIRECTORY_STRING_SYNTAX);
Normalizer normalizer = new DeepTrimToLowerNormalizer(SchemaConstants.CASE_IGNORE_MATCH_MR_OID);
correctMrCaseIgnoreMatch.setNormalizer(normalizer);
......@@ -540,17 +528,17 @@ public class AdLdapConnector extends AbstractLdapConnector<AdLdapConfiguration>
AttributeType attrDcType = attributeTypeRegistry.get(attrOid);
if (attrDcType == null || attrDcType.getEquality() == null) {
MutableAttributeType correctAttrDcType;
AttributeType correctAttrDcType;
if (attrDcType != null) {
try {
attributeTypeRegistry.unregister(attrDcType);
} catch (LdapException e) {
throw new IllegalStateException("Error unregistering "+attrDcType+": "+e.getMessage(), e);
}
correctAttrDcType = new MutableAttributeType(attrDcType.getOid());
correctAttrDcType = new AttributeType(attrDcType.getOid());
correctAttrDcType.setNames(attrDcType.getNames());
} else {
correctAttrDcType = new MutableAttributeType(attrOid);
correctAttrDcType = new AttributeType(attrOid);
correctAttrDcType.setNames(attrName);
}
......
/**
* Copyright (c) 2015-2018 Evolveum
* Copyright (c) 2015-2019 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -17,7 +17,7 @@ package com.evolveum.polygon.connector.ldap.ad;
import java.io.UnsupportedEncodingException;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.directory.api.ldap.model.entry.Attribute;
import org.apache.directory.api.ldap.model.entry.Entry;
import org.apache.directory.api.ldap.model.entry.Value;
......
......@@ -30,7 +30,7 @@ import java.util.List;
import java.util.Map;
import java.util.Random;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.directory.api.ldap.extras.controls.vlv.VirtualListViewRequest;
import org.apache.directory.api.ldap.model.constants.SchemaConstants;
import org.apache.directory.api.ldap.model.entry.Entry;
......@@ -43,7 +43,6 @@ import org.apache.directory.api.ldap.model.message.controls.SortRequest;
import org.apache.directory.api.ldap.model.name.Dn;
import org.apache.directory.api.ldap.model.schema.AttributeType;
import org.apache.directory.api.ldap.model.schema.LdapSyntax;
import org.apache.directory.api.ldap.model.schema.MutableAttributeType;
import org.apache.directory.api.ldap.model.schema.SchemaManager;
import org.apache.directory.api.util.GeneralizedTime;
import org.apache.directory.ldap.client.api.LdapNetworkConnection;
......@@ -439,7 +438,7 @@ public abstract class AbstractSchemaTranslator<C extends AbstractLdapConfigurati
}
public AttributeType createFauxAttributeType(String attributeName) {
MutableAttributeType mutableLdapAttributeType = new MutableAttributeType(attributeName);
AttributeType mutableLdapAttributeType = new AttributeType(attributeName);
mutableLdapAttributeType.setNames(attributeName);
mutableLdapAttributeType.setSyntaxOid(SchemaConstants.DIRECTORY_STRING_SYNTAX);
return mutableLdapAttributeType;
......@@ -732,7 +731,7 @@ public abstract class AbstractSchemaTranslator<C extends AbstractLdapConfigurati
return null;
}
if (OperationalAttributeInfos.PASSWORD.is(connIdAttributeName)) {
return new GuardedString(ldapValue.getValue().toCharArray());
return new GuardedString(ldapValue.getString().toCharArray());
} else {
String syntaxOid = null;
if (ldapAttributeType != null) {
......@@ -742,38 +741,38 @@ public abstract class AbstractSchemaTranslator<C extends AbstractLdapConfigurati
switch (getConfiguration().getTimestampPresentation()) {
case AbstractLdapConfiguration.TIMESTAMP_PRESENTATION_NATIVE:
try {
return LdapUtil.generalizedTimeStringToZonedDateTime(ldapValue.getValue());
return LdapUtil.generalizedTimeStringToZonedDateTime(ldapValue.getString());
} catch (ParseException e) {
throw new InvalidAttributeValueException("Wrong generalized time format in LDAP attribute "+ldapAttributeName+": "+e.getMessage(), e);
}
case AbstractLdapConfiguration.TIMESTAMP_PRESENTATION_UNIX_EPOCH:
try {
GeneralizedTime gt = new GeneralizedTime(ldapValue.getValue());
GeneralizedTime gt = new GeneralizedTime(ldapValue.getString());
return gt.getCalendar().getTimeInMillis();
} catch (ParseException e) {
throw new InvalidAttributeValueException("Wrong generalized time format in LDAP attribute "+ldapAttributeName+": "+e.getMessage(), e);
}
case AbstractLdapConfiguration.TIMESTAMP_PRESENTATION_STRING:
return ldapValue.getValue();
return ldapValue.getString();
default:
throw new IllegalArgumentException("Unknown value of timestampPresentation: "+getConfiguration().getTimestampPresentation());
}
} else if (SchemaConstants.BOOLEAN_SYNTAX.equals(syntaxOid)) {
return Boolean.parseBoolean(ldapValue.getValue());
return Boolean.parseBoolean(ldapValue.getString());
} else if (isIntegerSyntax(syntaxOid)) {
return Integer.parseInt(ldapValue.getValue());
return Integer.parseInt(ldapValue.getString());
} else if (isLongSyntax(syntaxOid)) {
return Long.parseLong(ldapValue.getValue());
return Long.parseLong(ldapValue.getString());
} else if (isBinarySyntax(syntaxOid)) {
LOG.ok("Converting to ICF: {0} (syntax {1}, value {2}): explicit binary", ldapAttributeName, syntaxOid, ldapValue.getClass());
return ldapValue.getBytes();
} else if (isStringSyntax(syntaxOid)) {
LOG.ok("Converting to ICF: {0} (syntax {1}, value {2}): explicit string", ldapAttributeName, syntaxOid, ldapValue.getClass());
return ldapValue.getValue();
return ldapValue.getString();
} else {
if (ldapValue.isHumanReadable()) {
LOG.ok("Converting to ICF: {0} (syntax {1}, value {2}): detected string", ldapAttributeName, syntaxOid, ldapValue.getClass());
return ldapValue.getValue();
return ldapValue.getString();
} else {
LOG.ok("Converting to ICF: {0} (syntax {1}, value {2}): detected binary", ldapAttributeName, syntaxOid, ldapValue.getClass());
return ldapValue.getBytes();
......@@ -982,10 +981,10 @@ public abstract class AbstractSchemaTranslator<C extends AbstractLdapConfigurati
byte[] bytes = ldapValue.getBytes();
if (bytes == null && ldapValue.getValue() != null) {
if (bytes == null && ldapValue.getString() != null) {
// Binary value incorrectly detected as string value.
// TODO: Conversion to Java string may has broken the data. Do we need to do some magic to fix it?
bytes = ldapValue.getValue().getBytes(StandardCharsets.UTF_8);
bytes = ldapValue.getString().getBytes(StandardCharsets.UTF_8);
}
// Assume that identifiers are short. It is more readable to use hex representation than base64.
......@@ -995,7 +994,7 @@ public abstract class AbstractSchemaTranslator<C extends AbstractLdapConfigurati
ldapAttributeType==null?null:getSyntax(ldapAttributeType).getOid(),
ldapValue.getClass());
return ldapValue.getValue();
return ldapValue.getString();
}
}
......@@ -1353,7 +1352,7 @@ public abstract class AbstractSchemaTranslator<C extends AbstractLdapConfigurati
// Neither structural nor auxiliary. Should not happen. But it does.
List<org.apache.directory.api.ldap.model.schema.ObjectClass> outstandingObjectClasses = new ArrayList<>();
for (Value objectClassVal: objectClassAttribute) {
String objectClassString = objectClassVal.getValue();
String objectClassString = objectClassVal.getString();
org.apache.directory.api.ldap.model.schema.ObjectClass ldapObjectClass;
try {
ldapObjectClass = schemaManager.lookupObjectClassRegistry(objectClassString);
......
/**
* Copyright (c) 2015-2017 Evolveum
* Copyright (c) 2015-2019 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -26,7 +26,7 @@ import org.apache.directory.api.ldap.model.message.Referral;
import org.apache.directory.api.ldap.model.message.SearchRequest;
import org.apache.directory.api.ldap.model.message.SearchScope;
import org.apache.directory.api.ldap.model.message.controls.SortRequest;
import org.apache.directory.api.ldap.model.message.controls.SortRequestControlImpl;
import org.apache.directory.api.ldap.model.message.controls.SortRequestImpl;
import org.apache.directory.api.ldap.model.name.Dn;
import org.apache.directory.api.ldap.model.schema.AttributeType;
import org.apache.directory.ldap.client.api.LdapNetworkConnection;
......@@ -243,7 +243,7 @@ public abstract class SearchStrategy<C extends AbstractLdapConfiguration> {
protected SortRequest createSortControl(String defaultSortLdapAttribute, String defaultSortOrderingRule) {
SortRequest sortReqControl = null;
if (hasSortOption()) {
sortReqControl = new SortRequestControlImpl();
sortReqControl = new SortRequestImpl();
sortReqControl.setCritical(true);
for (SortKey icfSortKey: getOptions().getSortKeys()) {
AttributeType attributeType = getSchemaTranslator().toLdapAttribute(getLdapObjectClass(), icfSortKey.getField());
......@@ -258,7 +258,7 @@ public abstract class SearchStrategy<C extends AbstractLdapConfiguration> {
sortReqControl.addSortKey(ldapSortKey);
}
} else if (defaultSortLdapAttribute != null) {
sortReqControl = new SortRequestControlImpl();
sortReqControl = new SortRequestImpl();
AttributeType attributeType = getSchemaTranslator().toLdapAttribute(getLdapObjectClass(), defaultSortLdapAttribute);
String matchingRuleId = attributeType.getOrderingOid();
if (matchingRuleId == null) {
......
......@@ -193,6 +193,9 @@ public class SimplePagedResultsSearchStrategy<C extends AbstractLdapConfiguratio
}
extra = sb.toString();
cookie = pagedResultsResponseControl.getCookie();
if (cookie.length == 0) {
cookie = null;
}
lastListSize = pagedResultsResponseControl.getSize();
if (lastListSize == 0) {
// RFC2696 specifies zero as "I do not know". We use -1 for that.
......
/**
* Copyright (c) 2015-2018 Evolveum
* Copyright (c) 2015-2019 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -18,11 +18,11 @@ package com.evolveum.polygon.connector.ldap.sync;
import java.util.Arrays;
import java.util.Base64;
import org.apache.commons.lang.StringUtils;
import org.apache.directory.api.ldap.extras.controls.ad.AdDirSyncRequestImpl;
import org.apache.directory.api.ldap.extras.controls.ad.AdDirSyncResponse;
import org.apache.directory.api.ldap.extras.controls.ad.AdShowDeleted;
import org.apache.directory.api.ldap.extras.controls.ad.AdShowDeletedImpl;
import org.apache.directory.api.ldap.extras.controls.ad.AdDirSync;
import org.apache.directory.api.ldap.extras.controls.ad.AdDirSyncImpl;
import org.apache.commons.lang3.StringUtils;
import org.apache.directory.api.ldap.model.cursor.CursorException;
import org.apache.directory.api.ldap.model.cursor.SearchCursor;
import org.apache.directory.api.ldap.model.entry.Entry;
......@@ -108,7 +108,7 @@ public class AdDirSyncStrategy<C extends AbstractLdapConfiguration> extends Sync
numFoundEntries++;
byte[] entryCookie = null;
AdDirSync dirSyncRespControl = (AdDirSync) response.getControl(AdDirSync.OID);
AdDirSyncResponse dirSyncRespControl = (AdDirSyncResponse) response.getControl(AdDirSyncResponse.OID);
if (dirSyncRespControl != null) {
entryCookie = dirSyncRespControl.getCookie();
if (entryCookie != null) {
......@@ -161,7 +161,7 @@ public class AdDirSyncStrategy<C extends AbstractLdapConfiguration> extends Sync
SearchResultDone searchResultDone = searchCursor.getSearchResultDone();
if (searchResultDone != null) {
AdDirSync dirSyncRespControl = (AdDirSync) searchResultDone.getControl(AdDirSync.OID);
AdDirSyncResponse dirSyncRespControl = (AdDirSyncResponse) searchResultDone.getControl(AdDirSyncResponse.OID);
if (dirSyncRespControl == null) {
LOG.warn("No DirSync response control in search done response");
} else {
......@@ -207,7 +207,7 @@ public class AdDirSyncStrategy<C extends AbstractLdapConfiguration> extends Sync
SearchResultDone searchResultDone = searchCursor.getSearchResultDone();
if (searchResultDone != null) {
AdDirSync dirSyncRespControl = (AdDirSync) searchResultDone.getControl(AdDirSync.OID);
AdDirSyncResponse dirSyncRespControl = (AdDirSyncResponse) searchResultDone.getControl(AdDirSyncResponse.OID);
if (dirSyncRespControl == null) {
LOG.warn("No DirSync response control in search done response");
} else {
......@@ -239,7 +239,7 @@ public class AdDirSyncStrategy<C extends AbstractLdapConfiguration> extends Sync
private SearchRequest createSearchRequest(String searchFilter, SyncToken fromToken) {
AdDirSync dirSyncReqControl = new AdDirSyncImpl();
AdDirSyncRequestImpl dirSyncReqControl = new AdDirSyncRequestImpl();
dirSyncReqControl.setCritical(true);
byte[] cookie = null;
if (fromToken != null) {
......
/**
* Copyright (c) 2015-2018 DAASI International
* Copyright (c) 2015-2019 DAASI International and Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -18,7 +18,7 @@ package com.evolveum.polygon.connector.ldap.sync;
import java.util.Arrays;
import java.util.Iterator;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.directory.api.ldap.model.constants.SchemaConstants;
import org.apache.directory.api.ldap.model.cursor.CursorException;
import org.apache.directory.api.ldap.model.cursor.EntryCursor;
......@@ -166,14 +166,14 @@ public class OpenLdapAccessLogSyncStrategy<C extends AbstractLdapConfiguration>
Iterator<Value> atrValIterator = uidAttribute.iterator();
while (atrValIterator.hasNext()) {
Value next = atrValIterator.next();
if (next.getValue().contains(uidAttributeName + ":")) {
if (next.getString().contains(uidAttributeName + ":")) {
LOG.ok("Found uid attribute");
foundUidAttr = true;
// spliting at first ':'. Everything after that is the uid attribute
// this is pretty safe because it's not possible to but ':' in an attribute
// deffinition
try {
String[] splitArr = next.getValue().split(":");
String[] splitArr = next.getString().split(":");
oldUid = String.join("", Arrays.copyOfRange(splitArr, 1, splitArr.length)).trim();
} catch (Exception e) {
LOG.info(
......
/**
* Copyright (c) 2015-2018 Evolveum
* Copyright (c) 2015-2019 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -17,7 +17,7 @@ package com.evolveum.polygon.connector.ldap.sync;
import java.io.IOException;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.directory.api.ldap.model.cursor.CursorException;
import org.apache.directory.api.ldap.model.cursor.EntryCursor;
import org.apache.directory.api.ldap.model.entry.Attribute;
......
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