line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package OAuth::Lite::SignatureMethod::PLAINTEXT; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
2107
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
94
|
|
4
|
3
|
|
|
3
|
|
15
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
103
|
|
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
17
|
use base 'OAuth::Lite::SignatureMethod'; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
771
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
__PACKAGE__->method_name('PLAINTEXT'); |
9
|
|
|
|
|
|
|
|
10
|
3
|
|
|
3
|
|
24
|
use OAuth::Lite::Util qw(encode_param); |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
349
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 NAME |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
OAuth::Lite::SignatureMethod::PLAINTEXT - PLAINTEXT signature method class; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 SYNOPSIS |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# Consumer side |
19
|
|
|
|
|
|
|
my $method = OAuth::Lite::SignatureMethod::PLAINTEXT->new( |
20
|
|
|
|
|
|
|
consumer_secret => 'foo', |
21
|
|
|
|
|
|
|
token_secret => 'bar', |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my $signature = $method->sign($base_string); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# Service Provider side |
27
|
|
|
|
|
|
|
my $method = OAuth::Lite::SignatureMethod::PLAINTEXT->new( |
28
|
|
|
|
|
|
|
consumer_secret => 'foo', |
29
|
|
|
|
|
|
|
token_secret => 'bar', |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
unless ($method->verify($base_string, $signature)) { |
32
|
|
|
|
|
|
|
say "Signature is invalid!"; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 DESCRIPTION |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
PLAINTEXT signature method class. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 METHODS |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head2 method_name |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Class method. Returns this method's name. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
say OAuth::Lite::SignatureMethod::PLAINTEXT->method_name; |
46
|
|
|
|
|
|
|
# PLAINTEXT |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head2 new(%params) |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head3 parameters |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=over 4 |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=item consumer_secret |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=item token_secret |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=back |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
my $method = OAuth::Lite::SignatureMethod::PLAINTEXT->new( |
61
|
|
|
|
|
|
|
consumer_secret => $consumer_secret, |
62
|
|
|
|
|
|
|
token_secret => $bar, |
63
|
|
|
|
|
|
|
); |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head2 sign($base_string) |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Generate signature from base string. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
my $signature = $method->sign($base_string); |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head2 verify($base_string, $signature) |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Verify signature with base string. |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
my $signature_is_valid = $method->verify($base_string, $signature); |
76
|
|
|
|
|
|
|
unless ($signature_is_valid) { |
77
|
|
|
|
|
|
|
say "Signature is invalid!"; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=cut |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub sign { |
83
|
6
|
|
|
6
|
1
|
16
|
my ($self, $base_string) = @_; |
84
|
6
|
|
|
|
|
18
|
my $key = $self->secrets_as_key(); |
85
|
6
|
|
|
|
|
201
|
$key; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 AUTHOR |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Lyo Kato, C |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
95
|
|
|
|
|
|
|
it under the same terms as Perl itself, either Perl version 5.8.6 or, |
96
|
|
|
|
|
|
|
at your option, any later version of Perl 5 you may have available. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=cut |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
1; |