Bugzilla – Attachment 169909 Details for
Bug 37318
Connexion Client cannot authenticate due to CSRF
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37318: Use svc/authentication for Connexion daemon
Bug-37318-Use-svcauthentication-for-Connexion-daem.patch (text/plain), 2.27 KB, created by
Eric Garcia
on 2024-07-31 18:08:27 UTC
(
hide
)
Description:
Bug 37318: Use svc/authentication for Connexion daemon
Filename:
MIME Type:
Creator:
Eric Garcia
Created:
2024-07-31 18:08:27 UTC
Size:
2.27 KB
patch
obsolete
>From 4e25a1541ec8289300f4ab380c112b7eebf5c442 Mon Sep 17 00:00:00 2001 >From: Eric Garcia <cubingguy714@gmail.com> >Date: Wed, 31 Jul 2024 17:55:41 +0000 >Subject: [PATCH] Bug 37318: Use svc/authentication for Connexion daemon > >--- > misc/bin/connexion_import_daemon.pl | 17 +++++++++++++---- > 1 file changed, 13 insertions(+), 4 deletions(-) > >diff --git a/misc/bin/connexion_import_daemon.pl b/misc/bin/connexion_import_daemon.pl >index 40bff5d965..68302ba391 100755 >--- a/misc/bin/connexion_import_daemon.pl >+++ b/misc/bin/connexion_import_daemon.pl >@@ -104,7 +104,7 @@ use MARC::File::XML; > > use constant CLIENT_READ_TIMEOUT => 5; > use constant CLIENT_READ_BUFFER_SIZE => 100000; >-use constant AUTH_URI => "/cgi-bin/koha/mainpage.pl"; >+use constant AUTH_URI => "/cgi-bin/koha/svc/authentication"; > use constant IMPORT_SVC_URI => "/cgi-bin/koha/svc/import_bib"; > > sub new { >@@ -373,7 +373,15 @@ sub handle_request { > if ( $status == HTTP_UNAUTHORIZED || $status == HTTP_FORBIDDEN ) { > my $user = $self->{user}; > my $password = $self->{password}; >- $resp = $ua->post( $base_url . AUTH_URI, { userid => $user, password => $password } ); >+ >+ $resp = $ua->get( $base_url . AUTH_URI ); >+ my $csrf_token = $resp->header('CSRF-TOKEN'); >+ $resp = $ua->post( $base_url . AUTH_URI, { >+ userid => $user, >+ password => $password, >+ csrf_token => $csrf_token >+ }); >+ $csrf_token = $resp->header('CSRF-TOKEN'); > $resp = $ua->post( > $base_url . IMPORT_SVC_URI, > { >@@ -384,11 +392,12 @@ sub handle_request { > 'framework' => $self->{params}->{framework}, > 'overlay_framework' => $self->{params}->{overlay_framework}, > 'item_action' => $self->{params}->{item_action}, >- 'xml' => $data >+ 'xml' => $data, >+ csrf_token => $csrf_token > } > ) if $resp->is_success; > } >- unless ($resp->is_success) { >+ unless ($resp->is_success) { > $self->log("Unsuccessful request", $resp->request->as_string, $resp->as_string); > return $self->error_response("Unsuccessful request"); > } >-- >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 37318
:
169908
| 169909