1 /******************************************************************************
3 * Copyright (c) 2003 Novell Inc. www.novell.com
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the Software), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 *******************************************************************************/
24 // Novell.Directory.Ldap.LdapBindRequest.cs
27 // Sunil Kumar (Sunilk@novell.com)
29 // (C) 2003 Novell, Inc (http://www.novell.com)
33 using Novell.Directory.Ldap.Asn1;
34 using Novell.Directory.Ldap.Rfc2251;
35 namespace Novell.Directory.Ldap
38 /// <summary> Represents a simple bind request.
41 /// <seealso cref="LdapConnection.SendRequest">
44 * BindRequest ::= [APPLICATION 0] SEQUENCE {
45 * version INTEGER (1 .. 127),
47 * authentication AuthenticationChoice }
49 public class LdapBindRequest:LdapMessage
51 /// <summary> Retrieves the Authentication DN for a bind request.
54 /// <returns> the Authentication DN for a bind request
56 virtual public System.String AuthenticationDN
60 return Asn1Object.RequestDN;
64 /// <summary> Constructs a simple bind request.
67 /// <param name="version"> The Ldap protocol version, use Ldap_V3.
68 /// Ldap_V2 is not supported.
71 /// <param name="dn"> If non-null and non-empty, specifies that the
72 /// connection and all operations through it should
73 /// be authenticated with dn as the distinguished
77 /// <param name="passwd"> If non-null and non-empty, specifies that the
78 /// connection and all operations through it should
79 /// be authenticated with dn as the distinguished
80 /// name and passwd as password.
83 /// <param name="cont">Any controls that apply to the simple bind request,
86 [CLSCompliantAttribute(false)]
87 public LdapBindRequest(int version, System.String dn, sbyte[] passwd, LdapControl[] cont):base(LdapMessage.BIND_REQUEST, new RfcBindRequest(new Asn1Integer(version), new RfcLdapDN(dn), new RfcAuthenticationChoice(new Asn1Tagged(new Asn1Identifier(Asn1Identifier.CONTEXT, false, 0), new Asn1OctetString(passwd), false))), cont)
92 /// <summary> Constructs a secure bind request.
95 /// <param name="version"> The Ldap protocol version, use Ldap_V3.
96 /// Ldap_V2 is not supported.
99 /// <param name="dn"> If non-null and non-empty, specifies that the
100 /// connection and all operations through it should
101 /// be authenticated with dn as the distinguished
105 /// <param name="mechanism"> Security mechanism code
108 /// <param name="passwd"> Security credentials
111 /// <param name="cont">Any controls that apply to the simple bind request,
114 [CLSCompliantAttribute(false)]
115 public LdapBindRequest(int version, System.String dn, String mechanism, sbyte[] credentials, LdapControl[]
116 cont):base(LdapMessage.BIND_REQUEST, new RfcBindRequest(version, dn, mechanism, credentials), cont)
121 /// <summary> Return an Asn1 representation of this add request.
123 /// #return an Asn1 representation of this object.
125 public override System.String ToString()
127 return Asn1Object.ToString();