-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsssec_pwverify_test.sql
61 lines (59 loc) · 2.33 KB
/
sssec_pwverify_test.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
--------------------------------------------------------------------------------
-- Accenture, Data Platforms
-- Saegereistrasse 29, 8152 Glattbrugg, Switzerland
--------------------------------------------------------------------------------
-- Name......: sssec_pwverify_test.sql
-- Author....: Stefan Oehrli (oes) [email protected]
-- Editor....: Stefan Oehrli
-- Date......: 2023.12.12
-- Usage.....:
-- Purpose...: Test the password verify function
-- Notes.....:
-- Reference.:
-- License...: Apache License Version 2.0, January 2004 as shown
-- at http://www.apache.org/licenses/
--------------------------------------------------------------------------------
set serveroutput on
--------------------------------------------------------------------------------
-- create a temporary type
CREATE OR REPLACE TYPE table_varchar AS
TABLE OF VARCHAR2(128 char)
/
--------------------------------------------------------------------------------
-- Anonymous PL/SQL Block to test the password function
DECLARE
l_username VARCHAR2(128 CHAR) := 'john_doe';
l_old_password VARCHAR2(128 CHAR) := 'OldPass123';
t_test_passwords table_varchar := table_varchar(
'NewPass123!',
'short',
'NewPassword12nnewpassword123',
'newpassword12nnewpassword123',
'NewPassword12n-dwpassword123',
'verylongpasswordthatexceedsthemaximumlength',
'NoDigit123',
'nodigitOrSpecialChar',
'john_doePass');
result BOOLEAN;
BEGIN
<<for_loop>>
FOR i IN 1..t_test_passwords.COUNT LOOP
BEGIN
result := oradba_verify_function(l_username, t_test_passwords(i), l_old_password);
IF result THEN
sys.dbms_output.put_line('Password "' || t_test_passwords(i) || '" is valid.');
ELSE
sys.dbms_output.put_line('Password "' || t_test_passwords(i) || '" is invalid.');
END IF;
EXCEPTION
WHEN OTHERS THEN
sys.dbms_output.put_line('Error with password "' || t_test_passwords(i) || '": ' || sqlerrm );
END;
END LOOP for_loop;
END;
/
--------------------------------------------------------------------------------
-- drop temporary created type
DROP TYPE table_varchar
/
-- EOF -------------------------------------------------------------------------