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.Rfc2251.RfcBindRequest.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
;
36 namespace Novell
.Directory
.Ldap
.Rfc2251
39 /// <summary> Represents and Ldap Bind Request.
41 /// BindRequest ::= [APPLICATION 0] SEQUENCE {
42 /// version INTEGER (1 .. 127),
44 /// authentication AuthenticationChoice }
47 public class RfcBindRequest
:Asn1Sequence
, RfcRequest
49 /// <summary> </summary>
50 /// <summary> Sets the protocol version</summary>
51 virtual public Asn1Integer Version
55 return (Asn1Integer
) get_Renamed(0);
60 set_Renamed(0, value);
65 /// <summary> </summary>
66 /// <summary> </summary>
67 virtual public RfcLdapDN Name
71 return (RfcLdapDN
) get_Renamed(1);
76 set_Renamed(1, value);
81 /// <summary> </summary>
82 /// <summary> </summary>
83 virtual public RfcAuthenticationChoice AuthenticationChoice
87 return (RfcAuthenticationChoice
) get_Renamed(2);
92 set_Renamed(2, value);
98 /// <summary> ID is added for Optimization.
100 /// ID needs only be one Value for every instance,
101 /// thus we create it only once.
103 new private static readonly Asn1Identifier ID
= new Asn1Identifier(Asn1Identifier
.APPLICATION
, true, LdapMessage
.BIND_REQUEST
);
106 //*************************************************************************
107 // Constructors for BindRequest
108 //*************************************************************************
110 /// <summary> </summary>
111 public RfcBindRequest(Asn1Integer version
, RfcLdapDN name
, RfcAuthenticationChoice auth
):base(3)
119 [CLSCompliantAttribute(false)]
120 public RfcBindRequest(int version
, System
.String dn
, System
.String mechanism
, sbyte[] credentials
):this(new Asn1Integer(version
), new RfcLdapDN(dn
), new RfcAuthenticationChoice(mechanism
, credentials
))
124 /// <summary> Constructs a new Bind Request copying the original data from
125 /// an existing request.
128 internal RfcBindRequest(Asn1Object
[] origRequest
, System
.String base_Renamed
):base(origRequest
, origRequest
.Length
)
130 // Replace the dn if specified, otherwise keep original base
131 if ((System
.Object
) base_Renamed
!= null)
133 set_Renamed(1, new RfcLdapDN(base_Renamed
));
138 //*************************************************************************
140 //*************************************************************************
142 //*************************************************************************
144 //*************************************************************************
146 /// <summary> Override getIdentifier to return an application-wide id.
149 /// ID = CLASS: APPLICATION, FORM: CONSTRUCTED, TAG: 0. (0x60)
152 public override Asn1Identifier
getIdentifier()
157 public RfcRequest
dupRequest(System
.String base_Renamed
, System
.String filter
, bool request
)
159 return new RfcBindRequest(toArray(), base_Renamed
);
161 public System
.String
getRequestDN()
163 return ((RfcLdapDN
) get_Renamed(1)).stringValue();