line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CatalystX::OAuth2::Request::AuthToken; |
2
|
8
|
|
|
8
|
|
64
|
use Moose; |
|
8
|
|
|
|
|
25
|
|
|
8
|
|
|
|
|
64
|
|
3
|
8
|
|
|
8
|
|
59331
|
use URI; |
|
8
|
|
|
|
|
24
|
|
|
8
|
|
|
|
|
2032
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
with 'CatalystX::OAuth2'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# ABSTRACT: An oauth2 authentication token implementation |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has grant_type => ( is => 'ro', required => 1 ); |
10
|
|
|
|
|
|
|
has code => ( is => 'ro', required => 1 ); |
11
|
|
|
|
|
|
|
has refresh_token => ( |
12
|
|
|
|
|
|
|
isa => 'Bool', |
13
|
|
|
|
|
|
|
is => 'rw', |
14
|
|
|
|
|
|
|
default => 0 |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
around _params => sub { shift->(@_), qw(code grant_type) }; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub _build_query_parameters { |
20
|
3
|
|
|
3
|
|
14
|
my ($self) = @_; |
21
|
|
|
|
|
|
|
|
22
|
3
|
50
|
|
|
|
98
|
my $code = $self->store->find_client_code( $self->code ) |
23
|
|
|
|
|
|
|
or return { |
24
|
|
|
|
|
|
|
error => 'invalid_grant', |
25
|
|
|
|
|
|
|
error_description => 'The provided authorization grant ' |
26
|
|
|
|
|
|
|
. 'is invalid, expired, revoked, does not match the ' |
27
|
|
|
|
|
|
|
. 'redirection URI used in the authorization request, ' |
28
|
|
|
|
|
|
|
. 'or was issued to another client.' |
29
|
|
|
|
|
|
|
}; |
30
|
|
|
|
|
|
|
|
31
|
3
|
|
|
|
|
26401
|
my $with_refresh = $self->refresh_token; |
32
|
3
|
|
|
|
|
95
|
my $token = $self->store->create_access_token( $self->code, $with_refresh ); |
33
|
3
|
|
|
|
|
6253
|
my $res = { |
34
|
|
|
|
|
|
|
access_token => $token->as_string, |
35
|
|
|
|
|
|
|
token_type => $token->type, |
36
|
|
|
|
|
|
|
expires_in => $token->expires_in, |
37
|
|
|
|
|
|
|
}; |
38
|
3
|
100
|
|
|
|
17
|
$res->{refresh_token} = $token->to_refresh_token->as_string |
39
|
|
|
|
|
|
|
if $with_refresh; |
40
|
|
|
|
|
|
|
|
41
|
3
|
|
|
|
|
48
|
return $res; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
__END__ |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=pod |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 NAME |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
CatalystX::OAuth2::Request::AuthToken - An oauth2 authentication token implementation |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 VERSION |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
version 0.001007 |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 AUTHOR |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Eden Cardim <edencardim@gmail.com> |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
This software is copyright (c) 2017 by Suretec Systems Ltd. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
67
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=cut |