Bugzilla – Attachment 54323 Details for
Bug 17110
Lower CSRF expiry in Koha::Token
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17110: Add unit test for MaxAge parameter in Token.t
Bug-17110-Add-unit-test-for-MaxAge-parameter-in-To.patch (text/plain), 1.34 KB, created by
Marcel de Rooy
on 2016-08-12 06:18:06 UTC
(
hide
)
Description:
Bug 17110: Add unit test for MaxAge parameter in Token.t
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2016-08-12 06:18:06 UTC
Size:
1.34 KB
patch
obsolete
>From 4256c63e2c4806bf2cd3a27fec88301fe70ae2c2 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Fri, 12 Aug 2016 08:09:50 +0200 >Subject: [PATCH] Bug 17110: Add unit test for MaxAge parameter in Token.t >Content-Type: text/plain; charset=utf-8 > >Test plan: >Run t/Token.t >--- > t/Token.t | 15 ++++++++++++++- > 1 file changed, 14 insertions(+), 1 deletion(-) > >diff --git a/t/Token.t b/t/Token.t >index dcc182e..0c56cd6 100644 >--- a/t/Token.t >+++ b/t/Token.t >@@ -20,7 +20,8 @@ > # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. > > use Modern::Perl; >-use Test::More tests => 6; >+use Test::More tests => 8; >+use Time::HiRes qw|usleep|; > use Koha::Token; > > my $tokenizer = Koha::Token->new; >@@ -43,3 +44,15 @@ $result = $tokenizer->check({ > type => 'CSRF', id => $id, secret => $secr, token => $token, > }); > isnt( $result, 1, "This token is no CSRF token" ); >+ >+# Test MaxAge parameter >+my $age = 1; # 1 second >+$result = $tokenizer->check_csrf({ >+ id => $id, secret => $secr, token => $csrftoken, MaxAge => $age, >+}); >+is( $result, 1, "CSRF token still valid within one second" ); >+usleep $age * 1000000 * 2; # micro (millionth) seconds + 100% >+$result = $tokenizer->check_csrf({ >+ id => $id, secret => $secr, token => $csrftoken, MaxAge => $age, >+}); >+isnt( $result, 1, "CSRF token expired after one second" ); >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 17110
:
54313
|
54323
|
54324
|
54473
|
54474
|
54475
|
54806
|
54807