Search in sources :

Example 1 with DeleteOperation

use of org.ldaptive.DeleteOperation 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
 */
public static boolean executeDeleteOperation(final ConnectionFactory connectionFactory, final LdapEntry entry) {
    try {
        val delete = new DeleteOperation(connectionFactory);
        val request = new DeleteRequest(entry.getDn());
        val response = delete.execute(request);
        LOGGER.debug("Result code [{}], message: [{}]", response.getResultCode(), response.getDiagnosticMessage());
        return response.getResultCode() == ResultCode.SUCCESS;
    } catch (final Exception e) {
        LoggingUtils.error(LOGGER, e);
    }
    return false;
}
Also used : lombok.val(lombok.val) DeleteOperation(org.ldaptive.DeleteOperation) DeleteRequest(org.ldaptive.DeleteRequest) AccountNotFoundException(javax.security.auth.login.AccountNotFoundException) LdapException(org.ldaptive.LdapException)

Aggregations

AccountNotFoundException (javax.security.auth.login.AccountNotFoundException)1 lombok.val (lombok.val)1 DeleteOperation (org.ldaptive.DeleteOperation)1 DeleteRequest (org.ldaptive.DeleteRequest)1 LdapException (org.ldaptive.LdapException)1