Search in sources :

Example 11 with PasswordModifyExtendedResult

use of com.unboundid.ldap.sdk.extensions.PasswordModifyExtendedResult in project ldapsdk by pingidentity.

the class ResultUtilsTestCase method getFormatResultData.

/**
 * Retrieves a set of data for testing the {@code formatResult} method.
 *
 * @return  The test data.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@DataProvider(name = "formatResultData")
public Iterator<Object[]> getFormatResultData() throws Exception {
    final LinkedList<Object[]> resultList = new LinkedList<Object[]>();
    // A simple success result.
    final String txnNoteLine = "#      NOTE:  No changes will actually be " + "applied to the server until the transaction is committed.";
    resultList.add(new Object[] { new LDAPResult(-1, ResultCode.SUCCESS), Arrays.asList("#      Result Code:  0 (success)", txnNoteLine) });
    // A failure result with a single referral URL and a single control .
    final String[] singleReferralURL = { "ldap://ds.example.com:389/dc=example,dc=com" };
    final Control[] singleResponseControl = { new Control("1.2.3.4") };
    resultList.add(new Object[] { new LDAPResult(-1, ResultCode.OTHER, "Something went wrong", "dc=example,dc=com", singleReferralURL, singleResponseControl), Arrays.asList("#      Result Code:  80 (other)", "#      Diagnostic Message:  Something went wrong", "#      Matched DN:  dc=example,dc=com", "#      Referral URL:  " + "ldap://ds.example.com:389/dc=example,dc=com", "#      Response Control:", "#           OID:  1.2.3.4", "#           Is Critical:  false") });
    // A failure result with multiple referral URLs and multiple controls.
    final String[] multipleReferralURLs = { "ldap://ds1.example.com:389/dc=example,dc=com", "ldap://ds2.example.com:389/dc=example,dc=com" };
    final Control[] multipleResponseControls = { new Control("1.2.3.4"), new Control("1.2.3.5", true, new ASN1OctetString("control value")) };
    resultList.add(new Object[] { new LDAPResult(-1, ResultCode.OTHER, "Something went wrong", "dc=example,dc=com", multipleReferralURLs, multipleResponseControls), Arrays.asList("#      Result Code:  80 (other)", "#      Diagnostic Message:  Something went wrong", "#      Matched DN:  dc=example,dc=com", "#      Referral URL:  " + "ldap://ds1.example.com:389/dc=example,dc=com", "#      Referral URL:  " + "ldap://ds2.example.com:389/dc=example,dc=com", "#      Response Control:", "#           OID:  1.2.3.4", "#           Is Critical:  false", "#      Response Control:", "#           OID:  1.2.3.5", "#           Is Critical:  true", "#           Raw Value:", "#                63 6f 6e 74 72 6f 6c 20 76 61 6c 75 " + "65            control value") });
    // A successful start transaction extended result with a printable
    // transaction ID.
    resultList.add(new Object[] { new StartTransactionExtendedResult(2, ResultCode.SUCCESS, null, null, null, new ASN1OctetString("txnID"), null), Arrays.asList("#      Result Code:  0 (success)", txnNoteLine, "#      Start Transaction Extended Result Transaction ID:  " + "txnID") });
    // A successful start transaction extended result with a non-printable
    // transaction ID.
    resultList.add(new Object[] { new StartTransactionExtendedResult(2, ResultCode.SUCCESS, null, null, null, new ASN1OctetString(new byte[] { 0x01, 0x23, 0x45 }), null), Arrays.asList("#      Result Code:  0 (success)", txnNoteLine, "#      Start Transaction Extended Result Transaction ID:  " + "0x012345") });
    // A successful end transaction extended result.
    final LinkedHashMap<Integer, Control[]> opResponseControls = new LinkedHashMap<Integer, Control[]>(2);
    opResponseControls.put(3, new Control[] { new Control("1.2.3.4") });
    opResponseControls.put(4, new Control[] { new Control("1.2.3.4"), new Control("1.2.3.5", true, new ASN1OctetString("control value")) });
    resultList.add(new Object[] { new EndTransactionExtendedResult(5, ResultCode.SUCCESS, null, null, null, null, opResponseControls, null), Arrays.asList("#      Result Code:  0 (success)", txnNoteLine, "#      End Transaction Extended Result Response Control for " + "Message ID 3:", "#           Response Control:", "#                OID:  1.2.3.4", "#                Is Critical:  false", "#      End Transaction Extended Result Response Control for " + "Message ID 4:", "#           Response Control:", "#                OID:  1.2.3.4", "#                Is Critical:  false", "#      End Transaction Extended Result Response Control for " + "Message ID 4:", "#           Response Control:", "#                OID:  1.2.3.5", "#                Is Critical:  true", "#                Raw Value:", "#                     63 6f 6e 74 72 6f 6c 20 76 61 6c 75 " + "65            control value") });
    // A failed end transaction extended result.
    resultList.add(new Object[] { new EndTransactionExtendedResult(5, ResultCode.OTHER, "One of the operations failed", null, null, 3, null, null), Arrays.asList("#      Result Code:  80 (other)", "#      Diagnostic Message:  One of the operations failed", "#      End Transaction Extended Result Failed Operation " + "Message ID:  3") });
    // A successful multi-update extended result.
    final ArrayList<ObjectPair<OperationType, LDAPResult>> opResults = new ArrayList<ObjectPair<OperationType, LDAPResult>>(2);
    opResults.add(new ObjectPair<OperationType, LDAPResult>(OperationType.ADD, new LDAPResult(3, ResultCode.SUCCESS)));
    opResults.add(new ObjectPair<OperationType, LDAPResult>(OperationType.DELETE, new LDAPResult(4, ResultCode.SUCCESS)));
    opResults.add(new ObjectPair<OperationType, LDAPResult>(OperationType.MODIFY, new LDAPResult(5, ResultCode.SUCCESS)));
    opResults.add(new ObjectPair<OperationType, LDAPResult>(OperationType.MODIFY_DN, new LDAPResult(6, ResultCode.SUCCESS)));
    resultList.add(new Object[] { new MultiUpdateExtendedResult(7, ResultCode.SUCCESS, null, null, null, MultiUpdateChangesApplied.ALL, opResults), Arrays.asList("#      Result Code:  0 (success)", txnNoteLine, "#      Multi-Update Changes Applied:  ALL", "#      Multi-Update ADD Operation Result:", "#           Result Code:  0 (success)", "#      Multi-Update DELETE Operation Result:", "#           Result Code:  0 (success)", "#      Multi-Update MODIFY Operation Result:", "#           Result Code:  0 (success)", "#      Multi-Update MODIFY_DN Operation Result:", "#           Result Code:  0 (success)") });
    // A successful password modify extended result.
    resultList.add(new Object[] { new PasswordModifyExtendedResult(1, ResultCode.SUCCESS, null, null, null, new ASN1OctetString("newPassword"), null), Arrays.asList("#      Result Code:  0 (success)", txnNoteLine, "#      Password Modify Extended Result Generated Password:  " + "newPassword") });
    // A successful generic extended result.
    resultList.add(new Object[] { new ExtendedResult(1, ResultCode.SUCCESS, null, null, null, "1.2.3.4", new ASN1OctetString("extended operation value"), null), Arrays.asList("#      Result Code:  0 (success)", txnNoteLine, "#      Extended Result OID:  1.2.3.4", "#      Extended Result Raw Value:", "#           65 78 74 65 6e 64 65 64 20 6f 70 65 72 61 74 " + "69   extended operati", "#           6f 6e 20 76 61 6c 75 " + "65                           on value") });
    return resultList.iterator();
}
Also used : ASN1OctetString(com.unboundid.asn1.ASN1OctetString) LDAPResult(com.unboundid.ldap.sdk.LDAPResult) ArrayList(java.util.ArrayList) ASN1OctetString(com.unboundid.asn1.ASN1OctetString) LinkedList(java.util.LinkedList) LinkedHashMap(java.util.LinkedHashMap) MultiUpdateExtendedResult(com.unboundid.ldap.sdk.unboundidds.extensions.MultiUpdateExtendedResult) IntermediateClientResponseControl(com.unboundid.ldap.sdk.unboundidds.controls.IntermediateClientResponseControl) TransactionSettingsResponseControl(com.unboundid.ldap.sdk.unboundidds.controls.TransactionSettingsResponseControl) Control(com.unboundid.ldap.sdk.Control) UniquenessResponseControl(com.unboundid.ldap.sdk.unboundidds.controls.UniquenessResponseControl) SimplePagedResultsControl(com.unboundid.ldap.sdk.controls.SimplePagedResultsControl) PasswordValidationDetailsResponseControl(com.unboundid.ldap.sdk.unboundidds.controls.PasswordValidationDetailsResponseControl) VirtualListViewResponseControl(com.unboundid.ldap.sdk.controls.VirtualListViewResponseControl) GetPasswordPolicyStateIssuesResponseControl(com.unboundid.ldap.sdk.unboundidds.controls.GetPasswordPolicyStateIssuesResponseControl) AccountUsableResponseControl(com.unboundid.ldap.sdk.unboundidds.controls.AccountUsableResponseControl) GetServerIDResponseControl(com.unboundid.ldap.sdk.unboundidds.controls.GetServerIDResponseControl) SoftDeleteResponseControl(com.unboundid.ldap.sdk.unboundidds.controls.SoftDeleteResponseControl) PasswordExpiredControl(com.unboundid.ldap.sdk.controls.PasswordExpiredControl) PasswordExpiringControl(com.unboundid.ldap.sdk.controls.PasswordExpiringControl) PostReadResponseControl(com.unboundid.ldap.sdk.controls.PostReadResponseControl) GetAuthorizationEntryResponseControl(com.unboundid.ldap.sdk.unboundidds.controls.GetAuthorizationEntryResponseControl) ServerSideSortResponseControl(com.unboundid.ldap.sdk.controls.ServerSideSortResponseControl) MatchingEntryCountResponseControl(com.unboundid.ldap.sdk.unboundidds.controls.MatchingEntryCountResponseControl) GeneratePasswordResponseControl(com.unboundid.ldap.sdk.unboundidds.controls.GeneratePasswordResponseControl) EntryChangeNotificationControl(com.unboundid.ldap.sdk.controls.EntryChangeNotificationControl) GetUserResourceLimitsResponseControl(com.unboundid.ldap.sdk.unboundidds.controls.GetUserResourceLimitsResponseControl) AssuredReplicationResponseControl(com.unboundid.ldap.sdk.unboundidds.controls.AssuredReplicationResponseControl) ContentSyncStateControl(com.unboundid.ldap.sdk.controls.ContentSyncStateControl) GetRecentLoginHistoryResponseControl(com.unboundid.ldap.sdk.unboundidds.controls.GetRecentLoginHistoryResponseControl) JoinResultControl(com.unboundid.ldap.sdk.unboundidds.controls.JoinResultControl) GetBackendSetIDResponseControl(com.unboundid.ldap.sdk.unboundidds.controls.GetBackendSetIDResponseControl) PasswordPolicyResponseControl(com.unboundid.ldap.sdk.unboundidds.controls.PasswordPolicyResponseControl) PreReadResponseControl(com.unboundid.ldap.sdk.controls.PreReadResponseControl) AuthorizationIdentityResponseControl(com.unboundid.ldap.sdk.controls.AuthorizationIdentityResponseControl) ContentSyncDoneControl(com.unboundid.ldap.sdk.controls.ContentSyncDoneControl) PasswordModifyExtendedResult(com.unboundid.ldap.sdk.extensions.PasswordModifyExtendedResult) StartTransactionExtendedResult(com.unboundid.ldap.sdk.extensions.StartTransactionExtendedResult) ExtendedResult(com.unboundid.ldap.sdk.ExtendedResult) StartTransactionExtendedResult(com.unboundid.ldap.sdk.extensions.StartTransactionExtendedResult) NoticeOfDisconnectionExtendedResult(com.unboundid.ldap.sdk.extensions.NoticeOfDisconnectionExtendedResult) MultiUpdateExtendedResult(com.unboundid.ldap.sdk.unboundidds.extensions.MultiUpdateExtendedResult) AbortedTransactionExtendedResult(com.unboundid.ldap.sdk.extensions.AbortedTransactionExtendedResult) EndTransactionExtendedResult(com.unboundid.ldap.sdk.extensions.EndTransactionExtendedResult) PasswordModifyExtendedResult(com.unboundid.ldap.sdk.extensions.PasswordModifyExtendedResult) OperationType(com.unboundid.ldap.sdk.OperationType) EndTransactionExtendedResult(com.unboundid.ldap.sdk.extensions.EndTransactionExtendedResult) ObjectPair(com.unboundid.util.ObjectPair) DataProvider(org.testng.annotations.DataProvider)

Example 12 with PasswordModifyExtendedResult

use of com.unboundid.ldap.sdk.extensions.PasswordModifyExtendedResult in project ldapsdk by pingidentity.

the class LDAPPasswordModify method doPasswordModifyExtendedOperation.

/**
 * Attempts a password modify extended operation to change the target user's
 * password.
 *
 * @param  pool  A connection pool to use to communicate with the directory
 *               server.
 *
 * @return  A result code that indicates whether the password update was
 *          successful.
 */
