Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
LDAP.Bind
Authenticates a client to the LDAP server.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
LDAP | 6.0 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ❌ No |
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
LDAPRef | The reference number for the LDAP connection. | $ldap | |
DN | Test that contains the distinguished name of the entry used to bind. This can be a DN, a UPN, a WinNT style user name, or other name that the directory server will accept as an identifier. | ||
Cred | The credentials with which to authenticate. Arbitrary credentials can be passed using this parameter. The format and content of the credentials depends on the setting of the method parameter. | ||
AuthMethod | The authentication method to use. Can be simple, SASL or Negotiate. On macOS, also none, KRBv4, KRBv41 and KRBv42 are accepted. On Windows, also Sicily, MSN, NTLM, DPA, SSPI, Digest and External are accepted. |
"simple" | |
Domain | Domain for Windows. | Optional |
Result
Returns OK or error.
Description
Authenticates a client to the LDAP server.See also SystemInfo.ADSystemInfo function to query details about logged in computer user.
Examples
Authenticate connection:
Set Variable [$r; Value:MBS("LDAP.Bind"; $ldap; $UserName; $Password; $AuthMethod)]
Example script to connect and bind:
# ========================================
# Purpose:
# Common routine to bind to the LDAP server
# Returns:
# $error = Error code if unsuccessful
# $error = 0 for success
# $resultText = Text summary of the success or error
# Parameters:
# $serverName
# $serverDomain
# Called from:
# (script) All "worker" LDAP scripts
# Author:
# John Munro (HJM) from Deutsche Schule Tokyo Yokohama
# Notes:
# none
# History:
# 2021-05-20 HJM - created
# ========================================
#
Set Variable [ $! ; Value: #Assign ( Get ( ScriptParameter ) ) ]
Set Variable [ $bindUsername ; Value: "filemakerbind" ]
Set Variable [ $bindPassword ; Value: “xxxxxxxxx” ]
#
Set Error Capture [ On ]
#
# If debugging these parameters will be empty so fill with test data
If [ $serverName = "" ]
Set Variable [ $serverName ; Value: "sys-xxx” ]
End If
If [ $serverDomain = "" ]
Set Variable [ $serverDomain ; Value: “xxx.com” ]
End If
#
Set Variable [ $serverFQDN ; Value: $serverName & "." & $serverDomain ]
#
# Connect
Set Variable [ $ssl ; Value: 1 ]
Set Variable [ $port ; Value: 636 ]
Set Variable [ $result ; Value: MBS( "LDAP.Connect" ; $serverFQDN ; $ssl ; $port ) ]
If [ MBS( "IsError" ) ]
// Show Custom Dialog [ "LDAP Error" ; "Failed to connect to Domain Controller." & ¶ & $result ]
Exit Script [ Text Result: # ( "error" ; $result ) & # ( "resultText" ; "LDAP error. Failed to connect to Domain Controller." & ¶ & $result ) ]
End If
#
# Login
Set Variable [ $ldap ; Value: $result ]
Set Variable [ $result ; Value: MBS("LDAP.Bind"; $ldap; $bindUsername & "@" & $serverDomain ; $bindPassword ; "simple") ]
If [ MBS( "IsError" ) ]
// Show Custom Dialog [ "LDAP Error" ; "Failed to authenticate." & ¶ & $result ]
Exit Script [ Text Result: # ( "error" ; $result ) & # ( "resultText" ; "LDAP error. Failed to authenticate." & ¶ & $result ) ]
End If
#
# Return error free result
Exit Script [ Text Result: # ( "error" ; 0 ) & # ( "resultText" ; "Bind successful" ) & # ( "ldap" ; $ldap ) ]
See also
Example Databases
Blog Entries
This function checks for a license.
Created 15th December 2015, last changed 27th July 2021