View | Details | Raw Unified | Return to bug 20624
Collapse All | Expand All

(-)a/C4/Installer/PerlDependencies.pm (-1 / +1 lines)
Lines 890-896 our $PERL_DEPS = { Link Here
890
    },
890
    },
891
    'Net::OAuth2::AuthorizationServer' => {
891
    'Net::OAuth2::AuthorizationServer' => {
892
        usage    => 'REST API',
892
        usage    => 'REST API',
893
        required => '1',
893
        required => '0',
894
        min_ver  => '0.16',
894
        min_ver  => '0.16',
895
    },
895
    },
896
};
896
};
(-)a/Koha/REST/V1/Auth.pm (-1 / +2 lines)
Lines 120-126 sub authenticate_api_request { Link Here
120
120
121
    if ($authorization_header and $authorization_header =~ /^Bearer /) {
121
    if ($authorization_header and $authorization_header =~ /^Bearer /) {
122
        # attempt to use OAuth2 authentication
122
        # attempt to use OAuth2 authentication
123
        if ( ! Module::Load::Conditional::can_load('Net::OAuth2::AuthorizationServer') ) {
123
        if ( ! Module::Load::Conditional::can_load(
124
                    modules => {'Net::OAuth2::AuthorizationServer' => undef} )) {
124
            Koha::Exceptions::Authorization::Unauthorized->throw(
125
            Koha::Exceptions::Authorization::Unauthorized->throw(
125
                error => 'Authentication failure.'
126
                error => 'Authentication failure.'
126
            );
127
            );
(-)a/Koha/REST/V1/OAuth.pm (-1 / +2 lines)
Lines 40-46 sub token { Link Here
40
40
41
    my $c = shift->openapi->valid_input or return;
41
    my $c = shift->openapi->valid_input or return;
42
42
43
    if ( Module::Load::Conditional::can_load('Net::OAuth2::AuthorizationServer') ) {
43
    if ( Module::Load::Conditional::can_load(
44
                modules => {'Net::OAuth2::AuthorizationServer' => undef} )) {
44
        require Net::OAuth2::AuthorizationServer;
45
        require Net::OAuth2::AuthorizationServer;
45
    }
46
    }
46
    else {
47
    else {
(-)a/t/db_dependent/api/v1/oauth.t (-2 / +12 lines)
Lines 17-26 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 2;
20
use Test::More;
21
use Test::MockModule;
21
use Test::MockModule;
22
use Test::Mojo;
22
use Test::Mojo;
23
23
24
use Module::Load::Conditional qw(can_load);
25
26
use Koha::ApiKeys;
24
use Koha::Database;
27
use Koha::Database;
25
use Koha::Patrons;
28
use Koha::Patrons;
26
29
Lines 31-37 my $t = Test::Mojo->new('Koha::REST::V1'); Link Here
31
my $schema  = Koha::Database->new->schema;
34
my $schema  = Koha::Database->new->schema;
32
my $builder = t::lib::TestBuilder->new();
35
my $builder = t::lib::TestBuilder->new();
33
36
37
if ( can_load( modules => { 'Net::OAuth2::AuthorizationServer' => undef } ) ) {
38
    plan tests => 2;
39
}
40
else {
41
    plan skip_all => 'Net::OAuth2::AuthorizationServer not available';
42
}
43
34
subtest '/oauth/token tests' => sub {
44
subtest '/oauth/token tests' => sub {
45
35
    plan tests => 27;
46
    plan tests => 27;
36
47
37
    $schema->storage->txn_begin;
48
    $schema->storage->txn_begin;
38
- 

Return to bug 20624