@NotNull()
private ResultCode doPasswordModifyExtendedOperation(@NotNull final LDAPConnectionPool pool) {
    // Create the password modify extended request to be processed.
    final String identity;
    final byte[] currentPW;
    final byte[] newPW;
    final Control[] controls;
    try {
        identity = getUserIdentity(null, false);
        currentPW = getCurrentPassword();
        newPW = getNewPassword();
        controls = getUpdateControls();
    } catch (final LDAPException e) {
        Debug.debugException(e);
        logCompletionMessage(true, e.getMessage());
        return e.getResultCode();
    }
    final PasswordModifyExtendedRequest passwordModifyRequest = new PasswordModifyExtendedRequest(identity, currentPW, newPW, controls);
    // Send the request and interpret the response, including special handling
    // for any referral that might have been returned.
    LDAPConnection connection = null;
    try {
        connection = pool.getConnection();
        final PasswordModifyExtendedResult passwordModifyResult = (PasswordModifyExtendedResult) connection.processExtendedOperation(passwordModifyRequest);
        out();
        out(INFO_PWMOD_EXTOP_RESULT_HEADER.get());
        for (final String line : ResultUtils.formatResult(passwordModifyResult, true, 0, WRAP_COLUMN)) {
            out(line);
        }
        out();
        final String generatedPassword = passwordModifyResult.getGeneratedPassword();
        if (passwordModifyResult.getResultCode() == ResultCode.SUCCESS) {
            logCompletionMessage(false, INFO_PWMOD_EXTOP_SUCCESSFUL.get());
            if (generatedPassword != null) {
                out();
                wrapOut(0, WRAP_COLUMN, INFO_PWMOD_SERVER_GENERATED_PW.get(generatedPassword));
            }
            return ResultCode.SUCCESS;
        } else if (passwordModifyResult.getResultCode() == ResultCode.NO_OPERATION) {
            logCompletionMessage(false, INFO_PWMOD_EXTOP_NO_OP.get());
            if (generatedPassword != null) {
                out();
                wrapOut(0, WRAP_COLUMN, INFO_PWMOD_SERVER_GENERATED_PW.get(generatedPassword));
            }
            return ResultCode.SUCCESS;
        } else if ((passwordModifyResult.getResultCode() == ResultCode.REFERRAL) && followReferrals.isPresent() && (passwordModifyResult.getReferralURLs().length > 0)) {
            // extended operations.  If appropriate, try to follow it ourselves.
            return followPasswordModifyReferral(passwordModifyRequest, passwordModifyResult, connection, 1);
        } else {
            logCompletionMessage(true, ERR_PWMOD_EXTOP_FAILED.get(String.valueOf(passwordModifyResult.getResultCode()), passwordModifyResult.getDiagnosticMessage()));
            return passwordModifyResult.getResultCode();
        }
    } catch (final LDAPException e) {
        Debug.debugException(e);
        err();
        err(INFO_PWMOD_EXTOP_RESULT_HEADER.get());
        for (final String line : ResultUtils.formatResult(e, true, 0, WRAP_COLUMN)) {
            err(line);
        }
        err();
        if (connection != null) {
            pool.releaseDefunctConnection(connection);
            connection = null;
        }
        logCompletionMessage(true, ERR_PWMOD_EXTOP_ERROR.get(String.valueOf(e.getResultCode()), e.getMessage()));
        return e.getResultCode();
    } finally {
        if (connection != null) {
            pool.releaseConnection(connection);
        }
    }
}
Also used : AuthorizationIdentityRequestControl(com.unboundid.ldap.sdk.controls.AuthorizationIdentityRequestControl) Control(com.unboundid.ldap.sdk.Control) GetUserResourceLimitsRequestControl(com.unboundid.ldap.sdk.unboundidds.controls.GetUserResourceLimitsRequestControl) GetAuthorizationEntryRequestControl(com.unboundid.ldap.sdk.unboundidds.controls.GetAuthorizationEntryRequestControl) PurgePasswordRequestControl(com.unboundid.ldap.sdk.unboundidds.controls.PurgePasswordRequestControl) AssuredReplicationRequestControl(com.unboundid.ldap.sdk.unboundidds.controls.AssuredReplicationRequestControl) RetirePasswordRequestControl(com.unboundid.ldap.sdk.unboundidds.controls.RetirePasswordRequestControl) NoOpRequestControl(com.unboundid.ldap.sdk.unboundidds.controls.NoOpRequestControl) OperationPurposeRequestControl(com.unboundid.ldap.sdk.unboundidds.controls.OperationPurposeRequestControl) PasswordPolicyRequestControl(com.unboundid.ldap.sdk.unboundidds.controls.PasswordPolicyRequestControl) PasswordValidationDetailsRequestControl(com.unboundid.ldap.sdk.unboundidds.controls.PasswordValidationDetailsRequestControl) LDAPException(com.unboundid.ldap.sdk.LDAPException) PasswordModifyExtendedResult(com.unboundid.ldap.sdk.extensions.PasswordModifyExtendedResult) LDAPConnection(com.unboundid.ldap.sdk.LDAPConnection) PasswordModifyExtendedRequest(com.unboundid.ldap.sdk.extensions.PasswordModifyExtendedRequest) NotNull(com.unboundid.util.NotNull)

