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

(-)a/Koha/OAuth.pm (-1 / +51 lines)
Lines 1-8 Link Here
1
package Koha::OAuth;
1
package Koha::OAuth;
2
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it under the
6
# terms of the GNU General Public License as published by the Free Software
7
# Foundation; either version 3 of the License, or (at your option) any later
8
# version.
9
#
10
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License along
15
# with Koha; if not, write to the Free Software Foundation, Inc.,
16
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
3
use Modern::Perl;
18
use Modern::Perl;
19
4
use Koha::OAuthAccessTokens;
20
use Koha::OAuthAccessTokens;
5
use Koha::OAuthAccessToken;
21
22
=head1 NAME
23
24
Koha::OAuth - Koha library for OAuth2 callbacks
25
26
=head1 API
27
28
=head2 Class methods
29
30
=head3 config
31
32
    my $config = Koha::OAuth->config;
33
34
Returns a hashref containing the callbacks Net::OAuth2::AuthorizationServer requires
35
36
=cut
6
37
7
sub config {
38
sub config {
8
    return {
39
    return {
Lines 12-17 sub config { Link Here
12
    };
43
    };
13
}
44
}
14
45
46
=head3 _verify_client_db
47
48
A callback to verify if the client asking for authorization is known to the authorization server
49
and allowed to get authorization.
50
51
=cut
52
15
sub _verify_client_cb {
53
sub _verify_client_cb {
16
    my (%args) = @_;
54
    my (%args) = @_;
17
55
Lines 30-35 sub _verify_client_cb { Link Here
30
    return (1, undef, []);
68
    return (1, undef, []);
31
}
69
}
32
70
71
=head3 _store_access_token_cb
72
73
A callback to store the generated access tokens.
74
75
=cut
76
33
sub _store_access_token_cb {
77
sub _store_access_token_cb {
34
    my ( %args ) = @_;
78
    my ( %args ) = @_;
35
79
Lines 46-51 sub _store_access_token_cb { Link Here
46
    return;
90
    return;
47
}
91
}
48
92
93
=head3 _verify_access_token_cb
94
95
A callback to verify the access token.
96
97
=cut
98
49
sub _verify_access_token_cb {
99
sub _verify_access_token_cb {
50
    my (%args) = @_;
100
    my (%args) = @_;
51
101
(-)a/Koha/OAuthAccessToken.pm (+27 lines)
Lines 1-9 Link Here
1
package Koha::OAuthAccessToken;
1
package Koha::OAuthAccessToken;
2
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it under the
6
# terms of the GNU General Public License as published by the Free Software
7
# Foundation; either version 3 of the License, or (at your option) any later
8
# version.
9
#
10
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License along
15
# with Koha; if not, write to the Free Software Foundation, Inc.,
16
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
3
use Modern::Perl;
18
use Modern::Perl;
4
19
5
use base qw(Koha::Object);
20
use base qw(Koha::Object);
6
21
22
=head1 NAME
23
24
Koha::OauthAccessToken - Koha OAuth2 access token object class
25
26
=head1 API
27
28
=head2 Internal methods
29
30
=head3 _type
31
32
=cut
33
7
sub _type {
34
sub _type {
8
    return 'OauthAccessToken';
35
    return 'OauthAccessToken';
9
}
36
}
(-)a/Koha/OAuthAccessTokens.pm (-4 / +36 lines)
Lines 1-15 Link Here
1
package Koha::OAuthAccessTokens;
1
package Koha::OAuthAccessTokens;
2
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it under the
6
# terms of the GNU General Public License as published by the Free Software
7
# Foundation; either version 3 of the License, or (at your option) any later
8
# version.
9
#
10
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License along
15
# with Koha; if not, write to the Free Software Foundation, Inc.,
16
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
3
use Modern::Perl;
18
use Modern::Perl;
4
19
5
use base qw(Koha::Objects);
20
use base qw(Koha::Objects);
6
21
7
sub object_class {
22
use Koha::OAuthAccessToken;
8
    return 'Koha::OAuthAccessToken';
23
9
}
24
=head1 NAME
25
26
Koha::OauthAccessTokens - Koha OAuth2 access token objects class
27
28
=head1 API
29
30
=head2 Internal methods
31
32
=head3 _type
33
34
=cut
10
35
11
sub _type {
36
sub _type {
12
    return 'OauthAccessToken';
37
    return 'OauthAccessToken';
13
}
38
}
14
39
40
=head3 object_class
41
42
=cut
43
44
sub object_class {
45
    return 'Koha::OAuthAccessToken';
46
}
47
15
1;
48
1;
16
- 

Return to bug 20402