13 require_once(dirname(__FILE__) .
'/../common-auth.php');
22 protected function setUp() :
void
24 print
"Starting unit test for common-auth.php\n";
32 $_SERVER[
'HTTP_SMUNIVERSALID'] =
null;
34 $this->assertEquals(
"-1", $result );
35 $_SERVER[
'HTTP_SMUNIVERSALID'] =
"Test Siteminder";
37 $this->assertEquals(
"Test Siteminder", $result);
45 print
"Ending unit test for common-auth.php\n";
59 $SysConf[
'SYSCONFIG'] = [];
60 $SysConf[
'SYSCONFIG'][
'PasswdPolicy'] =
'true';
61 $SysConf[
'SYSCONFIG'][
'PasswdPolicyMinChar'] = 8;
62 $SysConf[
'SYSCONFIG'][
'PasswdPolicyMaxChar'] = 16;
63 $SysConf[
'SYSCONFIG'][
'PasswdPolicyLower'] =
'true';
64 $SysConf[
'SYSCONFIG'][
'PasswdPolicyUpper'] =
'true';
65 $SysConf[
'SYSCONFIG'][
'PasswdPolicyDigit'] =
'true';
66 $SysConf[
'SYSCONFIG'][
'PasswdPolicySpecial'] =
'#%@^!*()';
67 $expected =
'(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[#%@^!*()])[a-zA-Z\\d#%@^!*()]{8,16}';
69 $this->assertEquals($expected, $actual);
84 $SysConf[
'SYSCONFIG'] = [];
85 $SysConf[
'SYSCONFIG'][
'PasswdPolicy'] =
'false';
86 $SysConf[
'SYSCONFIG'][
'PasswdPolicyMinChar'] = 8;
87 $SysConf[
'SYSCONFIG'][
'PasswdPolicyMaxChar'] = 16;
88 $SysConf[
'SYSCONFIG'][
'PasswdPolicyLower'] =
'true';
89 $SysConf[
'SYSCONFIG'][
'PasswdPolicyUpper'] =
'true';
90 $SysConf[
'SYSCONFIG'][
'PasswdPolicyDigit'] =
'true';
91 $SysConf[
'SYSCONFIG'][
'PasswdPolicySpecial'] =
'#%@^!*()';
94 $this->assertEquals($expected, $actual);
110 $SysConf[
'SYSCONFIG'] = [];
111 $SysConf[
'SYSCONFIG'][
'PasswdPolicy'] =
'true';
112 $SysConf[
'SYSCONFIG'][
'PasswdPolicyMinChar'] =
'';
113 $SysConf[
'SYSCONFIG'][
'PasswdPolicyMaxChar'] = 16;
114 $SysConf[
'SYSCONFIG'][
'PasswdPolicyLower'] =
'true';
115 $SysConf[
'SYSCONFIG'][
'PasswdPolicyUpper'] =
'true';
116 $SysConf[
'SYSCONFIG'][
'PasswdPolicyDigit'] =
'true';
117 $SysConf[
'SYSCONFIG'][
'PasswdPolicySpecial'] =
'#%@^!*()';
118 $expected =
'(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[#%@^!*()])[a-zA-Z\\d#%@^!*()]{0,16}';
120 $this->assertEquals($expected, $actual);
136 $SysConf[
'SYSCONFIG'] = [];
137 $SysConf[
'SYSCONFIG'][
'PasswdPolicy'] =
'true';
138 $SysConf[
'SYSCONFIG'][
'PasswdPolicyMinChar'] = 2;
139 $SysConf[
'SYSCONFIG'][
'PasswdPolicyMaxChar'] =
'';
140 $SysConf[
'SYSCONFIG'][
'PasswdPolicyLower'] =
'true';
141 $SysConf[
'SYSCONFIG'][
'PasswdPolicyUpper'] =
'true';
142 $SysConf[
'SYSCONFIG'][
'PasswdPolicyDigit'] =
'true';
143 $SysConf[
'SYSCONFIG'][
'PasswdPolicySpecial'] =
'#%@^!*()';
144 $expected =
'(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[#%@^!*()])[a-zA-Z\\d#%@^!*()]{2,}';
146 $this->assertEquals($expected, $actual);
161 $SysConf[
'SYSCONFIG'] = [];
162 $SysConf[
'SYSCONFIG'][
'PasswdPolicy'] =
'true';
163 $SysConf[
'SYSCONFIG'][
'PasswdPolicyMinChar'] =
'';
164 $SysConf[
'SYSCONFIG'][
'PasswdPolicyMaxChar'] =
'';
165 $SysConf[
'SYSCONFIG'][
'PasswdPolicyLower'] =
'true';
166 $SysConf[
'SYSCONFIG'][
'PasswdPolicyUpper'] =
'true';
167 $SysConf[
'SYSCONFIG'][
'PasswdPolicyDigit'] =
'true';
168 $SysConf[
'SYSCONFIG'][
'PasswdPolicySpecial'] =
'#%@^!*()';
169 $expected =
'(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[#%@^!*()])[a-zA-Z\\d#%@^!*()]*';
171 $this->assertEquals($expected, $actual);
187 $SysConf[
'SYSCONFIG'] = [];
188 $SysConf[
'SYSCONFIG'][
'PasswdPolicy'] =
'true';
189 $SysConf[
'SYSCONFIG'][
'PasswdPolicyMinChar'] =
'8';
190 $SysConf[
'SYSCONFIG'][
'PasswdPolicyMaxChar'] =
'16';
191 $SysConf[
'SYSCONFIG'][
'PasswdPolicyLower'] =
'false';
192 $SysConf[
'SYSCONFIG'][
'PasswdPolicyUpper'] =
'true';
193 $SysConf[
'SYSCONFIG'][
'PasswdPolicyDigit'] =
'true';
194 $SysConf[
'SYSCONFIG'][
'PasswdPolicySpecial'] =
'';
195 $expected =
'(?=.*[A-Z])(?=.*\\d).{8,16}';
197 $this->assertEquals($expected, $actual);
test_siteminder_check()
test for siteminder_check()
test_generate_password_policy_no_max()
Test for generate_password_policy() when no max limit is set.
test_generate_password_policy_no_special()
Test for generate_password_policy()
test_generate_password_policy_disable()
Test for generate_password_policy() when policy is disabled.
test_generate_password_policy_no_min()
Test for generate_password_policy() when no minimum limit is set.
test_generate_password_policy_no_limit()
Test for generate_password_policy()
test_generate_password_policy_all()
Test for generate_password_policy()
siteminder_check()
Check if SiteMinder is enabled.
generate_password_policy()