This discussion is archived
6 Replies Latest reply: Dec 6, 2012 9:43 PM by Kiran RSS

how to config two dn ldap in one apex app?

976341 Newbie
Currently Being Moderated
how to config two dn ldap in one apex app?
i have two dn:1.100dn.net 2.zyy.100dn.net
then i want config two dn in one apex app for authentication scheme,how can i do?
use non-exact LDAP Distinguished Name (DN)?
how i can supply a Search Filter?
  • 1. Re: how to config two dn ldap in one apex app?
    Patrick Wolf Employee ACE
    Currently Being Moderated
    Hi,

    are those two different LDAP servers or just one? If it's just one, you might take a look at Authentication from Win-Domain for all OU s.
    But the best would be to ask your LDAP admin if and how you could do that with one DN string.

    Regards
    Patrick
    -----------
    My Blog: http://www.inside-oracle-apex.com
    APEX Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf
  • 2. Re: how to config two dn ldap in one apex app?
    976341 Newbie
    Currently Being Moderated
    hi, i have two domain,
    my solution is get a selection in login page,and user should choose the domain,and process the pl/sql on submit and before computation,
    but i dont know how to set the ldap host and the ldap dn?

    my code like this
    ****************************
    DECLARE
    BEGIN
    if :P101_dnsel='1' then
    p_ldap_host:='800best.net'; ????????????how can i set this string?
    p_ldap_dn:='800best\%LDAP_NMAE%';
    else
    p_ldap_host:='ht.800best.net';
    p_ldap_dn:='HT\%LDAP_NMAE%';
    end if;
    END;

    *******************************
  • 3. Re: how to config two dn ldap in one apex app?
    976341 Newbie
    Currently Being Moderated
    now i set the Authentication Schemes in No Authentication (using DAD),and create myself auth funcation,
    and i set the auth in login page,
    but in no authentication ,and then i put the username and password ,and pass myself auth funcation, and remain "Invalid Login Credentials" and can't derect the home page,what's authentication on working?how can i do?
  • 4. Re: how to config two dn ldap in one apex app?
    Kiran Expert
    Currently Being Moderated
    Hello Bowie,

    >
    now i set the Authentication Schemes in No Authentication (using DAD),and create myself auth funcation,
    and i set the auth in login page,
    but in no authentication ,and then i put the username and password ,and pass myself auth funcation, and remain "Invalid Login Credentials" and can't derect the home page,what's authentication on working?how can i do?
    >

    You can use [url http://docs.oracle.com/cd/E37097_01/doc/doc.42/e35125/sec_authentication.htm#BABFBCFJ]Custom Authentication Scheme for this purpose wherein Authentication Function Name parameter is set to a function or packaged function returning boolean written as:
    CREATE OR REPLACE FUNCTION AUTHENTICATE_USER ( FP_USERNAME IN VARCHAR2
                               , FP_PASSWORD IN VARCHAR2 )
      RETURN BOOLEAN
    AS
    BEGIN
       
      IF APEX_LDAP.AUTHENTICATE(
                 p_username =>FP_USERNAME,
                 p_password =>FP_PASSWORD,
                 p_search_base => 'cn=user,l=amer,dc=my_company,dc=com',
                 p_host => '800best.net',
                 p_port => 389) THEN
        -- authenticated by first LDAP server
        APEX_UTIL.SET_AUTHENTICATION_RESULT(0);
        RETURN TRUE;
      ELSIF APEX_LDAP.AUTHENTICATE(
                 p_username =>FP_USERNAME,
                 p_password =>FP_PASSWORD,
                 p_search_base => 'cn=user,l=amer,dc=my_company,dc=com',
                 p_host => 'ht.800best.net',
                 p_port => 389) THEN
        -- authenticated by second LDAP server
        APEX_UTIL.SET_AUTHENTICATION_RESULT(0);
        RETURN TRUE;
      ELSE
        -- unauthenticated user
        APEX_UTIL.SET_AUTHENTICATION_RESULT(4);
        RETURN FALSE;
      END IF;
    
    EXCEPTION
      WHEN OTHERS THEN
        APEX_UTIL.SET_AUTHENTICATION_RESULT(4);
        RETURN FALSE;
    
    END;
    Refer: [url http://docs.oracle.com/cd/E37097_01/doc/doc.42/e35127/apex_ldap.htm#CEGDCAFD]APEX_LDAP

    Regards,
    Kiran

    Edited by: Kiran on Dec 7, 2012 10:56 AM
    Edit Note: Changed the parameter names of the authenticate_user function and passed that parameters to APEX_LDAP.AUTHENTICATE
  • 5. Re: how to config two dn ldap in one apex app?
    976341 Newbie
    Currently Being Moderated
    very thanks ,well done
  • 6. Re: how to config two dn ldap in one apex app?
    Kiran Expert
    Currently Being Moderated
    Hello Bowie,

    >
    very thanks ,well done
    >

    Glad that the solution worked.

    Please mark the reply as helpful or correct as this will help other members on the forum with similar question.

    Regards,
    Kiran

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points