39.1 AUTHENTICATE Function

This function returns a boolean TRUE if the user name and password can be used to perform a SIMPLE_BIND_S call using the provided search base, host, and port.

Syntax

APEX_LDAP.AUTHENTICATE (
    p_username     IN VARCHAR2 DEFAULT NULL,
    p_password     IN VARCHAR2 DEFAULT NULL,
    p_search_base  IN VARCHAR2,
    p_host         IN VARCHAR2,
    p_port         IN VARCHAR2 DEFAULT 389,
    p_use_ssl      IN VARCHAR2 DEFAULT 'N' )
RETURN BOOLEAN;

Parameters

Table 39-1 AUTHENTICATE Parameters

Parameter Description
p_username Login name of the user.
p_password Password for p_username.
p_search_base LDAP search base, for example, dc=users,dc=my,dc=org.
p_host LDAP server host name.
p_port LDAP server port number.
p_use_ssl

(Default) Set to N to not use SSL.

Set to Y to use SSL in bind to LDAP server.

Set to A to use SSL with one-way authentication (requires LDAP server certificate configured in an Oracle wallet).

Example

The following example demostrates how to use the APEX_LDAP.AUTHENTICATE function to verify user credentials against an LDAP Server.

IF APEX_LDAP.AUTHENTICATE(
    p_username => 'firstname.lastname',
    p_password => 'abcdef',
    p_search_base => 'cn=user,l=amer,dc=example,dc=com',
    p_host => 'our_ldap_sever.example.com',
    p_port => '636',
    p_use_ssl => 'A') THEN
 
    dbms_output.put_line('authenticated');
ELSE
    dbms_output.put_line('authentication failed');
END IF;