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 2008 Sun Microsystems, Inc.
025 *      Portions Copyright 2013-2015 ForgeRock AS
026 */
027package org.opends.server.core;
028
029import org.opends.server.types.*;
030import org.forgerock.i18n.LocalizableMessage;
031import org.forgerock.opendj.ldap.ByteString;
032
033/**
034 * This abstract class wraps/decorates a given bind operation.
035 * This class will be extended by sub-classes to enhance the
036 * functionality of the BindOperationBasis.
037 */
038public abstract class BindOperationWrapper extends
039    OperationWrapper<BindOperation> implements BindOperation
040{
041  /**
042   * Creates a new bind operation based on the provided bind operation.
043   *
044   * @param bind The bind operation to wrap
045   */
046  protected BindOperationWrapper(BindOperation bind)
047  {
048    super(bind);
049  }
050
051  /** {@inheritDoc} */
052  @Override
053  public AuthenticationInfo getAuthenticationInfo()
054  {
055    return getOperation().getAuthenticationInfo();
056  }
057
058  /** {@inheritDoc} */
059  @Override
060  public AuthenticationType getAuthenticationType()
061  {
062    return getOperation().getAuthenticationType();
063  }
064
065  /** {@inheritDoc} */
066  @Override
067  public LocalizableMessage getAuthFailureReason()
068  {
069    return getOperation().getAuthFailureReason();
070  }
071
072  /** {@inheritDoc} */
073  @Override
074  public DN getBindDN()
075  {
076    return getOperation().getBindDN();
077  }
078
079  /** {@inheritDoc} */
080  @Override
081  public ByteString getRawBindDN()
082  {
083    return getOperation().getRawBindDN();
084  }
085
086  /** {@inheritDoc} */
087  @Override
088  public Entry getSASLAuthUserEntry()
089  {
090    return getOperation().getSASLAuthUserEntry();
091  }
092
093  /** {@inheritDoc} */
094  @Override
095  public ByteString getSASLCredentials()
096  {
097    return getOperation().getSASLCredentials();
098  }
099
100  /** {@inheritDoc} */
101  @Override
102  public String getSASLMechanism()
103  {
104    return getOperation().getSASLMechanism();
105  }
106
107  /** {@inheritDoc} */
108  @Override
109  public ByteString getServerSASLCredentials()
110  {
111    return getOperation().getServerSASLCredentials();
112  }
113
114  /** {@inheritDoc} */
115  @Override
116  public ByteString getSimplePassword()
117  {
118    return getOperation().getSimplePassword();
119  }
120
121  /** {@inheritDoc} */
122  @Override
123  public DN getUserEntryDN()
124  {
125    return getOperation().getUserEntryDN();
126  }
127
128  /** {@inheritDoc} */
129  @Override
130  public void setAuthenticationInfo(AuthenticationInfo authInfo)
131  {
132    getOperation().setAuthenticationInfo(authInfo);
133  }
134
135  /** {@inheritDoc} */
136  @Override
137  public void setAuthFailureReason(LocalizableMessage reason)
138  {
139    if (DirectoryServer.returnBindErrorMessages())
140    {
141      getOperation().appendErrorMessage(reason);
142    }
143    else
144    {
145      getOperation().setAuthFailureReason(reason);
146    }
147  }
148
149  /** {@inheritDoc} */
150  @Override
151  public void setRawBindDN(ByteString rawBindDN)
152  {
153    getOperation().setRawBindDN(rawBindDN);
154  }
155
156  /** {@inheritDoc} */
157  @Override
158  public void setSASLAuthUserEntry(Entry saslAuthUserEntry)
159  {
160    getOperation().setSASLAuthUserEntry(saslAuthUserEntry);
161  }
162
163  /** {@inheritDoc} */
164  @Override
165  public void setSASLCredentials(String saslMechanism,
166      ByteString saslCredentials)
167  {
168    getOperation().setSASLCredentials(saslMechanism, saslCredentials);
169  }
170
171  /** {@inheritDoc} */
172  @Override
173  public void setServerSASLCredentials(ByteString serverSASLCredentials)
174  {
175    getOperation().setServerSASLCredentials(serverSASLCredentials);
176  }
177
178  /** {@inheritDoc} */
179  @Override
180  public void setSimplePassword(ByteString simplePassword)
181  {
182    getOperation().setSimplePassword(simplePassword);
183  }
184
185  /** {@inheritDoc} */
186  @Override
187  public void setUserEntryDN(DN userEntryDN){
188    getOperation().setUserEntryDN(userEntryDN);
189  }
190
191  /** {@inheritDoc} */
192  @Override
193  public String toString()
194  {
195    return getOperation().toString();
196  }
197
198  /** {@inheritDoc} */
199  @Override
200  public void setProtocolVersion(String protocolVersion)
201  {
202    getOperation().setProtocolVersion(protocolVersion);
203  }
204
205  /** {@inheritDoc} */
206  @Override
207  public String getProtocolVersion()
208  {
209    return getOperation().getProtocolVersion();
210  }
211
212}