Bugzilla – Attachment 138705 Details for
Bug 28787
Send a notice with the TOTP token
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28787: (follow-up) Typo and additional test
Bug-28787-follow-up-Typo-and-additional-test.patch (text/plain), 2.61 KB, created by
Kyle M Hall (khall)
on 2022-08-05 14:25:13 UTC
(
hide
)
Description:
Bug 28787: (follow-up) Typo and additional test
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2022-08-05 14:25:13 UTC
Size:
2.61 KB
patch
obsolete
>From 1d243fd29e02f6b1f3e57fd7174c371cebba024e Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Fri, 8 Jul 2022 09:38:55 +0000 >Subject: [PATCH] Bug 28787: (follow-up) Typo and additional test > >Adding a test for a 403 status when lowering authorization. >The Auth mock for check_cookie_auth is not needed here. >Reading back the session after flush either. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> > >Sponsored-by: Rijksmuseum, Netherlands > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > Koha/REST/V1/Auth.pm | 2 +- > t/db_dependent/api/v1/two_factor_auth.t | 15 +++++++++------ > 2 files changed, 10 insertions(+), 7 deletions(-) > >diff --git a/Koha/REST/V1/Auth.pm b/Koha/REST/V1/Auth.pm >index ba90ac4ab4b..1b315df0f36 100644 >--- a/Koha/REST/V1/Auth.pm >+++ b/Koha/REST/V1/Auth.pm >@@ -288,7 +288,7 @@ sub authenticate_api_request { > return 1; > } > else { >- # We are required authorizarion, there needs >+ # We are required authorization, there needs > # to be an identified user > Koha::Exceptions::Authentication::Required->throw( > error => 'Authentication failure.' ) >diff --git a/t/db_dependent/api/v1/two_factor_auth.t b/t/db_dependent/api/v1/two_factor_auth.t >index 325a5de3708..fc9796dba50 100755 >--- a/t/db_dependent/api/v1/two_factor_auth.t >+++ b/t/db_dependent/api/v1/two_factor_auth.t >@@ -43,7 +43,7 @@ $mocked_koha_email->mock( 'send_or_die', sub { > > subtest 'send_otp_token' => sub { > >- plan tests => 9; >+ plan tests => 11; > > $schema->storage->txn_begin; > >@@ -73,11 +73,6 @@ subtest 'send_otp_token' => sub { > $session->param('waiting-for-2FA', 1); > $session->flush; > >- $session = C4::Auth::get_session($session->id); >- >- my $auth = Test::MockModule->new("C4::Auth"); >- $auth->mock('check_cookie_auth', sub { return 'additional-auth-needed'}); >- > $patron->library->set( > { > branchemail => 'from@example.org', >@@ -105,6 +100,14 @@ subtest 'send_otp_token' => sub { > # Everything is ok, the email will be sent > $t->request_ok($tx)->status_is(200); > >+ # Change flags: not enough authorization anymore >+ $patron->flags(16)->store; >+ $tx = $t->ua->build_tx( POST => "/api/v1/auth/otp/token_delivery" ); >+ $tx->req->cookies( { name => 'CGISESSID', value => $session->id } ); >+ $tx->req->env( { REMOTE_ADDR => $remote_address } ); >+ $t->request_ok($tx)->status_is(403); >+ $patron->flags(20)->store; >+ > $session->param('waiting-for-2FA', 0); > $session->flush; > $tx = $t->ua->build_tx( POST => "/api/v1/auth/otp/token_delivery" ); >-- >2.30.2
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 28787
:
135287
|
136571
|
136572
|
136573
|
137251
|
137330
|
137331
|
137369
|
137370
|
137371
|
137379
|
137380
|
137381
|
137391
|
137392
|
137393
|
137394
|
137395
|
137396
|
137397
|
137398
|
137399
|
137400
|
138146
|
138149
|
138150
|
138151
|
138152
|
138153
|
138154
|
138155
|
138156
|
138157
|
138158
|
138159
|
138689
|
138696
|
138697
|
138698
|
138699
|
138700
|
138701
|
138702
|
138703
|
138704
| 138705 |
138706
|
138707
|
138931
|
138932