Friday, July 10, 2020

Custom Authentication In Oracle Apex

Custom Authentication Function :
CREATE OR REPLACE FUNCTION CUSTOM_AUTH (p_username IN VARCHAR2, p_password IN VARCHAR2) RETURN BOOLEAN IS l_password VARCHAR2 (4000); l_stored_password VARCHAR2 (4000); l_expires_on DATE; l_count NUMBER; BEGIN SELECT COUNT (*) INTO l_count FROM USER_INFORMATION WHERE UPPER (LOGIN_NAME) = UPPER (p_username); IF l_count != 0 THEN SELECT pwd INTO l_stored_password FROM USER_INFORMATION WHERE UPPER (LOGIN_NAME) = UPPER (p_username); l_password := f_Password (UPPER (p_username), p_password); IF l_password = l_stored_password THEN RETURN TRUE; ELSE RETURN FALSE; END IF; END IF; END;

3 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Hi Sir...
    First thanks for the code and the idea of create custom authentication.

    I think you forgot to mention f_Password function. can you please proved its code and explain the purpose of it.

    ReplyDelete
  3. Thanks Brother .Actually f_password Function are used to encrypt User Password.
    The Function Code is bellow:

    CREATE OR REPLACE function f_Password(p_password in varchar2)
    return varchar2
    is
    begin
    return dbms_obfuscation_toolkit.md5
    (input =>
    utl_raw.cast_to_raw(upper(p_password)
    );
    end f_Password;

    ReplyDelete

Image File store outside of Oracle Database and show image into Apex Application

Directory Create : grant execute on utl_file to HRMS; CREATE OR REPLACE DIRECTORY STOCK_DIRECTORY AS 'C:\Program Files (x86)\Apache Sof...