Active Directory, Windows authentication, and Xojo apps

Hi all,

could someone point me into the right direction?

Users run a windows authentication server with an Active Directory list of users, and I want people to log in to the database using their AD accounts.

I know FileMaker can do this, but how do I do it in Xojo?



Markus, maybe here you find what you are looking for.

I’m in the same boat as Marcus. I’d like to create a web app with a login screen to capture the user’s ID and password and have these authenticate against Active Directory. I can do this fairly easily in VB, but cannot glean a way to do the same in Xojo. As Andre notes, everything seems to point to the code library at the Great White Software site, but there’s no indication of what’s in it. I’d rather get more detail before shelling out $50.


email me directly

Presumably you Xojo web application will be running on a Windows platform 2008 server etc.

Maybe You could use Powershell and Xojo shell function to auth against Active Directory.

Off the top of my head ADAuth.ps1 code:

[code]Add-Type -AssemblyName System.DirectoryServices.AccountManagement
$Domain = $env:USERDOMAIN

$ct = [System.DirectoryServices.AccountManagement.ContextType]::Domain
$pc = New-Object System.DirectoryServices.AccountManagement.PrincipalContext $ct,$Domain

Xojo shell command would be “powershell -executionpolicy unrestricted -command C:\ADAuth.ps1”

Parse the Username, Password, Domain variables from Xojo web app login input grab the the ValidateCredentials boolean return value.

Just a suggestion :slight_smile:

If you want to validate a user login to a Windows Active Directory Server or a LDAP Server from a Windows Platform (Windows Vista and upwards)
You can use Xojo’s OLEObject and Microsoft ADO (

If you are running in debug mode don’t forget to uncheck “Break on Exceptions” (tested on RS2012R2.1)


Dim strUser, strPassword, strServer, strQuery As String

strUser = “USERNAME” // Validation on LDAP Server You might need to use users DN
strPassword = “PASSWORD”
strServer = “ADS/LDAP IP Address or hostname”

Dim adoConnection, adoCommand,adoRecordset As OleObject

strQuery = “SELECT cn FROM 'LDAP://” + strServer + "’ WHERE ObjectClass=’*’ "

adoConnection = new OLEOBJECT(“ADODB.Connection”)
adoConnection.Provider = “ADsDSOOBJECT”
adoConnection.Properties(“User ID”) = strUser
adoConnection.Properties(“Password”) = strPassword
adoConnection.Properties(“Encrypt Password”) = true // Could also be set to false (“DS Query”, strUser, strPassword)

adoCommand = New OleObject(“ADODB.Command”)
adoCommand.ActiveConnection = adoConnection
adoCommand.CommandText = strQuery
adoCommand.Properties(“Size Limit”) = 1

adoRecordset = New OLEObject(“ADODB.Recordset”)

adoRecordset = adoCommand.Execute()
Catch ExecuteError As OLEException
// User did not manage to login
msgbox ExecuteError.message

adoConnection = Nil
adoCommand = Nil
adoRecordset = Nil

End Try

// User manage to login
msgbox (strUser+" manage to login on Server: "+strServer)


adoConnection = Nil
adoCommand = Nil
adoRecordset = Nil

exception err as oleexception
msgbox err.message[/code]


Thanks! I tried using ADO and just could not get it to work. I decided to give Norman’s library a shot and it worked great!

[quote=82645:@Michael Nagel]John,

Thanks! I tried using ADO and just could not get it to work. I decided to give Norman’s library a shot and it worked great![/quote]

That is strange It has been tested towards a Windows Active Directory Server and OpenLdap

  1. On what platform did you test it on. (It will not work on Windows XP)
  2. You must have Windows .Net installed. ADO is part of the .NET framework
  3. Did you try to change this line of code From: adoConnection.Properties(“Encrypt Password”) = true To: adoConnection.Properties(“Encrypt Password”) = false
  4. When you entered the USERNAME for windows ADS you might have to enter: Domain\Username as Username

If you have ADO.Net installed. This code will display a version number

  Dim adoConn As OLEObject
  Dim adoStr As String
  adoConn = New OLEObject("ADODB.Connection")
  adoStr = adoConn.Version
  adoConn = Nil
exception err as oleexception
  msgbox err.message