Example 13 with PasswordModifyExtendedResult

use of com.unboundid.ldap.sdk.extensions.PasswordModifyExtendedResult in project ldapsdk by pingidentity.

the class ResultUtils method formatResult.

/**
 * Adds a multi-line string representation of the provided result to the
 * given list.
 *
 * @param  lines     The list to which the lines should be added.
 * @param  result    The result to be formatted.
 * @param  inTxn     Indicates whether the operation is part of an active
 *                   transaction.
 * @param  prefix    The prefix to use for each line.
 * @param  maxWidth  The maximum length of each line in characters, including
 *                   the comment prefix and indent.
 */
private static void formatResult(@NotNull final List<String> lines, @NotNull final LDAPResult result, final boolean inTxn, @NotNull final String prefix, final int maxWidth) {
    // Format the result code.  If it's a success result but the operation was
    // part of a transaction, then indicate that no change has actually been
    // made yet.
    final ResultCode resultCode = result.getResultCode();
    wrap(lines, INFO_RESULT_UTILS_RESULT_CODE.get(String.valueOf(resultCode)), prefix, maxWidth);
    if (inTxn && (resultCode == ResultCode.SUCCESS)) {
        wrap(lines, INFO_RESULT_UTILS_SUCCESS_WITH_TXN.get(), prefix, maxWidth);
    }
    // Format the diagnostic message, if there is one.
    final String diagnosticMessage = result.getDiagnosticMessage();
    if (diagnosticMessage != null) {
        wrap(lines, INFO_RESULT_UTILS_DIAGNOSTIC_MESSAGE.get(diagnosticMessage), prefix, maxWidth);
    }
    // Format the matched DN, if there is one.
    final String matchedDN = result.getMatchedDN();
    if (matchedDN != null) {
        wrap(lines, INFO_RESULT_UTILS_MATCHED_DN.get(matchedDN), prefix, maxWidth);
    }
    // If there are any referral URLs, then display them.
    final String[] referralURLs = result.getReferralURLs();
    if (referralURLs != null) {
        for (final String referralURL : referralURLs) {
            wrap(lines, INFO_RESULT_UTILS_REFERRAL_URL.get(referralURL), prefix, maxWidth);
        }
    }
    if (result instanceof SearchResult) {
        final SearchResult searchResult = (SearchResult) result;
        // We'll always display the search entry count if we know it.
        final int numEntries = searchResult.getEntryCount();
        if (numEntries >= 0) {
            wrap(lines, INFO_RESULT_UTILS_NUM_SEARCH_ENTRIES.get(numEntries), prefix, maxWidth);
        }
        // We'll only display the search reference count if it's greater than
        // zero.
        final int numReferences = searchResult.getReferenceCount();
        if (numReferences > 0) {
            wrap(lines, INFO_RESULT_UTILS_NUM_SEARCH_REFERENCES.get(numReferences), prefix, maxWidth);
        }
    } else if (result instanceof StartTransactionExtendedResult) {
        final StartTransactionExtendedResult startTxnResult = (StartTransactionExtendedResult) result;
        final ASN1OctetString txnID = startTxnResult.getTransactionID();
        if (txnID != null) {
            if (StaticUtils.isPrintableString(txnID.getValue())) {
                wrap(lines, INFO_RESULT_UTILS_START_TXN_RESULT_TXN_ID.get(txnID.stringValue()), prefix, maxWidth);
            } else {
                wrap(lines, INFO_RESULT_UTILS_START_TXN_RESULT_TXN_ID.get("0x" + StaticUtils.toHex(txnID.getValue())), prefix, maxWidth);
            }
        }
    } else if (result instanceof EndTransactionExtendedResult) {
        final EndTransactionExtendedResult endTxnResult = (EndTransactionExtendedResult) result;
        final int failedOpMessageID = endTxnResult.getFailedOpMessageID();
        if (failedOpMessageID > 0) {
            wrap(lines, INFO_RESULT_UTILS_END_TXN_RESULT_FAILED_MSG_ID.get(failedOpMessageID), prefix, maxWidth);
        }
        final Map<Integer, Control[]> controls = endTxnResult.getOperationResponseControls();
        if (controls != null) {
            for (final Map.Entry<Integer, Control[]> e : controls.entrySet()) {
                for (final Control c : e.getValue()) {
                    wrap(lines, INFO_RESULT_UTILS_END_TXN_RESULT_OP_CONTROL.get(e.getKey()), prefix, maxWidth);
                    formatResponseControl(lines, c, prefix + "     ", maxWidth);
                }
            }
        }
    } else if (result instanceof MultiUpdateExtendedResult) {
        final MultiUpdateExtendedResult multiUpdateResult = (MultiUpdateExtendedResult) result;
        final MultiUpdateChangesApplied changesApplied = multiUpdateResult.getChangesApplied();
        if (changesApplied != null) {
            wrap(lines, INFO_RESULT_UTILS_MULTI_UPDATE_CHANGES_APPLIED.get(changesApplied.name()), prefix, maxWidth);
        }
        final List<ObjectPair<OperationType, LDAPResult>> multiUpdateResults = multiUpdateResult.getResults();
        if (multiUpdateResults != null) {
            for (final ObjectPair<OperationType, LDAPResult> p : multiUpdateResults) {
                wrap(lines, INFO_RESULT_UTILS_MULTI_UPDATE_RESULT_HEADER.get(p.getFirst().name()), prefix, maxWidth);
                formatResult(lines, p.getSecond(), false, prefix + "     ", maxWidth);
            }
        }
    } else if (result instanceof PasswordModifyExtendedResult) {
        final PasswordModifyExtendedResult passwordModifyResult = (PasswordModifyExtendedResult) result;
        final String generatedPassword = passwordModifyResult.getGeneratedPassword();
        if (generatedPassword != null) {
            wrap(lines, INFO_RESULT_UTILS_PASSWORD_MODIFY_RESULT_GENERATED_PW.get(generatedPassword), prefix, maxWidth);
        }
    } else if (result instanceof ExtendedResult) {
        final ExtendedResult extendedResult = (ExtendedResult) result;
        final String oid = ((ExtendedResult) result).getOID();
        if (oid != null) {
            wrap(lines, INFO_RESULT_UTILS_RESPONSE_EXTOP_OID.get(oid), prefix, maxWidth);
        }
        final ASN1OctetString value = extendedResult.getValue();
        if ((value != null) && (value.getValueLength() > 0)) {
            wrap(lines, INFO_RESULT_UTILS_RESPONSE_EXTOP_RAW_VALUE_HEADER.get(), prefix, maxWidth);
            // We'll ignore the maximum width for this portion of the output.
            for (final String line : StaticUtils.stringToLines(StaticUtils.toHexPlusASCII(value.getValue(), 0))) {
                lines.add(prefix + "     " + line);
            }
        }
    }
    // If there are any controls, then display them.  We'll interpret any
    // controls that we can, but will fall back to a general display for any
    // that we don't recognize or can't parse.
    final Control[] controls = result.getResponseControls();
    if (controls != null) {
        for (final Control c : controls) {
            formatResponseControl(lines, c, prefix, maxWidth);
        }
    }
}
Also used : ASN1OctetString(com.unboundid.asn1.ASN1OctetString) LDAPResult(com.unboundid.ldap.sdk.LDAPResult) SearchResult(com.unboundid.ldap.sdk.SearchResult) ASN1OctetString(com.unboundid.asn1.ASN1OctetString) MultiUpdateExtendedResult(com.unboundid.ldap.sdk.unboundidds.extensions.MultiUpdateExtendedResult) IntermediateClientResponseControl(com.unboundid.ldap.sdk.unboundidds.controls.IntermediateClientResponseControl) TransactionSettingsResponseControl(com.unboundid.ldap.sdk.unboundidds.controls.TransactionSettingsResponseControl) Control(com.unboundid.ldap.sdk.Control) UniquenessResponseControl(com.unboundid.ldap.sdk.unboundidds.controls.UniquenessResponseControl) SimplePagedResultsControl(com.unboundid.ldap.sdk.controls.SimplePagedResultsControl) PasswordValidationDetailsResponseControl(com.unboundid.ldap.sdk.unboundidds.controls.PasswordValidationDetailsResponseControl) VirtualListViewResponseControl(com.unboundid.ldap.sdk.controls.VirtualListViewResponseControl) GetPasswordPolicyStateIssuesResponseControl(com.unboundid.ldap.sdk.unboundidds.controls.GetPasswordPolicyStateIssuesResponseControl) AccountUsableResponseControl(com.unboundid.ldap.sdk.unboundidds.controls.AccountUsableResponseControl) GetServerIDResponseControl(com.unboundid.ldap.sdk.unboundidds.controls.GetServerIDResponseControl) SoftDeleteResponseControl(com.unboundid.ldap.sdk.unboundidds.controls.SoftDeleteResponseControl) PasswordExpiredControl(com.unboundid.ldap.sdk.controls.PasswordExpiredControl) PasswordExpiringControl(com.unboundid.ldap.sdk.controls.PasswordExpiringControl) PostReadResponseControl(com.unboundid.ldap.sdk.controls.PostReadResponseControl) GetAuthorizationEntryResponseControl(com.unboundid.ldap.sdk.unboundidds.controls.GetAuthorizationEntryResponseControl) ServerSideSortResponseControl(com.unboundid.ldap.sdk.controls.ServerSideSortResponseControl) MatchingEntryCountResponseControl(com.unboundid.ldap.sdk.unboundidds.controls.MatchingEntryCountResponseControl) GeneratePasswordResponseControl(com.unboundid.ldap.sdk.unboundidds.controls.GeneratePasswordResponseControl) EntryChangeNotificationControl(com.unboundid.ldap.sdk.controls.EntryChangeNotificationControl) GetUserResourceLimitsResponseControl(com.unboundid.ldap.sdk.unboundidds.controls.GetUserResourceLimitsResponseControl) AssuredReplicationResponseControl(com.unboundid.ldap.sdk.unboundidds.controls.AssuredReplicationResponseControl) ContentSyncStateControl(com.unboundid.ldap.sdk.controls.ContentSyncStateControl) GetRecentLoginHistoryResponseControl(com.unboundid.ldap.sdk.unboundidds.controls.GetRecentLoginHistoryResponseControl) JoinResultControl(com.unboundid.ldap.sdk.unboundidds.controls.JoinResultControl) GetBackendSetIDResponseControl(com.unboundid.ldap.sdk.unboundidds.controls.GetBackendSetIDResponseControl) PasswordPolicyResponseControl(com.unboundid.ldap.sdk.unboundidds.controls.PasswordPolicyResponseControl) PreReadResponseControl(com.unboundid.ldap.sdk.controls.PreReadResponseControl) AuthorizationIdentityResponseControl(com.unboundid.ldap.sdk.controls.AuthorizationIdentityResponseControl) ContentSyncDoneControl(com.unboundid.ldap.sdk.controls.ContentSyncDoneControl) MultiUpdateChangesApplied(com.unboundid.ldap.sdk.unboundidds.extensions.MultiUpdateChangesApplied) PasswordModifyExtendedResult(com.unboundid.ldap.sdk.extensions.PasswordModifyExtendedResult) StartTransactionExtendedResult(com.unboundid.ldap.sdk.extensions.StartTransactionExtendedResult) ExtendedResult(com.unboundid.ldap.sdk.ExtendedResult) StartTransactionExtendedResult(com.unboundid.ldap.sdk.extensions.StartTransactionExtendedResult) NoticeOfDisconnectionExtendedResult(com.unboundid.ldap.sdk.extensions.NoticeOfDisconnectionExtendedResult) MultiUpdateExtendedResult(com.unboundid.ldap.sdk.unboundidds.extensions.MultiUpdateExtendedResult) AbortedTransactionExtendedResult(com.unboundid.ldap.sdk.extensions.AbortedTransactionExtendedResult) EndTransactionExtendedResult(com.unboundid.ldap.sdk.extensions.EndTransactionExtendedResult) PasswordModifyExtendedResult(com.unboundid.ldap.sdk.extensions.PasswordModifyExtendedResult) List(java.util.List) ArrayList(java.util.ArrayList) OperationType(com.unboundid.ldap.sdk.OperationType) EndTransactionExtendedResult(com.unboundid.ldap.sdk.extensions.EndTransactionExtendedResult) Map(java.util.Map) AssuredReplicationServerResultCode(com.unboundid.ldap.sdk.unboundidds.controls.AssuredReplicationServerResultCode) ResultCode(com.unboundid.ldap.sdk.ResultCode) ObjectPair(com.unboundid.util.ObjectPair)

