1 Reply Latest reply on Nov 20, 2007 7:37 AM by <newbie />

    Authenticating with ADsDSOObject

    natesnyder Level 1
      Our University has changed authentication from DCE com object to the Microsoft ADsDSOObject. I've seen alot of ASP examples, but I was wondering if anyone has any experience with this in ColdFusion or has an example on how to call it in CF? I have documentation in VB on how it is called if that helps. Thanks again.

      user = "name"
      pass = "password"
      set con = CreateObject("ADODB.Connection")
      con.Provider = "ADsDSOObject"
      con.Properties("User ID") = "AD\" & user
      con.Properties("Password") = pass
      con.Properties("ADSI Flag") = ADS_SECURE_AUTHENTICATION
      con.Open "DS Query"

      set command = CreateObject("ADODB.Command")
      set command.ActiveConnection = con
      command.CommandText = "<LDAP://server.edu/dc=ad,dc=server,dc=edu>;(cn=" & user & ");AdsPath,cn,memberof;subTree"

      On Error Resume Next
      set rs = command.execute
      if Not Err.Number = 0 then
      ' bad password or username
      auth_ok = 0
      bad_pass = 1
      WScript.Echo("bad password")
      end if
      On Error goto 0

      if Not bad_pass = 1 then

      while Not rs.EOF
      auth_ok = 1
      end if