Am trying to authenticate my Oracle APEX app with LDAP using custom Authentication Scheme.
Here is my function and get error ORA-06550 apex_authenticate_ldap must be type. Appreciate any advice.
create or replace FUNCTION apex_authenticate_ldap (
p_username IN VARCHAR2,
p_password IN VARCHAR2
) RETURN BOOLEAN
IS
l_ldap_host VARCHAR2(100) := 'corp.mydomain';
l_ldap_port NUMBER := 389;
l_base_dn VARCHAR2(200) := 'OU=Vendors,OU=Service and Support,DC=corp,DC=mydomain,DC=com';
l_ldap_conn DBMS_LDAP.session;
l_result PLS_INTEGER;
BEGIN
-- Initialize LDAP session
l_ldap_conn := DBMS_LDAP.init(l_ldap_host, l_ldap_port);
-- Attempt to bind (authenticate) user
l_result := DBMS_LDAP.simple_bind_s(
l_ldap_conn,
'CN=' || p_username || ',' || l_base_dn,
p_password
);
-- Close LDAP session
--DBMS_LDAP.unbind_s(l_ldap_conn);
-- If authentication is successful, return TRUE
RETURN TRUE;
EXCEPTION
WHEN OTHERS THEN
-- Ensure LDAP session is closed in case of errors
RETURN FALSE; -- Return FALSE if authentication fails
END apex_authenticate_ldap;
/```
I have very limited experience with Oracle APEX.
[1]: .png