Question
· Sep 13, 2018

LDAP Connectio-Config

Hi All,
I tried to execute the ##Class(%SYS.LDAP).Binds(LD,"",$lb(Username,Domain,Password),$$$LDAPAUTHNEGOTIATE) but this command is returning the value as 7 only instead of 0. Is there any method to find out the error using the returned value.
Please help me

Discussion (5)0
Log in or sign up to continue

At first your code is correct.

Here's a MOC created when I developed this kind of integration.
Class HslBus.Msg.AdService.ValidaLogin.Response Extends %Persistent
{

Property LoginAtivo As %Boolean;

}

In Other Class I'm created this Method:

ClassMethod ValidarLogin(pRequest As HslBus.Msg.AdService.ValidaLogin.Request, Output pResponse As HslBus.Msg.AdService.ValidaLogin.Response) As %Status
{
set pResponse = ##class(HslBus.Msg.AdService.ValidaLogin.Response).%New()
set BaseDN="DC=Server,DC=pvt"
set Filter="(&(objectCategory=person)(objectClass=user) (sAMAccountname=" _ pRequest.Usuario.Login _ "))"

set Attributes=""
set ServerTimeout=5000

set LD=##Class(%SYS.LDAP).Init("hsl.pvt",389)


Set Status0=##Class(%SYS.LDAP).Binds(LD,"",$lb(pRequest.Usuario.Login,"Server.pvt",pRequest.Usuario.Senha),$$$LDAPAUTHNEGOTIATE)
set checkFilter=##class(%SYS.LDAP).CheckFilter(LD,Filter)

set Status=##Class(%SYS.LDAP).SearchExts(LD,BaseDN,$$$LDAPSCOPESUBTREE,Filter,"",0,"","",10,0,.SearchResult)

if (Status = $$$LDAPSUCCESS){
set pResponse.LoginAtivo = 1
}
else{
set pResponse.LoginAtivo = 0
}

quit $$$OK
}


To verify this type of support when I developed an LDAP integration I used the LDAP Admin available at http://www.ldapadmin.org/
If you also do not connect to AD, check with the infrastructure team if AD is enabled to receive LDAP connections.