line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package OAuth::Lite2::Server::GrantHandlers; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
951
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
28
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
19
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
515
|
use OAuth::Lite2::Server::GrantHandler::AuthorizationCode; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
22
|
|
7
|
1
|
|
|
1
|
|
500
|
use OAuth::Lite2::Server::GrantHandler::Password; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
28
|
|
8
|
1
|
|
|
1
|
|
522
|
use OAuth::Lite2::Server::GrantHandler::RefreshToken; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
9
|
1
|
|
|
1
|
|
800
|
use OAuth::Lite2::Server::GrantHandler::ClientCredentials; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
10
|
1
|
|
|
1
|
|
522
|
use OAuth::Lite2::Server::GrantHandler::GroupingRefreshToken; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
11
|
1
|
|
|
1
|
|
504
|
use OAuth::Lite2::Server::GrantHandler::ServerState; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
12
|
1
|
|
|
1
|
|
513
|
use OAuth::Lite2::Server::GrantHandler::ExternalService; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
172
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my %HANDLERS; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub add_handler { |
17
|
7
|
|
|
7
|
1
|
9
|
my ($class, $type, $handler) = @_; |
18
|
7
|
|
|
|
|
13
|
$HANDLERS{$type} = $handler; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
__PACKAGE__->add_handler( 'authorization_code' => |
22
|
|
|
|
|
|
|
OAuth::Lite2::Server::GrantHandler::AuthorizationCode->new ); |
23
|
|
|
|
|
|
|
__PACKAGE__->add_handler( 'password' => |
24
|
|
|
|
|
|
|
OAuth::Lite2::Server::GrantHandler::Password->new ); |
25
|
|
|
|
|
|
|
__PACKAGE__->add_handler( 'refresh_token' => |
26
|
|
|
|
|
|
|
OAuth::Lite2::Server::GrantHandler::RefreshToken->new ); |
27
|
|
|
|
|
|
|
__PACKAGE__->add_handler( 'client_credentials' => |
28
|
|
|
|
|
|
|
OAuth::Lite2::Server::GrantHandler::ClientCredentials->new ); |
29
|
|
|
|
|
|
|
# Grant types which is not defined in RFC |
30
|
|
|
|
|
|
|
__PACKAGE__->add_handler( 'grouping_refresh_token' => |
31
|
|
|
|
|
|
|
OAuth::Lite2::Server::GrantHandler::GroupingRefreshToken->new ); |
32
|
|
|
|
|
|
|
__PACKAGE__->add_handler( 'server_state' => |
33
|
|
|
|
|
|
|
OAuth::Lite2::Server::GrantHandler::ServerState->new ); |
34
|
|
|
|
|
|
|
__PACKAGE__->add_handler( 'external_service' => |
35
|
|
|
|
|
|
|
OAuth::Lite2::Server::GrantHandler::ExternalService->new ); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
#__PACKAGE__->add_handler( 'assertion' => ); |
38
|
|
|
|
|
|
|
#__PACKAGE__->add_handler( 'none' => ); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub get_handler { |
41
|
0
|
|
|
0
|
1
|
|
my ($class, $type) = @_; |
42
|
0
|
|
|
|
|
|
return $HANDLERS{$type}; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 NAME |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
OAuth::Lite2::Server::GrantHandlers - store of handlers for each grant_type. |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 SYNOPSIS |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
my $handler = OAuth::Lite2::Server::GrantHandlers->get_handler( $grant_type ); |
52
|
|
|
|
|
|
|
$handler->handle_request( $ctx ); |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 DESCRIPTION |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
store of handlers for each grant_type. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 METHODS |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head2 add_handler( $grant_type, $handler ) |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
add GrantHandler instance |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head2 get_handler( $grant_type ) |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
get GrantHandler instance |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 SEE ALSO |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
L |
71
|
|
|
|
|
|
|
L |
72
|
|
|
|
|
|
|
L |
73
|
|
|
|
|
|
|
L |
74
|
|
|
|
|
|
|
L |
75
|
|
|
|
|
|
|
L |
76
|
|
|
|
|
|
|
L |
77
|
|
|
|
|
|
|
L |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 AUTHOR |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Ryo Ito, Eritou.06@gmail.comE |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Lyo Kato, Elyo.kato@gmail.comE |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Copyright (C) 2010 by Lyo Kato |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
90
|
|
|
|
|
|
|
it under the same terms as Perl itself, either Perl version 5.8.8 or, |
91
|
|
|
|
|
|
|
at your option, any later version of Perl 5 you may have available. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=cut |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
1; |
96
|
|
|
|
|
|
|
|