use of org.ldaptive.DeleteRequest in project cas by apereo.
the class LdapUtils method executeDeleteOperation.
/**
* Execute delete operation boolean.
*
* @param connectionFactory the connection factory
* @param entry the entry
* @return true/false
* @throws LdapException the ldap exception
*/
public static boolean executeDeleteOperation(final ConnectionFactory connectionFactory, final LdapEntry entry) throws LdapException {
try (Connection connection = createConnection(connectionFactory)) {
final DeleteOperation delete = new DeleteOperation(connection);
final DeleteRequest request = new DeleteRequest(entry.getDn());
request.setReferralHandler(new DeleteReferralHandler());
final Response<Void> res = delete.execute(request);
return res.getResultCode() == ResultCode.SUCCESS;
} catch (final LdapException e) {
LOGGER.error(e.getMessage(), e);
}
return false;
}
Aggregations