_acs-authentication__auth__login_attempts (private)
_acs-authentication__auth__login_attempts
Defined in packages/acs-authentication/tcl/test/authentication-procs.tcl
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: set _aa_export {} set body_count 1 foreach testcase_body {{ set orig_max_failed_login_attempts [parameter::get_from_package_key -parameter "MaxConsecutiveFailedLoginAttempts" -package_key "acs-authentication" -default 0] try { # We set this value forcefully or chances are that # some system will never test this API set max_failed_login_attempts 10 parameter::set_from_package_key -parameter "MaxConsecutiveFailedLoginAttempts" -package_key "acs-authentication" -value $max_failed_login_attempts set login_attempt_key acs-test-login-key set another_login_attempt_key acs-test-login-another-key for {set i 1} {$i <= $max_failed_login_attempts} {incr i} { ::auth::login_attempts::record -login_attempt_key $login_attempt_key aa_equals "Login attempts for key '$login_attempt_key' should now be '$i'" $i [::auth::login_attempts::get -key $login_attempt_key] aa_false "Threshold for key '$login_attempt_key' should not have been reached" [::auth::login_attempts::threshold_reached_p -login_attempt_key $login_attempt_key] } ::auth::login_attempts::record -login_attempt_key $login_attempt_key aa_true "Threshold for key '$login_attempt_key' should now have been reached" [::auth::login_attempts::threshold_reached_p -login_attempt_key $login_attempt_key] aa_log "Forgetting of login attempts for '$another_login_attempt_key'" auth::login_attempts::reset -login_attempt_key $another_login_attempt_key aa_true "Threshold for key '$login_attempt_key' should still have been reached" [::auth::login_attempts::threshold_reached_p -login_attempt_key $login_attempt_key] aa_log "Forgetting of login attempts for '$login_attempt_key'" auth::login_attempts::reset -login_attempt_key $login_attempt_key aa_false "Threshold for key '$login_attempt_key' should now be fine" [::auth::login_attempts::threshold_reached_p -login_attempt_key $login_attempt_key] aa_equals "Number of attempts for key '$login_attempt_key' should now be 0" 0 [::auth::login_attempts::get -key $login_attempt_key] aa_log "Resetting all attempts" auth::login_attempts::reset_all aa_true "No attempts anymore..." {[llength [auth::login_attempts::get_all]] == 0} aa_log "Record two attempts on different keys" ::auth::login_attempts::record -login_attempt_key $login_attempt_key aa_equals "Number of attempts for key '$login_attempt_key' should now be 1" 1 [::auth::login_attempts::get -key $login_attempt_key] ::auth::login_attempts::record -login_attempt_key $another_login_attempt_key aa_equals "Number of attempts for key '$another_login_attempt_key' should now be 1" 1 [::auth::login_attempts::get -key $another_login_attempt_key] set all_attempts [auth::login_attempts::get_all] set keys_to_expect [list $login_attempt_key $another_login_attempt_key] aa_equals "auth::login_attempts::get_all returns the expected number of entries" [llength $all_attempts] [expr {3 * 2}] foreach {key timeout number_of_attempts} $all_attempts { aa_true "auth::login_attempts::get_all returns an integer for timeout" [string is integer -strict $timeout] aa_equals "auth::login_attempts::get_all returns the correct number of attempts" 1 $number_of_attempts set i [lsearch -exact $keys_to_expect $key] aa_true "auth::login_attempts::get_all the correct keys" {$i >= 0} set keys_to_expect [lreplace $keys_to_expect $i $i] } aa_log "Resetting all attempts" auth::login_attempts::reset_all aa_true "No attempts anymore..." {[llength [auth::login_attempts::get_all]] == 0} } finally { parameter::set_from_package_key -parameter "MaxConsecutiveFailedLoginAttempts" -package_key "acs-authentication" -value $orig_max_failed_login_attempts } }} { aa_log "Running testcase body $body_count" set ::__aa_test_indent [info level] set catch_val [catch $testcase_body msg] if {$catch_val != 0 && $catch_val != 2} { aa_log_result "fail" "auth__login_attempts (body $body_count): Error during execution: $msg, stack trace: \n$::errorInfo" } incr body_count }XQL Not present: Generic, PostgreSQL, Oracle