HomeApex_Collection Custom User Authorization Scheme In Oracle Apex. Part-2 jABER IT LTDjABER IT LTD -11:45 PM 0 Custom User Authorization Scheme In Oracle Apex. Part-2 Custom User Authorization Scheme In Oracle Apex. Part-2 In Today's Video / Post I Will Discuss How To Create a New User, How To Create Custom Hash Password And How To Save Password And Pin. Also, How To Create Package And Package Body And I Will Provide You All The SQL Codes Used In The Package. If You Haven't Seen My Previous Video / Post, You Can Watch It By Clicking On The Link Below. 🔗 Custom User Authorization Video URL-- URL-https://youtu.be/z2uEawNglJU 🔗 Custom User Authorization Blog Post URL-- URL-https://cutt.ly/iPHIfxy Steps To How To Custom User Authorization Scheme In Oracle Apex. Part-2 Check Out The Whole Process Of Package Creation, Custom Hash Password Save And Custom User Authorization In This Post. 1. Create Packages And Package Body.... CREATE OR REPLACE PACKAGE "USER_AUTH" AS FUNCTION CUSTOM_AUTH (P_USERNAME VARCHAR2, P_PASSWORD VARCHAR2) RETURN BOOLEAN; FUNCTION CUSTOM_HASH (P_USERNAME VARCHAR2, P_PASSWORD VARCHAR2) RETURN VARCHAR2; END; CREATE OR REPLACE PACKAGE BODY "USER_AUTH" AS FUNCTION CUSTOM_AUTH (P_USERNAME VARCHAR2, P_PASSWORD VARCHAR2) RETURN BOOLEAN IS L_PASSWORD VARCHAR2 (4000); L_STORED_PASSWORD VARCHAR2 (4000); BEGIN SELECT PIN INTO L_STORED_PASSWORD FROM MY_USERS WHERE is_active = '1' AND LOWER (USERNAME) = LOWER (P_USERNAME) AND ROWNUM <= 1; L_PASSWORD := CUSTOM_HASH (P_USERNAME, P_PASSWORD); IF L_PASSWORD = L_STORED_PASSWORD THEN RETURN TRUE; ELSE RETURN FALSE; END IF; EXCEPTION WHEN NO_DATA_FOUND THEN RETURN FALSE; END; FUNCTION CUSTOM_HASH (P_USERNAME VARCHAR2, P_PASSWORD VARCHAR2) RETURN VARCHAR2 IS L_PASSWORD VARCHAR2 (4000); L_SALT VARCHAR2 (4000) := 'D9GE4CORSJZVKADPOJ5C1PERC704WB'; BEGIN L_PASSWORD := UTL_RAW.CAST_TO_RAW ( DBMS_OBFUSCATION_TOOLKIT.MD5 (INPUT_STRING => P_PASSWORD)); RETURN L_PASSWORD; END; END; 2. Create a Trigger..... CREATE OR REPLACE TRIGGER "PIN_MY_USER" BEFORE INSERT OR UPDATE OF PASSWORD ON MY_USERS REFERENCING NEW AS New OLD AS Old FOR EACH ROW DECLARE BEGIN :new.PIN := USER_AUTH.CUSTOM_HASH (:new.USER_ID, :new.PASSWORD); IF INSERTING THEN :NEW.ADDED_DATE := SYSDATE; ELSIF UPDATING THEN :NEW.UPDATE_DATE := SYSDATE; END IF; EXCEPTION WHEN OTHERS THEN RAISE; END; Now Create A New User And See If The Custom Hash Package Is Used Properly. 3. Go To Application Shared Components -> Click Security - Authentication Schemes. 4. Create A New Schemes By Clicking The Create Button. Name -> Custom_auth Scheme Type -> Custom Authentication Function Name -> USER_AUTH.CUSTOM_AUTH Click Create Authentication Scheme Button. Our Work Is Almost Finished. Now We Will See If The Application Can Be Accessed Using The Username And Password Of The User We Created. If You Haven't Seen My Previous Video / Post, You Can Watch It By Clicking On The Link Below. 🔗 Custom User Authorization Video URL-- URL-https://youtu.be/z2uEawNglJU 🔗 Custom User Authorization Blog Post URL-- URL-https://cutt.ly/iPHIfxy 🔗 Demo Application- URL- Demo Application Username - demo, Pass- demo I hope everyone will like it. Please watch the full video, Comment on any of your problems, I will try my best to solve the problem, In-Shah Allah. Everyone's cooperation is desirable. Visit my blog site, new technology related videos, you will get different types of tutorials of Oracle Apex, and hopefully, you can use them in your daily work. Please stay tuned by subscribing to the YouTube channel, and encourages new videos to be uploaded. ================= Visit my site to get more collaborative posts about Oracle Apex and subscribe to my YouTube channel. Thanks. Comment on any of your issues, I will try my best to solve the problem, In-Shah Allah. Everyone's cooperation is desirable. Visit my blog site, new technology-related videos, you will get different types of tutorials of Oracle Apex, and hopefully, you can use them in your daily work. ============================== 🙍🏾 Md jABER HOSSEN 📲 Mobile- +8801760688286 📨 Email- jaberit786@gmail.com 🌐 FB- facebook.com/mdjaber.hossen1 Please Subscribe to My Channel Many thanks for visiting the site. Then Enjoy......................... Facebook Twitter