Koha-clms/t
Jonathan Druart b257f25b1b Bug 29543: [19.11] Enforce authentication for self-checkout
The self-checkout feature is assuming a patron is logged in if patronid
is passed. It also assumes that "We're in a controlled environment; we
trust the user", which is terribly wrong!

This patch is suggesting to generate a JSON Web Token (JWT) to store in
a cookie and only allow action (renew, check in/out) is the token is
valid. The token is only generated once the user has been authenticated
And is removed when the user finish the session/logout.

Test plan:
You must know exactly how the self-checkout feature works to test this patch.
The 4 following sysprefs must be tested:
 SelfCheckoutByLogin, AutoSelfCheckAllowed, AutoSelfCheckID, AutoSelfCheckPass
Confirm that you can renew, checkin for the items you own, and checkout new items.
Confirm that you are not allowed to access other account's info.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Bug 29543: Remove borrower variable

It's not needed, we have $patron

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Bug 29543: Remove inputfocus variable

It's not used in template

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Bug 29543: Add JWT token handling

Mojo::JWT is installed already, it's not a new dependency.
We need a way to send the patron a token when it's correctly logged in,
and not assumed it's logged in only if patronid is passed

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Bug 29543: Prevent user to checkin or renew items they don't own

Checkin or renew must be restricted to the items they own.

Test plan:
Create an item with barcode bc_1
Check it in to user A
Login to SCO with user B
Get the token using the browser dev tool, from the cookie
Hit (replace $JWT)
    /cgi-bin/koha/sco/sco-main.pl?jwt=$JWT&op=renew&barcode=bc_1
    /cgi-bin/koha/sco/sco-main.pl?jwt=$JWT&op=returnbook&barcode=bc_1

You should see an error message

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Bug 29543: (follow-up) Add a warning to SelfCheckoutByLogin

This updates the language to warn users of risk if using cardnumber for login and auto-self-check is enabled

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Bug 29543: Add Mojo::JWT dependency

Bug 29543: Set autocomplete off for SCO login fields

Cardnumber already had it set, adding for username and password

