Skip to main content
Solved

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

  • November 2, 2023
  • 2 replies
  • 635 views

jalary
Contributor
Forum|alt.badge.img+5

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)

 

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

danminneyatsaf
Safer
Forum|alt.badge.img+13

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+5
  • 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)