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