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 010 * trunk/opends/resource/legal-notices/OpenDS.LICENSE 011 * or https://OpenDS.dev.java.net/OpenDS.LICENSE. 012 * See the License for the specific language governing permissions 013 * and limitations under the License. 014 * 015 * When distributing Covered Code, include this CDDL HEADER in each 016 * file and include the License file at 017 * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable, 018 * add the following below this CDDL HEADER, with the fields enclosed 019 * by brackets "[]" replaced with your own identifying information: 020 * Portions Copyright [yyyy] [name of copyright owner] 021 * 022 * CDDL HEADER END 023 * 024 * 025 * Copyright 2008 Sun Microsystems, Inc. 026 */ 027 package org.opends.server.core; 028 import org.opends.messages.Message; 029 030 031 import org.opends.server.protocols.asn1.ASN1OctetString; 032 import org.opends.server.types.AuthenticationInfo; 033 import org.opends.server.types.AuthenticationType; 034 import org.opends.server.types.ByteString; 035 import org.opends.server.types.DN; 036 import org.opends.server.types.Entry; 037 038 039 040 /** 041 * This abstract class wraps/decorates a given bind operation. 042 * This class will be extended by sub-classes to enhance the 043 * functionnality of the BindOperationBasis. 044 */ 045 public abstract class BindOperationWrapper extends OperationWrapper 046 implements BindOperation 047 { 048 // The wrapped operation. 049 private BindOperation bind; 050 051 /** 052 * Creates a new bind operation based on the provided bind operation. 053 * 054 * @param bind The bind operation to wrap 055 */ 056 protected BindOperationWrapper(BindOperation bind) 057 { 058 super(bind); 059 this.bind = bind; 060 } 061 062 /** 063 * {@inheritDoc} 064 */ 065 public AuthenticationInfo getAuthenticationInfo() 066 { 067 return bind.getAuthenticationInfo(); 068 } 069 070 /** 071 * {@inheritDoc} 072 */ 073 public AuthenticationType getAuthenticationType() 074 { 075 return bind.getAuthenticationType(); 076 } 077 078 /** 079 * {@inheritDoc} 080 */ 081 public Message getAuthFailureReason() 082 { 083 return bind.getAuthFailureReason(); 084 } 085 086 /** 087 * {@inheritDoc} 088 */ 089 public DN getBindDN() 090 { 091 return bind.getBindDN(); 092 } 093 094 /** 095 * {@inheritDoc} 096 */ 097 public ByteString getRawBindDN() 098 { 099 return bind.getRawBindDN(); 100 } 101 102 /** 103 * {@inheritDoc} 104 */ 105 public Entry getSASLAuthUserEntry() 106 { 107 return bind.getSASLAuthUserEntry(); 108 } 109 110 /** 111 * {@inheritDoc} 112 */ 113 public ASN1OctetString getSASLCredentials() 114 { 115 return bind.getSASLCredentials(); 116 } 117 118 /** 119 * {@inheritDoc} 120 */ 121 public String getSASLMechanism() 122 { 123 return bind.getSASLMechanism(); 124 } 125 126 /** 127 * {@inheritDoc} 128 */ 129 public ASN1OctetString getServerSASLCredentials() 130 { 131 return bind.getServerSASLCredentials(); 132 } 133 134 /** 135 * {@inheritDoc} 136 */ 137 public ByteString getSimplePassword() 138 { 139 return bind.getSimplePassword(); 140 } 141 142 /** 143 * {@inheritDoc} 144 */ 145 public DN getUserEntryDN() 146 { 147 return bind.getUserEntryDN(); 148 } 149 150 /** 151 * {@inheritDoc} 152 */ 153 public void setAuthenticationInfo(AuthenticationInfo authInfo) 154 { 155 bind.setAuthenticationInfo(authInfo); 156 } 157 158 /** 159 * {@inheritDoc} 160 */ 161 public void setAuthFailureReason(Message reason) 162 { 163 if (DirectoryServer.returnBindErrorMessages()) 164 { 165 bind.appendErrorMessage(reason); 166 } 167 else 168 { 169 bind.setAuthFailureReason(reason); 170 } 171 } 172 173 /** 174 * {@inheritDoc} 175 */ 176 public void setRawBindDN(ByteString rawBindDN) 177 { 178 bind.setRawBindDN(rawBindDN); 179 } 180 181 /** 182 * {@inheritDoc} 183 */ 184 public void setSASLAuthUserEntry(Entry saslAuthUserEntry) 185 { 186 bind.setSASLAuthUserEntry(saslAuthUserEntry); 187 } 188 189 /** 190 * {@inheritDoc} 191 */ 192 public void setSASLCredentials(String saslMechanism, 193 ASN1OctetString saslCredentials) 194 { 195 bind.setSASLCredentials(saslMechanism, saslCredentials); 196 } 197 198 /** 199 * {@inheritDoc} 200 */ 201 public void setServerSASLCredentials(ASN1OctetString serverSASLCredentials) 202 { 203 bind.setServerSASLCredentials(serverSASLCredentials); 204 } 205 206 /** 207 * {@inheritDoc} 208 */ 209 public void setSimplePassword(ByteString simplePassword) 210 { 211 bind.setSimplePassword(simplePassword); 212 } 213 214 /** 215 * {@inheritDoc} 216 */ 217 public void setUserEntryDN(DN userEntryDN){ 218 bind.setUserEntryDN(userEntryDN); 219 } 220 221 /** 222 * {@inheritDoc} 223 */ 224 public String toString() 225 { 226 return bind.toString(); 227 } 228 229 /** 230 * {@inheritDoc} 231 */ 232 public void setProtocolVersion(String protocolVersion) 233 { 234 bind.setProtocolVersion(protocolVersion); 235 } 236 237 /** 238 * {@inheritDoc} 239 */ 240 public String getProtocolVersion() 241 { 242 return bind.getProtocolVersion(); 243 } 244 245 }