line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
our $VERSION = '0.004'; |
2
|
|
|
|
|
|
|
use Moo; |
3
|
3
|
|
|
3
|
|
3711
|
|
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
18
|
|
4
|
|
|
|
|
|
|
# ABSTRACT: Implementation of the Authentication tokens for ValidSign |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Types::Standard qw(Str); |
7
|
3
|
|
|
3
|
|
998
|
use namespace::autoclean; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
40
|
|
8
|
3
|
|
|
3
|
|
2057
|
|
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
21
|
|
9
|
|
|
|
|
|
|
has action_endpoint => ( |
10
|
|
|
|
|
|
|
is => 'ro', |
11
|
|
|
|
|
|
|
default => 'authenticationTokens' |
12
|
|
|
|
|
|
|
); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has token => ( |
15
|
|
|
|
|
|
|
is => 'rw', |
16
|
|
|
|
|
|
|
isa => Str, |
17
|
|
|
|
|
|
|
accessor => '_token', |
18
|
|
|
|
|
|
|
predicate => 'has_token', |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my $self = shift; |
22
|
|
|
|
|
|
|
|
23
|
2
|
|
|
2
|
0
|
3888
|
if ($self->has_token) { |
24
|
|
|
|
|
|
|
return $self->_token; |
25
|
2
|
100
|
|
|
|
20
|
} |
26
|
1
|
|
|
|
|
14
|
else { |
27
|
|
|
|
|
|
|
return $self->_get_user_token; |
28
|
|
|
|
|
|
|
} |
29
|
1
|
|
|
|
|
3
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
my $self = shift; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
my $uri = $self->get_endpoint($self->action_endpoint, 'user'); |
34
|
1
|
|
|
1
|
|
2
|
my $request = HTTP::Request->new( |
35
|
|
|
|
|
|
|
POST => $uri, |
36
|
1
|
|
|
|
|
6
|
[ |
37
|
1
|
|
|
|
|
9
|
'Content-Type' => 'application/json', |
38
|
|
|
|
|
|
|
Accept => 'application/json', |
39
|
|
|
|
|
|
|
] |
40
|
|
|
|
|
|
|
); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
$request->header("Authorization", join(" ", "Basic", $self->secret)); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
$self->_token($self->call_api($request)->{value}); |
45
|
1
|
|
|
|
|
166
|
return $self->_token; |
46
|
|
|
|
|
|
|
} |
47
|
1
|
|
|
|
|
92
|
|
48
|
1
|
|
|
|
|
260
|
with "WebService::ValidSign::API"; |
49
|
|
|
|
|
|
|
has '+auth' => (required => 0); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=pod |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=encoding UTF-8 |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 NAME |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
WebService::ValidSign::API::Auth - Implementation of the Authentication tokens for ValidSign |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 VERSION |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
version 0.004 |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 SYNOPSIS |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 METHODS |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 AUTHOR |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Wesley Schwengle <waterkip@cpan.org> |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
This software is Copyright (c) 2019 by Wesley Schwengle. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
This is free software, licensed under: |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
The (three-clause) BSD License |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |