Auth0.pm

filter: Statementstmt 48.2% 14 / 29 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 33.3% 2 / 6 Podpod 100% 2 / 2 totaltotal 32.7% 18 / 55 CC 9 SCAR 30.8
CC
9
Cov
31%
auth
30.0
management
30.0
__ANON__
2.0
CRAP 21.8
« Auth0/Management/Base.pm ↑ Summary Auth0/HTTPClient.pm »
1 package WebService::Auth0;
2  
3 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Module::Runtime qw(use_module);
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 our $VERSION = '0.002';
7  
8 1 has ua_handler_class => (
9 is=>'ro',
10 required=>1,
11 default=>'WebService::Auth0::UA::LWP');
12  
13 has ua_handler_options => (
14 is=>'ro',
15 required=>1,
16 0 ▶ default=>sub { [] });
Subroutine __ANON__: not called CC=1 SCAR=1.2
17  
18 has ua => (
19 is=>'ro',
20 init_arg=>undef,
21 lazy=>1,
22 required=>1,
23 0 ▶ default=>sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
24 use_module($_[0]->ua_handler_class)->new(
25 0 @{$_[0]->ua_handler_options});
26 1 });
27  
28 1 has domain => (
29 is=>'ro',
30 required=>1 );
31  
32 1 has client_id => (is=>'ro', predicate=>'has_client_id');
33 1 has client_secret => (is=>'ro', predicate=>'has_client_secret');
34  
35 0 ▶sub auth {
Subroutine auth: not called CC=5 SCAR=34.0
Pod documented
36 0 my $self = shift;
37 0 ▶ my %args = $_[0] ? ((ref($_[0])||'') eq 'HASH' ? %{$_[0]} : @_) : ();
Branch: 2 branches
BranchTrueFalseTotal
$_[0] ? : 0 0 0
(ref $_[0] || '') eq 'HASH' ? : 0 0 0
Condition0%0/2
ref $_[0] || ''
l!l
00
MC/DC0%0/1
ref $_[0] || ''
ref $_[0]
Truth table0%0/2
A
A= ref $_[0]
Aresult
11
00
38  
39 0 %args = (
40 ua => $self->ua,
41 domain => $self->domain,
42 client_id => $self->client_id,
43 %args,
44 );
45  
46 0 ▶ $args{client_secret} = $self->client_secret
Branch: 1 branch
BranchTrueFalseTotal
if $self->has_client_secret 0 0 0
47 if $self->has_client_secret;
48  
49 0 return use_module('WebService::Auth0::Authentication')
50 ->new(%args);
51 }
52  
53 0 ▶sub management {
Subroutine management: not called CC=5 SCAR=34.0
Pod documented
54 0 my $self = shift;
55 0 ▶ my %args = $_[0] ? ((ref($_[0])||'') eq 'HASH' ? %{$_[0]} : @_) : ();
Branch: 2 branches
BranchTrueFalseTotal
$_[0] ? : 0 0 0
(ref $_[0] || '') eq 'HASH' ? : 0 0 0
Condition0%0/2
ref $_[0] || ''
l!l
00
MC/DC0%0/1
ref $_[0] || ''
ref $_[0]
Truth table0%0/2
A
A= ref $_[0]
Aresult
11
00
56  
57 0 %args = (
58 ua => $self->ua,
59 domain => $self->domain,
60 %args,
61 );
62  
63 0 ▶ $args{client_secret} = $self->client_secret
Branch: 1 branch
BranchTrueFalseTotal
if $self->has_client_secret 0 0 0
64 if $self->has_client_secret;
65  
66 0 return use_module('WebService::Auth0::Management')
67 ->new(%args);
68 }
69  
70 1 1;
71  
72 =head1 NAME
73  
74 WebService::Auth0 - Access the Auth0 API
75  
76 =head1 SYNOPSIS
77  
78 use WebService::Auth0;
79 my $auth0 = WebService::Auth0->new(
80 domain => 'my-domain',
81 client_id => 'my-client_id',
82 client_secret => 'my-client_secrete');
83  
84 $auth0->...
85  
86 =head1 DESCRIPTION
87  
88 B<NOTE> WARNING! This is an early release with hardly any tests. If you use
89 this you should be willing / able to help me hack on it as needed. I currently
90 reserve the right to make breaking changes as needed.
91  
92 Prototype for a web service client for L<https://auth0.com>. This is probably
93 going to change a lot as I learn how it actually works. I wrote this
94 primarily as I was doing L<Catalyst::Authentication::Credential::Auth0>
95 since it seemed silly to stick web service client stuff directly into
96 the Catalyst authorization credential class.
97  
98 =head1 ATTRIBUTES
99  
100 This class defines the following attributes
101  
102 =head2 domain
103  
104 =head2 client_id
105  
106 =head2 client_secret
107  
108 Credentials supplied to you from L<https://auth0.com>.
109  
110 =head2 ua_handler_class
111  
112 Defaults to L<WebService::Auth0::UA::LWP>, a blocking user agent based on L<LWP>.
113  
114 =head2 ua_handler_options
115  
116 An arrayref of options tht you pass to your L</ua_handler_class>.
117  
118 =head1 METHODS
119  
120 This class defines the following methods:
121  
122 =head2 auth
123  
124 Factory class that returns an instance of L<WebService::Auth0::Authentication>
125 using the current settings.
126  
127 =head2 management
128  
129 Factory class that returns an instance of L<WebService::Auth0::Management>
130 using the current settings.
131  
132 =head1 SEE ALSO
133
134 L<https://auth0.com>.
135  
136 =head1 AUTHOR
137
138 John Napiorkowski L<email:jjnapiork@cpan.org>
139
140 =head1 COPYRIGHT & LICENSE
141
142 Copyright 2017, John Napiorkowski L<email:jjnapiork@cpan.org>
143
144 This library is free software; you can redistribute it and/or modify it under
145 the same terms as Perl itself.
146  
147 =cut
« Auth0/Management/Base.pm ↑ Summary Auth0/HTTPClient.pm »