line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
5
|
|
|
5
|
|
25
|
use utf8; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
19
|
|
2
|
|
|
|
|
|
|
package Etcd3::Auth::Authenticate; |
3
|
|
|
|
|
|
|
|
4
|
5
|
|
|
5
|
|
148
|
use strict; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
69
|
|
5
|
5
|
|
|
5
|
|
18
|
use warnings; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
82
|
|
6
|
|
|
|
|
|
|
|
7
|
5
|
|
|
5
|
|
21
|
use Moo; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
25
|
|
8
|
5
|
|
|
5
|
|
3526
|
use Types::Standard qw(Str Int Bool HashRef ArrayRef); |
|
5
|
|
|
|
|
409008
|
|
|
5
|
|
|
|
|
94
|
|
9
|
5
|
|
|
5
|
|
6326
|
use MIME::Base64; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
290
|
|
10
|
5
|
|
|
5
|
|
30
|
use JSON; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
40
|
|
11
|
5
|
|
|
5
|
|
3326
|
use Data::Dumper; |
|
5
|
|
|
|
|
24689
|
|
|
5
|
|
|
|
|
288
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
with 'Etcd3::Role::Actions'; |
14
|
|
|
|
|
|
|
|
15
|
5
|
|
|
5
|
|
2016
|
use namespace::clean; |
|
5
|
|
|
|
|
43816
|
|
|
5
|
|
|
|
|
29
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 NAME |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Etcd3:Auth::Authenticate |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=cut |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
our $VERSION = '0.006'; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 DESCRIPTION |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Authentication request |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head2 endpoint |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=cut |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
has endpoint => ( |
34
|
|
|
|
|
|
|
is => 'ro', |
35
|
|
|
|
|
|
|
isa => Str, |
36
|
|
|
|
|
|
|
default => '/auth/authenticate' |
37
|
|
|
|
|
|
|
); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head2 username |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
the actual api uses name so we handle this in json_args |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
has username => ( |
46
|
|
|
|
|
|
|
is => 'ro', |
47
|
|
|
|
|
|
|
isa => Str, |
48
|
|
|
|
|
|
|
required => 1, |
49
|
|
|
|
|
|
|
); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head2 password |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=cut |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
has password => ( |
56
|
|
|
|
|
|
|
is => 'ro', |
57
|
|
|
|
|
|
|
isa => Str, |
58
|
|
|
|
|
|
|
required => 1, |
59
|
|
|
|
|
|
|
); |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head2 token |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=cut |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub token { |
66
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
67
|
0
|
|
|
|
|
|
$self->json_args; |
68
|
0
|
|
|
|
|
|
my $response = $self->request; |
69
|
0
|
|
|
|
|
|
my $content = from_json($response->{content}); |
70
|
0
|
|
|
|
|
|
print STDERR Dumper($content); |
71
|
0
|
|
|
|
|
|
my $token = $content->{token}; |
72
|
0
|
|
|
|
|
|
return $token; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |