Skip to main content
Solved

Anybody have solution to connect to an LDAP/Active directory server after Deprecation of the reader in FME 2023?


jalary
Contributor
Forum|alt.badge.img+1

Now that LDAP/Active Directory reader have been put on the deprecation list in FME 2023, I'm trying to find an out of the box solution in FME to update my workbenches and continue using it.

 

 

Best answer by jalary

I was able to use python librairy ldap3 to connect and retreive data. Also exporting the result in JSON format.

import json
import fme
import fmeobjects
import ldap3
 
class FeatureProcessor(object):
 
    def input(self, feature: fmeobjects.FMEFeature):
        server = ldap3.Server(feature.getAttribute('server'))
        # username and password from parameter
        conn = ldap3.Connection(server, FME_MacroValues['username'], FME_MacroValues['password'])
        conn.bind()
        # scope attribute
        conn.search(feature.getAttribute('scope'), f'(objectClass=person)', attributes=['*'])
        
        # to a JSON object
        ad_data = conn.entries
        ad_data_json = [str(entry.entry_to_json()) for entry in ad_data]
        feature.setAttribute("ad_data_json",ad_data_json)
 
        self.pyoutput(feature)

 

View original
Did this help you find an answer to your question?

2 replies

danminneyatsaf
Safer
Forum|alt.badge.img+12

Hi @Jerome Alary​, unfortunately if you want to continue using deprecated formats you'll need to use a version of FME older than 2023.

I believe the LDAP reader used JDBC on the backend, so there may be the potential for you to use the JDBC Reader in FME as long as you have the LDAP JDBC drivers on your machine and have a JDBC string configured.

You can take a look into our JDBC Reader here: https://community.safe.com/s/article/using-the-generic-database-jdbc-format


jalary
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • Best Answer
  • November 7, 2023

I was able to use python librairy ldap3 to connect and retreive data. Also exporting the result in JSON format.

import json
import fme
import fmeobjects
import ldap3
 
class FeatureProcessor(object):
 
    def input(self, feature: fmeobjects.FMEFeature):
        server = ldap3.Server(feature.getAttribute('server'))
        # username and password from parameter
        conn = ldap3.Connection(server, FME_MacroValues['username'], FME_MacroValues['password'])
        conn.bind()
        # scope attribute
        conn.search(feature.getAttribute('scope'), f'(objectClass=person)', attributes=['*'])
        
        # to a JSON object
        ad_data = conn.entries
        ad_data_json = [str(entry.entry_to_json()) for entry in ad_data]
        feature.setAttribute("ad_data_json",ad_data_json)
 
        self.pyoutput(feature)

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings