@@ -306,6 +306,7 @@ class Net::LDAP
306
306
3 => :string , # SearchFilter-extensible
307
307
4 => :string , # SearchFilter-extensible
308
308
7 => :string , # serverSaslCreds
309
+ 11 => :string , # responseValue
309
310
}
310
311
constructed = {
311
312
0 => :array , # RFC-2251 Control and Filter-AND
@@ -341,6 +342,7 @@ class Net::LDAP
341
342
342
343
StartTlsOid = '1.3.6.1.4.1.1466.20037'
343
344
PasswdModifyOid = '1.3.6.1.4.1.4203.1.11.1'
345
+ WhoamiOid = '1.3.6.1.4.1.4203.1.11.3'
344
346
345
347
# https://tools.ietf.org/html/rfc4511#section-4.1.9
346
348
# https://tools.ietf.org/html/rfc4511#appendix-A
@@ -1200,6 +1202,23 @@ def delete_tree(args)
1200
1202
end
1201
1203
end
1202
1204
1205
+ # Return the authorization identity of the client that issues the
1206
+ # ldapwhoami request. The method does not support any arguments.
1207
+ #
1208
+ # Returns True or False to indicate whether the request was successfull.
1209
+ # The result is available in the extended status information when calling
1210
+ # #get_operation_result.
1211
+ #
1212
+ # ldap.ldapwhoami
1213
+ # puts ldap.get_operation_result.extended_response
1214
+ def ldapwhoami ( args = { } )
1215
+ instrument "ldapwhoami.net_ldap" , args do |payload |
1216
+ @result = use_connection ( args , &:ldapwhoami )
1217
+ @result . success?
1218
+ end
1219
+ end
1220
+ alias_method :whoami , :ldapwhoami
1221
+
1203
1222
# This method is experimental and subject to change. Return the rootDSE
1204
1223
# record from the LDAP server as a Net::LDAP::Entry, or an empty Entry if
1205
1224
# the server doesn't return the record.
0 commit comments