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