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 |
|