Signed-off-by: Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz>
2022-01-21 04:39:38 +00:00
..
Acquisition Bug 18756 - add Unit Test 2017-07-06 14:29:02 -03:00
Biblio Bug 25709: Rename systempreference to NotesToHide 2020-07-31 03:38:54 +12:00
Budgets Bug 21817: Centralize the mock of userenv from tests 2019-01-02 20:18:29 +00:00
Circulation Bug 24840: [19.11.x] Replace DateTime->now with dt_from_string 2020-05-07 17:17:12 +00:00
External Bug 22010: Check preferences for ebook integration 2019-04-30 11:42:51 +00:00
Koha Bug 28200: [Alternate] Remove unit test using abbreviated format 2021-09-06 00:07:34 +00:00
LangInstaller/templates Bug 22007: Generated with add_missing_filters.pl 2019-01-02 20:43:53 +00:00
Members Bug 21015: Remove unecessary 'use Koha::Schema' statements in t/ 2018-11-08 02:18:48 +00:00
Number Bug 18736: (QA follow-up) Change to signed, add large int test 2019-03-21 16:29:06 +00:00
SIP Bug 18292: Remove return 1 statements in tests 2017-08-15 12:17:42 -03:00
Search Bug 12430: [19.11] Fix buildQuery.t 2020-12-18 21:01:08 +01:00
Serials Bug 24903: Add tests for _handle_seqno 2020-05-04 21:31:16 +00:00
Test Bug 19176: Fix how t::lib::Dates::compare handle timezone 2017-10-30 14:55:18 -03:00
db_dependent Bug 28676: Unit test 2021-10-18 02:26:45 +00:00
edi_testfiles Bug 7736: Support Ordering via Edifact EDI messages 2016-04-01 20:03:17 +00:00
etc Bug 18286: [Follow-up] Add t/etc/schema.pl 2017-06-05 17:52:35 -03:00
lib Bug 28249: Prevent Selenium->wait_for_element_visible to fall in an infinite loop 2021-05-25 15:58:43 +02:00
00-checkdatabase-version.t
…
00-deprecated.t
…
00-load.t Bug 21068: Remove NorwegianPatronDB related code 2018-08-30 13:40:29 +00:00
00-merge-conflict-markers.t Bug 19335: Fix 00-merge-conflict-markers.t when dockerised 2017-09-19 09:00:49 -03:00
00-testcritic.t
…
00-valid-xml.t Bug 24494: Make the regex more exact 2020-03-13 00:21:00 +00:00
Auth.t Bug 22943: Remove unused line from Auth.t 2020-04-03 17:30:36 +00:00
AuthUtils.t Bug 18298: Add server-side checks and refactor stuffs 2017-10-16 09:44:32 -03:00
Auth_with_shibboleth.t Bug 23042: Correct shib param escaping 2019-11-27 11:30:20 +00:00
AuthoritiesMarc_MARC21.t
…
AuthoritiesMarc_UNIMARC.t
…
Barcodes_EAN13.t
…
Barcodes_annual.t
…
Barcodes_hbyymmincr.t
…
Barcodes_incremental.t
…
Biblio.t Bug 11529: (follow-up) Fix QA issues 2019-08-05 15:03:19 +01:00
Biblio2.t Bug 11529: (follow-up) Fix QA issues 2019-08-05 15:03:19 +01:00
Bookseller.t
…
Boolean.t Bug 18292: Remove return 1 statements in tests 2017-08-15 12:17:42 -03:00
Budgets.t
…
Calendar.t Bug 26000: Make exception_holidays cache with branch in key 2020-08-19 17:32:57 +12:00
Charset.t Bug 18292: Remove return 1 statements in tests 2017-08-15 12:17:42 -03:00
Circulation_barcodedecode.t Bug 21817: Centralize the mock of userenv from tests 2019-01-02 20:18:29 +00:00
ClassSortRoutine.t
…
ClassSortRoutine_Dewey.t
…
ClassSortRoutine_Generic.t
…
ClassSortRoutine_LCC.t
…
ClassSource.t
…
Context.t Bug 25360: Use secure flag for CGISESSID cookie when using HTTPS 2020-08-25 15:41:41 +12:00
Contract.t
…
Creators.t Bug 16622: some tests triggered by prove t fail for unset KOHA_CONF 2016-08-05 06:09:58 +00:00
DateUtils.t Bug 25617: (QA follow-up) Add responses to tests 2020-06-14 21:40:33 +00:00
Debug.t
…
EdiInvoice.t Bug 18267: Refactored Edifact Price Calculations 2020-12-09 21:24:47 +01:00
EdiTransport.t Bug 20254: Add tests for transport ingest 2019-08-20 15:04:26 +01:00
Edifact.t Bug 18267: (QA follow-up) fix typo: overriden => overridden 2020-12-09 21:25:46 +01:00
Ediorder.t Bug 23251: Correct formatting of IMD data ending in apostrophe 2019-07-26 16:23:03 +01:00
Ediordrsp.t Bug 7736: Support Ordering via Edifact EDI messages 2016-04-01 20:03:17 +00:00
Form_MessagingPreferences.t
…
HtmlTags.t Bug 18665: Add test for HtmlTags.pm 2017-06-21 11:22:19 -03:00
Images.t Bug 18292: Remove return 1 statements in tests 2017-08-15 12:17:42 -03:00
ImportBatch.t Bug 10407: Add two subtests to t/ImportBatch.t 2016-09-02 16:00:13 +00:00
Installer_PerlDependencies.t
…
Installer_PerlModules.t Bug 17990: Refactor Perl module versions check 2017-02-17 12:13:44 +00:00
Installer_pm.t Bug 17990: Refactor Perl module versions check 2017-02-17 12:13:44 +00:00
ItemCirculationAlertPreference.t
…
Koha.t Bug 23768: Adjust the test for invalid ISBN 2019-11-07 13:02:59 +00:00
Koha_Email.t
…
Koha_MetadataRecord.t Bug 18292: Remove return 1 statements in tests 2017-08-15 12:17:42 -03:00
Koha_Template_Plugin_Cache.t
…
Koha_Template_Plugin_Koha.t Bug 18292: Remove return 1 statements in tests 2017-08-15 12:17:42 -03:00
Koha_Util_FrameworkPlugin.t
…
Koha_Util_MARC.t
…
Labels.t Bug 15836: Add the ability to defined custom methods to split call number in labels 2018-11-13 15:18:22 +00:00
Labels_split_Regex.t Bug 15836: Add the ability to defined custom methods to split call number in labels 2018-11-13 15:18:22 +00:00
Labels_split_ccn.t Bug 15836: Fix failing tests 2018-11-13 18:53:10 +00:00
Labels_split_ddcn.t Bug 15836: Add the ability to defined custom methods to split call number in labels 2018-11-13 15:18:22 +00:00
Labels_split_lccn.t Bug 15836: Add the ability to defined custom methods to split call number in labels 2018-11-13 15:18:22 +00:00
LangInstaller.t Bug 21895: Fix translation for package install 2018-11-29 17:57:54 +00:00
Languages.t Bug 16675: fix breakage of t/Languages.t 2016-06-10 17:03:10 +00:00
Letters.t Bug 18292: Remove return 1 statements in tests 2017-08-15 12:17:42 -03:00
Log.t Bug 20750: Add unit tests 2019-03-15 19:07:08 +00:00
Logger.t Bug 18292: Remove return 1 statements in tests 2017-08-15 12:17:42 -03:00
Makefile.t Bug 20267: .gitignore do not need to be mapped in Makefile 2018-03-26 19:35:07 -03:00
Matcher.t Bug 23324: Add an ISBN normalization routine 2019-08-16 12:26:48 +01:00
Members_AttributeTypes.t Bug 18226 - Remove "use Test::DBIx::Class" instantiations' dangerous code duplication 2017-06-05 17:52:48 -03:00
Members_Attributes.t Bug 12267: Remove borrower_attributes.password 2016-04-22 23:08:32 +00:00
Members_Messaging.t
…
OpenLibrarySearch.t Bug 16649: Make OpenLibrarySearch test pass even if launches offline 2016-06-10 17:05:03 +00:00
Output.t Bug 20422: Add unit test to Output.t for parametrized_url 2018-03-26 17:31:13 -03:00
Output_JSONStream.t
…
Patron.t Bug 14570: Make it possible to add multiple guarantors to a record 2019-08-20 16:04:48 +01:00
Patroncards.t
…
Patroncards_Batch.t
…
Patroncards_Lib.t
…
Patroncards_Patroncard.t
…
Patroncards_Profile.t
…
Patroncards_Template.t
…
Prices.t Bug 25750: fix fallback to ecost_tax_included/ecost_tax_excluded 2020-09-09 16:41:25 +12:00
Print.t
…
QueryParser.t
…
RecordProcessor.t Bug 25008: Tests for ->options 2020-05-05 20:34:42 +00:00
Ris.t Bug 16668: Fix t/Ris.t tests 2016-06-10 16:59:20 +00:00
SMS.t Bug 18292: Remove return 1 statements in tests 2017-08-15 12:17:42 -03:00
Scheduler.t
…
Scrubber.t
…
Search.t Bug 18292: Remove return 1 statements in tests 2017-08-15 12:17:42 -03:00
Search_PazPar2.t
…
SimpleMARC.t Bug 22571: (follow up) fix Donald cut-&-paste error 2019-06-21 13:13:03 +01:00
SocialData.t Bug 18292: Remove return 1 statements in tests 2017-08-15 12:17:42 -03:00
Stats.t
…
SuggestionEngine.t
…
SuggestionEngine_AuthorityFile.t Bug 9857: Fix failing tests 2017-09-01 16:22:02 -03:00
TmplToken.t
…
Token.t Bug 29543: [19.11] Enforce authentication for self-checkout 2022-01-21 04:39:38 +00:00
XSLT.t Bug 18292: Remove return 1 statements in tests 2017-08-15 12:17:42 -03:00
dummy.t
…
perlcriticrc
…
template_filters.t Bug 22466: Add tests 2019-03-07 18:17:32 +00:00
timezones.t Bug 18674: TZ error handling 2018-04-11 16:45:08 -03:00