001/*
002 * The contents of this file are subject to the terms of the Common Development and
003 * Distribution License (the License). You may not use this file except in compliance with the
004 * License.
005 *
006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
007 * specific language governing permission and limitations under the License.
008 *
009 * When distributing Covered Software, include this CDDL Header Notice in each file and include
010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
011 * Header, with the fields enclosed by brackets [] replaced by your own identifying
012 * information: "Portions Copyright [year] [name of copyright owner]".
013 *
014 * Copyright 2009 Sun Microsystems, Inc.
015 * Portions Copyright 2014 ForgeRock AS.
016 */
017
018package org.forgerock.opendj.ldap.requests;
019
020import java.util.List;
021
022import org.forgerock.opendj.ldap.DecodeException;
023import org.forgerock.opendj.ldap.DecodeOptions;
024import org.forgerock.opendj.ldap.LdapException;
025import org.forgerock.opendj.ldap.controls.Control;
026import org.forgerock.opendj.ldap.controls.ControlDecoder;
027
028/**
029 * The SASL authentication method of the Bind operation allows clients to
030 * authenticate using one of the SASL authentication methods defined in RFC
031 * 4513.
032 * <p>
033 * <TODO>finish doc.
034 *
035 * @see <a href="http://tools.ietf.org/html/rfc4513#section-5.2.1.8">RFC 4513 -
036 *      SASL Authorization Identities (authzId) </a>
037 */
038public interface SASLBindRequest extends BindRequest {
039
040    @Override
041    SASLBindRequest addControl(Control control);
042
043    @Override
044    BindClient createBindClient(String serverName) throws LdapException;
045
046    /**
047     * Returns the authentication mechanism identifier for this SASL bind
048     * request as defined by the LDAP protocol, which is always {@code 0xA3}.
049     *
050     * @return The authentication mechanism identifier.
051     */
052    @Override
053    byte getAuthenticationType();
054
055    @Override
056    <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options)
057            throws DecodeException;
058
059    @Override
060    List<Control> getControls();
061
062    /**
063     * Returns the name of the Directory object that the client wishes to bind
064     * as, which is always the empty string for SASL authentication.
065     *
066     * @return The name of the Directory object that the client wishes to bind
067     *         as.
068     */
069    @Override
070    String getName();
071
072    /**
073     * Returns the SASL mechanism for this SASL bind request.
074     *
075     * @return The SASL mechanism for this bind request.
076     */
077    String getSASLMechanism();
078
079}