001 /* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 * 019 */ 020 package org.apache.directory.shared.ldap.message.internal; 021 022 import org.apache.directory.shared.ldap.codec.MessageTypeEnum; 023 import org.apache.directory.shared.ldap.message.SingleReplyRequest; 024 import org.apache.directory.shared.ldap.name.DN; 025 026 027 /** 028 * Bind protocol operation request which authenticates and begins a client 029 * session. Does not yet contain interfaces for SASL authentication mechanisms. 030 * 031 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 032 * @version $Rev: 918756 $ 033 */ 034 public interface InternalBindRequest extends SingleReplyRequest, InternalAbandonableRequest 035 { 036 /** Bind request message type enumeration value */ 037 MessageTypeEnum TYPE = MessageTypeEnum.BIND_REQUEST; 038 039 /** Bind response message type enumeration value */ 040 MessageTypeEnum RESP_TYPE = InternalBindResponse.TYPE; 041 042 043 /** 044 * Checks to see if the authentication mechanism is simple and not SASL 045 * based. 046 * 047 * @return true if the mechanism is simple false if it is SASL based. 048 */ 049 boolean isSimple(); 050 051 052 /** 053 * Checks to see if the authentication mechanism is simple and not SASL 054 * based. 055 * 056 * @return true if the mechanism is simple false if it is SASL based. 057 */ 058 boolean getSimple(); 059 060 061 /** 062 * Sets the authentication mechanism to simple or to SASL based 063 * authentication. 064 * 065 * @param isSimple 066 * true if authentication is simple, false otherwise. 067 */ 068 void setSimple( boolean isSimple ); 069 070 071 /** 072 * Gets the simple credentials associated with a simple authentication 073 * attempt or null if this request uses SASL authentication mechanisms. 074 * 075 * @return null if the mechanism is SASL or the credentials if it is simple. 076 */ 077 byte[] getCredentials(); 078 079 080 /** 081 * Sets the simple credentials associated with a simple authentication 082 * attempt ignored if this request uses SASL authentication mechanisms. 083 * 084 * @param credentials 085 * the credentials if authentication is simple, null otherwise 086 */ 087 void setCredentials( byte[] credentials ); 088 089 090 /** 091 * Gets the distinguished name of the subject in this authentication 092 * request. This field may take on a null value (a zero length string) for 093 * the purposes of anonymous binds, when authentication has been performed 094 * at a lower layer, or when using SASL credentials with a mechanism that 095 * includes the DN in the credentials. 096 * 097 * @return the DN of the authenticating user. 098 */ 099 DN getName(); 100 101 102 /** 103 * Sets the distinguished name of the subject in this authentication 104 * request. This field may take on a null value (or a zero length string) 105 * for the purposes of anonymous binds, when authentication has been 106 * performed at a lower layer, or when using SASL credentials with a 107 * mechanism that includes the DN in the credentials. 108 * 109 * @param name 110 * the DN of the authenticating user - leave null for annonymous 111 * user. 112 */ 113 void setName( DN name ); 114 115 116 /** 117 * Checks to see if the Ldap v3 protocol is used. Normally this would 118 * extract a version number from the bind request sent by the client 119 * indicating the version of the protocol to be used in this protocol 120 * session. The integer is either a 2 or a 3 at the moment. We thought it 121 * was better to just check if the protocol used is 3 or not rather than use 122 * an type-safe enumeration type for a binary value. If an LDAPv4 comes out 123 * then we shall convert the return type to a type safe enumeration. 124 * 125 * @return true if client using version 3 false if it is version 2. 126 */ 127 boolean isVersion3(); 128 129 130 /** 131 * Gets whether or not the Ldap v3 protocol is used. Normally this would 132 * extract a version number from the bind request sent by the client 133 * indicating the version of the protocol to be used in this protocol 134 * session. The integer is either a 2 or a 3 at the moment. We thought it 135 * was better to just check if the protocol used is 3 or not rather than use 136 * an type-safe enumeration type for a binary value. If an LDAPv4 comes out 137 * then we shall convert the return type to a type safe enumeration. 138 * 139 * @return true if client using version 3 false if it is version 2. 140 */ 141 boolean getVersion3(); 142 143 144 /** 145 * Sets whether or not the LDAP v3 or v2 protocol is used. Normally this 146 * would extract a version number from the bind request sent by the client 147 * indicating the version of the protocol to be used in this protocol 148 * session. The integer is either a 2 or a 3 at the moment. We thought it 149 * was better to just check if the protocol used is 3 or not rather than use 150 * an type-safe enumeration type for a binary value. If an LDAPv4 comes out 151 * then we shall convert the return type to a type safe enumeration. 152 * 153 * @param isVersion3 154 * if true the client will be exhibiting version 3 bind behavoir, 155 * if false is used version 2 behavoir will be exhibited. 156 */ 157 void setVersion3( boolean isVersion3 ); 158 159 160 /** 161 * Gets the SASL mechanism String associated with this BindRequest if the 162 * bind operation is using SASL. 163 * 164 * @return the SASL mechanism or null if the bind op is simple 165 */ 166 String getSaslMechanism(); 167 168 169 /** 170 * Sets the SASL mechanism String associated with this BindRequest if the 171 * bind operation is using SASL. 172 * 173 * @param saslMechanism 174 * the SASL mechanism 175 */ 176 void setSaslMechanism( String saslMechanism ); 177 }