Contents
LDAP Foreign Data Wrapper for PostgreSQL 9.2
Synopsis
A very very very experimental PostgreSQL's extension that implements a Foreign Data Wrapper (FDW) for LDAP.
DO NOT USE IT ON PRODUCTION
Description
LDAP Foreign Data Wrapper for PostgreSQL 9.2
Usage
Create the extension:
CREATE EXTENSION ldap_fdw;
For default ldap_fdw extension installs local server ldap_local_service
that points to localhost:389
. But you can create as many as you can with:
CREATE SERVER ldap_my_server_service
FOREIGN DATA WRAPPER ldap_fdw
OPTIONS ( address 'my_ldap_server', port '389');
Then create user mapping:
CREATE USER MAPPPING FOR current_user
SERVER ldap_my_server_service
OPTIONS (user_dn 'cn=the_ldap_user,dc=example,dc=com', password 'the_ldap_user_password');
Finally create a foreign table with a base DN for some OU:
CREATE FOREIGN TABLE ldap_people (
uid text,
displayname text,
mail text
)
SERVER ldap_my_server_service
OPTIONS (base_dn 'OU=people,DC=example,DC=com');
And voila!
SELECT * FROM ldap_people WHERE mail = 'user@mail.com';
Support
Copyright and License
This software is released under the PostgreSQL Licence.
Copyright (c) 2011 Dickson S. Guedes.