line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package OAuth::Lite::AuthMethod; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
1844
|
use strict; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
172
|
|
4
|
5
|
|
|
5
|
|
27
|
use warnings; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
163
|
|
5
|
|
|
|
|
|
|
|
6
|
5
|
|
|
5
|
|
26
|
use base 'Exporter'; |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
588
|
|
7
|
|
|
|
|
|
|
|
8
|
5
|
|
|
5
|
|
2052
|
use List::MoreUtils qw(any); |
|
5
|
|
|
|
|
2691
|
|
|
5
|
|
|
|
|
600
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( all => [qw/AUTH_HEADER POST_BODY URL_QUERY/] ); |
11
|
|
|
|
|
|
|
our @EXPORT_OK = map { @$_ } values %EXPORT_TAGS; |
12
|
|
|
|
|
|
|
|
13
|
5
|
|
|
5
|
|
32
|
use constant AUTH_HEADER => 'auth_header'; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
424
|
|
14
|
5
|
|
|
5
|
|
27
|
use constant POST_BODY => 'post_body'; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
230
|
|
15
|
5
|
|
|
5
|
|
32
|
use constant URL_QUERY => 'url_query'; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
777
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub validate_method { |
18
|
12
|
|
|
12
|
1
|
3171
|
my ($class, $method) = @_; |
19
|
12
|
|
|
|
|
36
|
my @methods = (AUTH_HEADER, POST_BODY, URL_QUERY); |
20
|
12
|
|
|
18
|
|
122
|
any { $method eq $_ } @methods; |
|
18
|
|
|
|
|
73
|
|
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
1; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 NAME |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
OAuth::Lite::AuthMethod - auth method constants. |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 SYNOPSIS |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
use OAuth::Lite::AuthMethod qw( |
32
|
|
|
|
|
|
|
AUTH_HEADER |
33
|
|
|
|
|
|
|
POST_BODY |
34
|
|
|
|
|
|
|
URL_QUERY |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
$consumer = OAuth::Lite::Consumer->new( |
38
|
|
|
|
|
|
|
... |
39
|
|
|
|
|
|
|
auth_method => URL_QUERY, |
40
|
|
|
|
|
|
|
); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 DESCRIPTION |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
This mere holds constants for auth method on requesting with OAuth. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 CONSTANTS |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head2 AUTH_HEADER |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Using Authorization header for OAuth-authentication. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Authorization: OAuth realm="http://example.org", oauth_consuemr_key="key", ... |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head2 POST_BODY |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Embed OAuth authentication data into request body. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head2 URL_QUERY |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Append OAuth authentication data as query-string. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 METHODS |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head2 validate_method($method) |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
unless ( OAuth::Lite::AuthMethod->validate_method($method) ) { |
67
|
|
|
|
|
|
|
say 'Invalid auth method.'; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 AUTHOR |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Lyo Kato, C |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
77
|
|
|
|
|
|
|
it under the same terms as Perl itself, either Perl version 5.8.6 or, |
78
|
|
|
|
|
|
|
at your option, any later version of Perl 5 you may have available. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=cut |
81
|
|
|
|
|
|
|
|