Databases Reference
In-Depth Information
INSERT INTO CUSTOMLOGINS(USERID,USERNAME,PASSWORD) VALUES('01','greg','1234')
/
INSERT INTO CUSTOMLOGINS(USERID,USERNAME,PASSWORD) VALUES('02','zehoo','7890')
/
Your next task is to define the actual authentication function itself. You will create a very simple
authentication function that simply checks if the specified username and password exists in the table. If
they do, access is granted. To create this function, open the SQL workshop, and run the PL/SQL shown
in Listing 8-1.
Listing 8-1. Defining the Authentication Function
CREATE OR REPLACE FUNCTION MyCustomAuthenticator (
p_username IN VARCHAR2,
p_password IN VARCHAR2
)
RETURN BOOLEAN
IS
l_count NUMBER;
BEGIN
SELECT COUNT(*) into l_count from CUSTOMLOGINS WHERE Username=p_username AND
Password=p_password;
IF l_count > 0 THEN
RETURN TRUE;
ELSE
RETURN FALSE;
END IF;
END;
Your next task will be to define a new authentication scheme. To do so, follow these steps:
1.
Open an existing application and click the Shared Components icon.
2.
Under the Security section, click on the Authentication Schemes link, as
highlighted in Figure 8-1.
 
Search WWH ::




Custom Search