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 legal-notices/CDDLv1_0.txt
010 * or http://forgerock.org/license/CDDLv1.0.html.
011 * See the License for the specific language governing permissions
012 * and limitations under the License.
013 *
014 * When distributing Covered Code, include this CDDL HEADER in each
015 * file and include the License file at legal-notices/CDDLv1_0.txt.
016 * If applicable, add the following below this CDDL HEADER, with the
017 * fields enclosed by brackets "[]" replaced with your own identifying
018 * information:
019 *      Portions Copyright [yyyy] [name of copyright owner]
020 *
021 * CDDL HEADER END
022 *
023 *
024 *      Copyright 2006-2008 Sun Microsystems, Inc.
025 *      Portions Copyright 2014-2015 ForgeRock AS
026 */
027package org.opends.server.types.operation;
028import org.forgerock.i18n.LocalizableMessage;
029
030
031
032import org.opends.server.types.AuthenticationType;
033import org.forgerock.opendj.ldap.ByteString;
034import org.opends.server.types.DN;
035
036
037
038/**
039 * This class defines a set of methods that are available for use by
040 * pre-operation plugins for bind operations.  Note that this
041 * interface is intended only to define an API for use by plugins and
042 * is not intended to be implemented by any custom classes.
043 */
044@org.opends.server.types.PublicAPI(
045     stability=org.opends.server.types.StabilityLevel.UNCOMMITTED,
046     mayInstantiate=false,
047     mayExtend=false,
048     mayInvoke=true)
049public interface PreOperationBindOperation
050       extends PreOperationOperation
051{
052  /**
053   * Retrieves the authentication type for this bind operation.
054   *
055   * @return  The authentication type for this bind operation.
056   */
057  AuthenticationType getAuthenticationType();
058
059
060
061  /**
062   * Retrieves a string representation of the protocol version
063   * associated with this bind request.
064   *
065   * @return  A string representation of the protocol version
066   *          associated with this bind request.
067   */
068  String getProtocolVersion();
069
070
071
072  /**
073   * Retrieves the raw, unprocessed bind DN for this bind operation as
074   * contained in the client request.  The value may not actually
075   * contain a valid DN, as no validation will have been performed.
076   *
077   * @return  The raw, unprocessed bind DN for this bind operation as
078   *          contained in the client request.
079   */
080  ByteString getRawBindDN();
081
082
083
084  /**
085   * Retrieves the bind DN for this bind operation.
086   *
087   * @return  The bind DN for this bind operation.
088   */
089  DN getBindDN();
090
091
092
093  /**
094   * Retrieves the simple authentication password for this bind
095   * operation.
096   *
097   * @return  The simple authentication password for this bind
098   *          operation.
099   */
100  ByteString getSimplePassword();
101
102
103
104  /**
105   * Retrieves the SASL mechanism for this bind operation.
106   *
107   * @return  The SASL mechanism for this bind operation, or
108   *          <CODE>null</CODE> if the bind does not use SASL
109   *          authentication.
110   */
111  String getSASLMechanism();
112
113
114
115  /**
116   * Retrieves the SASL credentials for this bind operation.
117   *
118   * @return  The SASL credentials for this bind operation, or
119   *          <CODE>null</CODE> if there are none or if the bind does
120   *          not use SASL authentication.
121   */
122  ByteString getSASLCredentials();
123
124
125
126  /**
127   * Specifies the set of server SASL credentials to include in the
128   * bind response.
129   *
130   * @param  serverSASLCredentials  The set of server SASL credentials
131   *                                to include in the bind response.
132   */
133  void setServerSASLCredentials(ByteString serverSASLCredentials);
134
135
136
137  /**
138   * Specifies the reason that the authentication failed.
139   *
140   * @param  reason  A human-readable message providing the reason
141   *                 that the authentication failed.
142   */
143  void setAuthFailureReason(LocalizableMessage reason);
144
145
146
147  /**
148   * Retrieves the user entry DN for this bind operation.  It will
149   * only be available for simple bind operations (and may be
150   * different than the bind DN from the client request).
151   *
152   * @return  The user entry DN for this bind operation, or
153   *          <CODE>null</CODE> if the bind processing has not
154   *          progressed far enough to identify the user or if the
155   *          user DN could not be determined.
156   */
157  DN getUserEntryDN();
158}
159