Aggregations

PasswordModifyExtendedResult (com.unboundid.ldap.sdk.extensions.PasswordModifyExtendedResult)13 PasswordModifyExtendedRequest (com.unboundid.ldap.sdk.extensions.PasswordModifyExtendedRequest)10 Control (com.unboundid.ldap.sdk.Control)9 LDAPConnection (com.unboundid.ldap.sdk.LDAPConnection)8 Test (org.testng.annotations.Test)6 ASN1OctetString (com.unboundid.asn1.ASN1OctetString)4 ExtendedResult (com.unboundid.ldap.sdk.ExtendedResult)4 LDAPException (com.unboundid.ldap.sdk.LDAPException)3 LDAPResult (com.unboundid.ldap.sdk.LDAPResult)3 OperationType (com.unboundid.ldap.sdk.OperationType)3 PasswordPolicyResponseControl (com.unboundid.ldap.sdk.unboundidds.controls.PasswordPolicyResponseControl)3 ArrayList (java.util.ArrayList)3 AuthorizationIdentityResponseControl (com.unboundid.ldap.sdk.controls.AuthorizationIdentityResponseControl)2 ContentSyncDoneControl (com.unboundid.ldap.sdk.controls.ContentSyncDoneControl)2 ContentSyncStateControl (com.unboundid.ldap.sdk.controls.ContentSyncStateControl)2 EntryChangeNotificationControl (com.unboundid.ldap.sdk.controls.EntryChangeNotificationControl)2 PasswordExpiredControl (com.unboundid.ldap.sdk.controls.PasswordExpiredControl)2 PasswordExpiringControl (com.unboundid.ldap.sdk.controls.PasswordExpiringControl)2 PostReadResponseControl (com.unboundid.ldap.sdk.controls.PostReadResponseControl)2 PreReadResponseControl (com.unboundid.ldap.sdk.controls.PreReadResponseControl)2