Index: openacs-4/packages/acs-admin/www/test/signed-cookies-test-2.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/test/signed-cookies-test-2.tcl,v
diff -u -N
--- openacs-4/packages/acs-admin/www/test/signed-cookies-test-2.tcl 16 Dec 2019 17:14:37 -0000 1.4.2.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,129 +0,0 @@
-ad_page_contract {
-
- A quick and dirty test page for signed cookies. Reads signed
- previously signed cookies and verifies. Also contains a set of
- regression tests for the secure_tokens ns_cache.a
-
- @author Richard Li (richardl@arsdigita.com)
- @cvs-id $Id: signed-cookies-test-2.tcl,v 1.4.2.1 2019/12/16 17:14:37 antoniop Exp $
- @creation-date 19 October 2000
-
-}
-
-set cookie_value [ad_get_cookie testcookie]
-
-set cookie_data [split $cookie_value {,}]
-set cookie_data_length [llength $cookie_data]
-
-set hash [lindex $cookie_data $cookie_data_length-1]
-set max_age [lindex $cookie_data $cookie_data_length-2]
-set token_id [lindex $cookie_data $cookie_data_length-3]
-
-if { $cookie_data_length == 4 } {
- # no commas in data
- set data [lindex $cookie_data 0]
-} else {
- # join the data using commas
- set data [join [lrange $cookie_data 0 $cookie_data_length-4] {,}]
-}
-
-set secret_token hello
-
-set computed_hash [ns_sha1 "$data$token_id$max_age$secret_token"]
-
-set list_of_names [ns_cache names secret_tokens]
-
-set list_length [llength $list_of_names]
-
-util_return_headers
-
-ns_write "
-[ad_header "signed cookies tests"]
-
-
-
Cookie Information
-
-
-
-- ad_get_signed_cookie returns: [ad_get_signed_cookie -secret "hello" testcookie]
-
-
- ad_get_signed_cookie returns for cookie 2: [ad_get_signed_cookie testcookie2]
-
-
- hash: '$hash'
-
-
- max_age: $max_age
-
-
- token_id: $token_id
-
-
- cookie_length: $cookie_data_length
-
-
- data: $data
-
-
- computed_hash: '$computed_hash'
-
-
- string compare: [string compare $computed_hash $hash]
-
-
-
-secret_token Cache Tests
-
-
-
-- cache is (check this to make sure the cache is getting populated):
-$list_of_names
-
-
- cache size is (should be no greater than 100): $list_length"
-
-
-if { $list_length > 80 && $list_length < 101 } {
- ns_write "
- Success: cache size is between 80 and 100."
-} else {
- ns_write "
- Failure: cache size is incorrect. Verify default
- settings and try again."
-}
-
-
-
-if { [lsearch -exact $list_of_names [sec_get_random_cached_token_id]] } {
- ns_write "
- Success: random token is contained inside cache."
-} else {
- ns_write "
- Failure: random token is not in cache."
-}
-
-set token_id [sec_get_random_cached_token_id]
-set token_value [sec_get_token $token_id]
-
-set token_value_db [db_string get_token_value {
- select token from secret_tokens
- where token_id = :token_id
-}]
-
-if { $token_value eq $token_value_db } {
- ns_write "
- Success: sec_get_token test 1 passed."
-} else {
- ns_write "
- Failure: sec_get_token test 1 failed."
-}
-
-# do the same thing again to test the caching of tcl_
-set token_value [sec_get_token $token_id]
-
-if { $token_value eq $token_value_db } {
- ns_write "
- Success: sec_get_token test 2
- passed."
-} else {
- ns_write "
- Failure: sec_get_token test 2 failed."
-}
-
-
-ns_write "
-
-
-
-[ad_footer]
-
-"
-# Local variables:
-# mode: tcl
-# tcl-indent-level: 4
-# indent-tabs-mode: nil
-# End: