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  @Override
043  public AuthenticationInfo getAuthenticationInfo()
044  {
045    return getOperation().getAuthenticationInfo();
046  }
047
048  @Override
049  public AuthenticationType getAuthenticationType()
050  {
051    return getOperation().getAuthenticationType();
052  }
053
054  @Override
055  public LocalizableMessage getAuthFailureReason()
056  {
057    return getOperation().getAuthFailureReason();
058  }
059
060  @Override
061  public DN getBindDN()
062  {
063    return getOperation().getBindDN();
064  }
065
066  @Override
067  public ByteString getRawBindDN()
068  {
069    return getOperation().getRawBindDN();
070  }
071
072  @Override
073  public Entry getSASLAuthUserEntry()
074  {
075    return getOperation().getSASLAuthUserEntry();
076  }
077
078  @Override
079  public ByteString getSASLCredentials()
080  {
081    return getOperation().getSASLCredentials();
082  }
083
084  @Override
085  public String getSASLMechanism()
086  {
087    return getOperation().getSASLMechanism();
088  }
089
090  @Override
091  public ByteString getServerSASLCredentials()
092  {
093    return getOperation().getServerSASLCredentials();
094  }
095
096  @Override
097  public ByteString getSimplePassword()
098  {
099    return getOperation().getSimplePassword();
100  }
101
102  @Override
103  public DN getUserEntryDN()
104  {
105    return getOperation().getUserEntryDN();
106  }
107
108  @Override
109  public void setAuthenticationInfo(AuthenticationInfo authInfo)
110  {
111    getOperation().setAuthenticationInfo(authInfo);
112  }
113
114  @Override
115  public void setAuthFailureReason(LocalizableMessage reason)
116  {
117    if (DirectoryServer.returnBindErrorMessages())
118    {
119      getOperation().appendErrorMessage(reason);
120    }
121    else
122    {
123      getOperation().setAuthFailureReason(reason);
124    }
125  }
126
127  @Override
128  public void setRawBindDN(ByteString rawBindDN)
129  {
130    getOperation().setRawBindDN(rawBindDN);
131  }
132
133  @Override
134  public void setSASLAuthUserEntry(Entry saslAuthUserEntry)
135  {
136    getOperation().setSASLAuthUserEntry(saslAuthUserEntry);
137  }
138
139  @Override
140  public void setSASLCredentials(String saslMechanism,
141      ByteString saslCredentials)
142  {
143    getOperation().setSASLCredentials(saslMechanism, saslCredentials);
144  }
145
146  @Override
147  public void setServerSASLCredentials(ByteString serverSASLCredentials)
148  {
149    getOperation().setServerSASLCredentials(serverSASLCredentials);
150  }
151
152  @Override
153  public void setSimplePassword(ByteString simplePassword)
154  {
155    getOperation().setSimplePassword(simplePassword);
156  }
157
158  @Override
159  public void setUserEntryDN(DN userEntryDN){
160    getOperation().setUserEntryDN(userEntryDN);
161  }
162
163  @Override
164  public String toString()
165  {
166    return getOperation().toString();
167  }
168
169  @Override
170  public void setProtocolVersion(String protocolVersion)
171  {
172    getOperation().setProtocolVersion(protocolVersion);
173  }
174
175  @Override
176  public String getProtocolVersion()
177  {
178    return getOperation().getProtocolVersion();
179  }
180}