Lines 181-187
sub authenticate_api_request {
Link Here
|
181 |
if ($valid_token) { |
181 |
if ($valid_token) { |
182 |
my $patron_id = Koha::ApiKeys->find( $valid_token->{client_id} )->patron_id; |
182 |
my $patron_id = Koha::ApiKeys->find( $valid_token->{client_id} )->patron_id; |
183 |
$user = Koha::Patrons->find($patron_id); |
183 |
$user = Koha::Patrons->find($patron_id); |
184 |
C4::Context->interface('api'); |
|
|
185 |
} |
184 |
} |
186 |
else { |
185 |
else { |
187 |
# If we have "Authorization: Bearer" header and oauth authentication |
186 |
# If we have "Authorization: Bearer" header and oauth authentication |
Lines 198-204
sub authenticate_api_request {
Link Here
|
198 |
); |
197 |
); |
199 |
} |
198 |
} |
200 |
$user = $c->_basic_auth( $authorization_header ); |
199 |
$user = $c->_basic_auth( $authorization_header ); |
201 |
C4::Context->interface('api'); |
|
|
202 |
unless ( $user ) { |
200 |
unless ( $user ) { |
203 |
# If we have "Authorization: Basic" header and authentication |
201 |
# If we have "Authorization: Basic" header and authentication |
204 |
# failed, do not try other authentication means |
202 |
# failed, do not try other authentication means |
Lines 247-252
sub authenticate_api_request {
Link Here
|
247 |
} |
245 |
} |
248 |
|
246 |
|
249 |
$c->stash('koha.user' => $user); |
247 |
$c->stash('koha.user' => $user); |
|
|
248 |
C4::Context->interface('api'); |
250 |
|
249 |
|
251 |
if ( $user and !$cookie_auth ) { # cookie-auth sets this and more, don't mess with that |
250 |
if ( $user and !$cookie_auth ) { # cookie-auth sets this and more, don't mess with that |
252 |
C4::Context->_new_userenv( $user->borrowernumber ); |
251 |
C4::Context->_new_userenv( $user->borrowernumber ); |
253 |
- |
|
|