Active Directory/Connect
From Rosetta Code
Active Directory/Connect is a programming task. Visitors like you are encouraged to solve it according to the task description, using any language they may happen to know.
Contents |
[edit] PHP
<?php
$ldap = ldap_connect($hostname, $port);
$success = ldap_bind($ldap, $username, $password);
[edit] Ruby
Similar to Tcl, assume the AD server talks LDAP.
There are many Ruby LDAP packages ([1]) -- this solution uses Net::LDAP ("Pure Ruby LDAP Tools" on RubyForge, gem name "ruby-net-ldap")
Library: RubyGems
require 'rubygems'
require 'net/ldap'
ldap = Net::LDAP.new(:host => 'ldap.example.com', :base => 'o=companyname')
ldap.authenticate('bind_dn', 'bind_pass')
[edit] Tcl
This does not use SSPI/Kerberos yet, so your AD would need to allow simple ldap access.
package require ldap
set conn [ldap::connect $host $port]
ldap::bind $conn $user $password
[edit] VBScript
Creating the normal connection to AD
Set objConn = CreateObject("ADODB.Connection")
Set objCmd = CreateObject("ADODB.Command")
objConn.Provider = "ADsDSOObject"
objConn.Open







