create or replace package ldap_ad_util is -- +============================================================================ -- NAME: ldap_ad_util -- PURPOSE: Read User information from the active directory -- -- +============================================================================ -- exception handling g_pck constant varchar2 (30) := 'ldap_util'; ex_gperrors exception; pragma exception_init (ex_gperrors, -20100); g_emerrors varchar2 (100) := 'An error occured. Please view the ERRORS-table for more information.'; -- global variables -- You have to edit carefully this section to set all the values of your enviroment! -- IP or name of the AD and the port g_ldap_host varchar2(256) := '10.10.10.180'; g_ldap_port varchar2(256) := '389'; -- user to read from the AD g_ldap_user varchar2(256) := 'ORASYSTEM'; g_ldap_passwd varchar2(256) := 'secret_password'; -- The entry to the AD tree -- check the cn ! and adjust to your needs! g_ldap_base varchar2(256) := 'cn=Users,dc=pipperr,dc=local'; -- how to seach the user in the ad -- check how the loginname in your domain is defined! g_ad_user_type varchar2(255) := 'cn='; -- +===========================================================+ -- function : connectAD -- +===========================================================+ function connectad return dbms_ldap.session; -- +===========================================================+ -- procedure : disconnectAD -- +===========================================================+ procedure disconnectad( p_session in out dbms_ldap.session); -- +===========================================================+ -- procedure : disconnectAD -- +===========================================================+ function readgroups( p_session dbms_ldap.session , p_username varchar2) return apex_t_varchar2; -- +===========================================================+ -- procedure : setApexGroups -- set in the Apex Session dynamic groups -- +===========================================================+ procedure setapexgroups( p_username varchar2 default sys_context( 'APEX$SESSION', 'APP_USER')); end ldap_ad_util; /