|
Lines 60-65
Config file format:
Link Here
|
| 60 |
add_only_for_matches, add_only_for_new or ignore |
60 |
add_only_for_matches, add_only_for_new or ignore |
| 61 |
import_mode - stage or direct |
61 |
import_mode - stage or direct |
| 62 |
framework - to be used if import_mode is direct |
62 |
framework - to be used if import_mode is direct |
|
|
63 |
connexion_user - User sent from connexion client |
| 64 |
connexion_password - Password sent from connexion client |
| 65 |
|
| 66 |
Note: If connexion parameters are not defined request authentication will not be checked |
| 67 |
You should specify a different user for connexion to protect the Koha credentials |
| 63 |
|
68 |
|
| 64 |
All process related parameters (all but ip and port) have default values as |
69 |
All process related parameters (all but ip and port) have default values as |
| 65 |
per Koha import process. |
70 |
per Koha import process. |
|
Lines 141-146
sub parse_config {
Link Here
|
| 141 |
$self->{password} = delete( $param{password} ) |
146 |
$self->{password} = delete( $param{password} ) |
| 142 |
or die "No koha user password in config file"; |
147 |
or die "No koha user password in config file"; |
| 143 |
|
148 |
|
|
|
149 |
if( defined $param{connexion_user} || defined $param{connexion_password}){ |
| 150 |
# If either is defined we expect both |
| 151 |
$self->{connexion_user} = delete( $param{connexion_user} ) |
| 152 |
or die "No koha connexion_user in config file"; |
| 153 |
$self->{connexion_password} = delete( $param{connexion_password} ) |
| 154 |
or die "No koha user connexion_password in config file"; |
| 155 |
} |
| 156 |
|
| 144 |
$self->{host} = delete( $param{host} ); |
157 |
$self->{host} = delete( $param{host} ); |
| 145 |
$self->{port} = delete( $param{port} ) |
158 |
$self->{port} = delete( $param{port} ) |
| 146 |
or die "Port not specified"; |
159 |
or die "Port not specified"; |
|
Lines 247-253
sub read_request {
Link Here
|
| 247 |
} |
260 |
} |
| 248 |
|
261 |
|
| 249 |
$in = join '', @in_arr; |
262 |
$in = join '', @in_arr; |
| 250 |
|
|
|
| 251 |
$in =~ m/(.)$/; |
263 |
$in =~ m/(.)$/; |
| 252 |
my $lastchar = $1; |
264 |
my $lastchar = $1; |
| 253 |
my ($xml, $user, $password, $local_user); |
265 |
my ($xml, $user, $password, $local_user); |
|
Lines 300-305
sub read_request {
Link Here
|
| 300 |
$self->log("Invalid request", $in, @details); |
312 |
$self->log("Invalid request", $in, @details); |
| 301 |
return; |
313 |
return; |
| 302 |
} |
314 |
} |
|
|
315 |
$user = $local_user if !$user && $local_user; |
| 303 |
|
316 |
|
| 304 |
$self->log("Request", @details); |
317 |
$self->log("Request", @details); |
| 305 |
$self->log($in) if $self->{debug}; |
318 |
$self->log($in) if $self->{debug}; |
|
Lines 319-328
sub _trim_identifier {
Link Here
|
| 319 |
|
332 |
|
| 320 |
sub handle_request { |
333 |
sub handle_request { |
| 321 |
my ( $self, $io ) = @_; |
334 |
my ( $self, $io ) = @_; |
| 322 |
|
|
|
| 323 |
my ($data, $user, $password) = $self->read_request($io) |
335 |
my ($data, $user, $password) = $self->read_request($io) |
| 324 |
or return $self->error_response("Bad request"); |
336 |
or return $self->error_response("Bad request"); |
| 325 |
|
337 |
|
|
|
338 |
unless( |
| 339 |
!(defined $self->{connexion_user}) || |
| 340 |
($user eq $self->{connexion_user} && $password eq $self->{connexion_password}) |
| 341 |
){ |
| 342 |
return $self->error_response("Unauthorized request"); |
| 343 |
} |
| 344 |
|
| 326 |
my $ua; |
345 |
my $ua; |
| 327 |
if ($self->{user}) { |
346 |
if ($self->{user}) { |
| 328 |
$user = $self->{user}; |
347 |
$user = $self->{user}; |
| 329 |
- |
|
|