001/*
002 * CDDL HEADER START
003 *
004 * The contents of this file are subject to the terms of the
005 * Common Development and Distribution License, Version 1.0 only
006 * (the "License").  You may not use this file except in compliance
007 * with the License.
008 *
009 * You can obtain a copy of the license at
010 * docs/licenses/cddl.txt
011 * or http://www.opensource.org/licenses/cddl1.php.
012 * See the License for the specific language governing permissions
013 * and limitations under the License.
014 *
015 * When distributing Covered Code, include this CDDL HEADER in each
016 * file and include the License file at
017 * docs/licenses/cddl.txt.  If applicable,
018 * add the following below this CDDL HEADER, with the fields enclosed
019 * by brackets "[]" replaced with your own identifying information:
020 *      Portions Copyright [yyyy] [name of copyright owner]
021 *
022 * CDDL HEADER END
023 *
024 *
025 *      Copyright 2010-2020 Ping Identity Corporation
026 */
027package com.unboundid.directory.sdk.common.operation;
028
029
030
031import com.unboundid.asn1.ASN1OctetString;
032import com.unboundid.ldap.sdk.DN;
033import com.unboundid.util.ByteString;
034import com.unboundid.util.NotExtensible;
035import com.unboundid.util.ThreadSafety;
036import com.unboundid.util.ThreadSafetyLevel;
037
038
039
040/**
041 * This interface defines a set of methods which may be used to update a simple
042 * bind request.
043 */
044@NotExtensible()
045@ThreadSafety(level=ThreadSafetyLevel.INTERFACE_NOT_THREADSAFE)
046public interface UpdatableSimpleBindRequest
047       extends SimpleBindRequest, UpdatableBindRequest
048{
049  /**
050   * Specifies the DN of the user attempting to bind.
051   *
052   * @param  dn  The DN of the user that is trying to authenticate.  It must not
053   *             be {@code null}, but it may be an empty string to indicate a
054   *             zero-length DN.
055   */
056  void setDN(final String dn);
057
058
059
060  /**
061   * Specifies the DN of the user attempting to bind.
062   *
063   * @param  dn  The DN of the user that is trying to authenticate.  It must not
064   *             be {@code null}, but it may be an empty string to indicate a
065   *             zero-length DN.
066   */
067  void setDN(final DN dn);
068
069
070
071  /**
072   * Specifies the password for the bind request.
073   *
074   * @param  password  The password for the bind request.  It must not be
075   *                   {@code null} but may be a zero-length byte string  for
076   *                   anonymous authentication.
077   */
078  void setPassword(final ByteString password);
079
080
081
082  /**
083   * Specifies the password for the bind request.
084   *
085   * @param  password  The password for the bind request.  It must not be
086   *                   {@code null} but may be a zero-length byte string  for
087   *                   anonymous authentication.
088   */
089  void setPassword(final String password);
090
091
092
093  /**
094   * Converts this simple bind request to a SASL bind request.  After invoking
095   * this method, the caller should not make any further attempt to access this
096   * simple bind request object, but should only interact with the
097   * {@link UpdatableSASLBindRequest} object that is returned.
098   *
099   * @param  saslMechanism    The name of the SASL mechanism to use for the
100   *                          SASL bind request.  This must not be {@code null}
101   *                          or empty.
102   * @param  saslCredentials  The encoded SASL credentials to use for the SASL
103   *                          bind request.  This may be {@code null} if no
104   *                          SASL credentials are needed.
105   *
106   * @return  The {@code UpdatableSASLBindRequest} that was created and will be
107   *          used for the operation going forward.
108   */
109  UpdatableSASLBindRequest convertToSASLBindRequest(final String saslMechanism,
110                                final ASN1OctetString saslCredentials);
111}