line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::HTTP::Spore::Middleware::Auth::Header; |
2
|
|
|
|
|
|
|
$Net::HTTP::Spore::Middleware::Auth::Header::VERSION = '0.07'; |
3
|
|
|
|
|
|
|
# ABSTRACT: middleware for authentication with specific header |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
858
|
use Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
6
|
|
|
|
|
|
|
extends 'Net::HTTP::Spore::Middleware::Auth'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has header_name => (isa => 'Str', is => 'rw', required => 1); |
9
|
|
|
|
|
|
|
has header_value => (isa => 'Str', is => 'rw', required => 1); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub call { |
12
|
2
|
|
|
2
|
0
|
7
|
my ($self, $req) = @_; |
13
|
|
|
|
|
|
|
|
14
|
2
|
50
|
|
|
|
11
|
return unless $self->should_authenticate($req); |
15
|
|
|
|
|
|
|
|
16
|
2
|
|
|
|
|
57
|
$req->header($self->header_name => $self->header_value); |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
1; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
__END__ |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=pod |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=encoding UTF-8 |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 NAME |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Net::HTTP::Spore::Middleware::Auth::Header - middleware for authentication with specific header |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 VERSION |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
version 0.07 |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 SYNOPSIS |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
my $client = Net::HTTP::Spore->new_from_spec('api.json'); |
38
|
|
|
|
|
|
|
$client->enable( |
39
|
|
|
|
|
|
|
'Auth::Header', |
40
|
|
|
|
|
|
|
header_name => 'X-API-Auth', |
41
|
|
|
|
|
|
|
header_value => '12345' |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 DESCRIPTION |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Net::HTTP::Spore::Middleware::Auth::Header is a middleware to handle authentication mechanism that requires a specific header name. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 AUTHORS |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=over 4 |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=item * |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Franck Cuny <franck.cuny@gmail.com> |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=item * |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Ash Berlin <ash@cpan.org> |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=item * |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Ahmad Fatoum <athreef@cpan.org> |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=back |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
This software is copyright (c) 2012 by Linkfluence. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
71
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=cut |