Client/Role/AttributesManager.pm

filter: Statementstmt 95.9% 165 / 172 Branchbran 78.3% 47 / 60 Conditioncond 78.5% 11 / 14 MC/DCmcdc 55.5% 5 / 9 Subroutinesub 95.9% 47 / 49 Podpod n/a totaltotal 90.4% 275 / 304 CC 37 SCAR 12.7
CC
37
Cov
91%
_build_user_agent
14.0
__ANON__
6.0
_build_private_key
5.0
CRAP 3.5
« Client/Role/ClientAuthenticationHelper.pm ↑ Summary Client/Role/ClaimsValidator.pm »
1 package OIDC::Client::Role::AttributesManager;
2 5 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 5 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 5 ▶use feature 'signatures';
Subroutine BEGIN: called CC=1 SCAR=0.0
6 5 ▶no warnings 'experimental::signatures';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 5 ▶use Readonly;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 5 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 5 ▶use Mojo::File;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 5 ▶use Mojo::JSON qw(decode_json);
Subroutine BEGIN: called CC=1 SCAR=0.0
11 5 ▶use Mojo::UserAgent;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 5 ▶use OIDC::Client::ResponseParser;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 5 ▶use OIDC::Client::TokenResponseParser;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 =encoding utf8
16  
17 =head1 NAME
18  
19 OIDC::Client::Role::AttributesManager - Attributes manager
20  
21 =head1 DESCRIPTION
22  
23 This Moose role declares and builds the various attributes of the L<OIDC::Client> module.
24  
25 =cut
26  
27 5 requires qw(log_msg);
28  
29 5 Readonly my %DEFAULT_JWT_DECODING_OPTIONS => (
30 verify_exp => 1, # require valid 'exp' claim
31 verify_iat => 1, # require valid 'iat' claim
32 leeway => 60, # to account for clock skew
33 );
34 5 Readonly my %DEFAULT_CLIENT_SECRET_JWT_ENCODING_OPTIONS => (
35 alg => 'HS256',
36 );
37 5 Readonly my %DEFAULT_PRIVATE_KEY_JWT_ENCODING_OPTIONS => (
38 alg => 'RS256',
39 );
40 5 Readonly my %DEFAULT_CHI_CONFIG => (
41 driver => 'Memory',
42 global => 0,
43 );
44 5 Readonly my $DEFAULT_GRANT_TYPE => 'authorization_code';
45 5 Readonly my $DEFAULT_TOKEN_TYPE => 'Bearer';
46 5 Readonly my $DEFAULT_STORE_MODE => 'session';
47 5 Readonly my $DEFAULT_CLIENT_AUTH_METHOD => 'client_secret_basic';
48 5 Readonly my $DEFAULT_TOKEN_VALIDATION_METHOD => 'jwt';
49 5 Readonly my $DEFAULT_CLIENT_ASSERTION_LIFETIME => 120;
50 5 Readonly my $DEFAULT_MAX_ID_TOKEN_AGE => 30; # in addition to the leeway to account for clock skew
51  
52 has 'config' => (
53 is => 'ro',
54 isa => 'HashRef',
55 4 ▶ default => sub { {} },
Subroutine __ANON__: called CC=1 SCAR=0.0
56 5 );
57  
58 5 foreach my $attr_name (qw( private_key_file private_jwk_file role_prefix client_assertion_audience
59 tls_client_key_file tls_client_cert_file tls_ca_file
60 signin_redirect_path signin_redirect_uri logout_redirect_path post_logout_redirect_uri
61 scope refresh_scope well_known_url )) {
62 has $attr_name => (
63 is => 'ro',
64 isa => 'Maybe[Str]',
65 lazy => 1,
66 64 ▶ default => sub { shift->config->{$attr_name} },
Subroutine __ANON__: called CC=1 SCAR=0.0
67 70 );
68 }
69  
70 5 foreach my $attr_name (qw( username password )) {
71 has $attr_name => (
72 is => 'rw',
73 isa => 'Maybe[Str]',
74 lazy => 1,
75 4 ▶ default => sub { shift->config->{$attr_name} },
Subroutine __ANON__: called CC=1 SCAR=0.0
76 10 );
77 }
78  
79 5 foreach my $attr_name (qw( expiration_leeway identity_expires_in )) {
80 has $attr_name => (
81 is => 'ro',
82 isa => 'Maybe[Int]',
83 lazy => 1,
84 2 ▶ default => sub { shift->config->{$attr_name} },
Subroutine __ANON__: called CC=1 SCAR=0.0
85 10 );
86 }
87  
88 5 foreach my $attr_name (qw( proxy_detect logout_with_id_token )) {
89 has $attr_name => (
90 is => 'ro',
91 isa => 'Maybe[Bool]',
92 lazy => 1,
93 4 ▶ default => sub { shift->config->{$attr_name} },
Subroutine __ANON__: called CC=1 SCAR=0.0
94 10 );
95 }
96  
97 5 foreach my $attr_name (qw( private_jwk mocked_identity mocked_access_token mocked_userinfo
98 authorize_endpoint_extra_params logout_extra_params )) {
99 has $attr_name => (
100 is => 'ro',
101 isa => 'Maybe[HashRef]',
102 lazy => 1,
103 8 ▶ default => sub { shift->config->{$attr_name} },
Subroutine __ANON__: called CC=1 SCAR=0.0
104 30 );
105 }
106  
107 5 has 'provider' => (
108 is => 'ro',
109 isa => 'Str',
110 lazy => 1,
111 builder => '_build_provider',
112 );
113  
114 5 has 'id' => (
115 is => 'ro',
116 isa => 'Str',
117 lazy => 1,
118 builder => '_build_id',
119 );
120  
121 5 has 'secret' => (
122 is => 'rw',
123 isa => 'Maybe[Str]',
124 lazy => 1,
125 builder => '_build_secret',
126 );
127  
128 5 has 'tls_client_key_passphrase' => (
129 is => 'rw',
130 isa => 'Maybe[Str]',
131 lazy => 1,
132 builder => '_build_tls_client_key_passphrase',
133 );
134  
135 5 has 'private_key' => (
136 is => 'rw',
137 isa => 'HashRef|ScalarRef',
138 lazy => 1,
139 builder => '_build_private_key',
140 );
141  
142 5 has 'audience' => (
143 is => 'ro',
144 isa => 'Str',
145 lazy => 1,
146 builder => '_build_audience',
147 );
148  
149 5 has 'user_agent' => (
150 is => 'ro',
151 isa => 'Mojo::UserAgent',
152 lazy => 1,
153 builder => '_build_user_agent',
154 );
155  
156 5 has 'claim_mapping' => (
157 is => 'ro',
158 isa => 'HashRef',
159 lazy => 1,
160 builder => '_build_claim_mapping',
161 );
162  
163 has 'audience_alias' => (
164 is => 'ro',
165 isa => 'Maybe[HashRef[HashRef]]',
166 lazy => 1,
167 6 ▶ default => sub { shift->config->{audience_alias} },
Subroutine __ANON__: called CC=1 SCAR=0.0
168 5 );
169  
170 has 'authorize_endpoint_response_mode' => (
171 is => 'ro',
172 isa => 'Maybe[ResponseMode]',
173 lazy => 1,
174 3 ▶ default => sub { shift->config->{authorize_endpoint_response_mode} },
Subroutine __ANON__: called CC=1 SCAR=0.0
175 5 );
176  
177 has 'max_id_token_age' => (
178 is => 'ro',
179 isa => 'Int',
180 lazy => 1,
181 default => sub { shift->config->{max_id_token_age}
182 1 ▶ || $DEFAULT_MAX_ID_TOKEN_AGE },
Subroutine __ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
BranchTrueFalseTotal
+(shift())->config->{"max_id_token_age"} or $DEFAULT_MAX_ID_TOKEN_AGE 1 0 1
183 5 );
184  
185 has 'jwt_decoding_options' => (
186 is => 'rw',
187 isa => 'HashRef',
188 lazy => 1,
189 default => sub { shift->config->{jwt_decoding_options}
190 9 ▶ || \%DEFAULT_JWT_DECODING_OPTIONS },
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
+(shift())->config->{"jwt_decoding_options"} or \%DEFAULT_JWT_DECODING_OPTIONS 8 1 9
191 5 );
192  
193 has 'client_secret_jwt_encoding_options' => (
194 is => 'rw',
195 isa => 'HashRef',
196 lazy => 1,
197 default => sub { shift->config->{client_secret_jwt_encoding_options}
198 3 ▶ || \%DEFAULT_CLIENT_SECRET_JWT_ENCODING_OPTIONS },
Subroutine __ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
BranchTrueFalseTotal
+(shift())->config->{"client_secret_jwt_encoding_options"} or \%DEFAULT_CLIENT_SECRET_JWT_ENCODING_OPTIONS 3 0 3
199 5 );
200  
201 has 'private_key_jwt_encoding_options' => (
202 is => 'rw',
203 isa => 'HashRef',
204 lazy => 1,
205 default => sub { shift->config->{private_key_jwt_encoding_options}
206 4 ▶ || \%DEFAULT_PRIVATE_KEY_JWT_ENCODING_OPTIONS },
Subroutine __ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
BranchTrueFalseTotal
+(shift())->config->{"private_key_jwt_encoding_options"} or \%DEFAULT_PRIVATE_KEY_JWT_ENCODING_OPTIONS 4 0 4
207 5 );
208  
209 has 'token_endpoint_grant_type' => (
210 is => 'ro',
211 isa => 'GrantType',
212 lazy => 1,
213 default => sub { shift->config->{token_endpoint_grant_type}
214 10 ▶ || $DEFAULT_GRANT_TYPE },
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
+(shift())->config->{"token_endpoint_grant_type"} or $DEFAULT_GRANT_TYPE 6 4 10
215 5 );
216  
217 has 'client_auth_method' => (
218 is => 'ro',
219 isa => 'Maybe[ClientAuthMethod]',
220 lazy => 1,
221 70 ▶ default => sub { shift->config->{client_auth_method} },
Subroutine __ANON__: called CC=1 SCAR=0.0
222 5 );
223  
224 has 'token_endpoint_auth_method' => (
225 is => 'ro',
226 isa => 'ClientAuthMethod',
227 lazy => 1,
228 70 ▶ default => sub { my $self = shift;
Subroutine __ANON__: called CC=3 SCAR=11.0
229 $self->config->{token_endpoint_auth_method}
230 70 ▶ || $self->client_auth_method
Branch: 1 branch
BranchTrueFalseTotal
$self->config->{"token_endpoint_auth_method"} or $self->client_auth_method or $DEFAULT_CLIENT_AUTH_METHOD 47 23 70
Condition100%3/3
$self->config->{"token_endpoint_auth_method"} or $self->client_auth_method
l!l&&r!l&&!r
81547
MC/DC100%2/2
$self->config->{"token_endpoint_auth_method"} or $self->client_auth_method
$self->config->{"token_endpoint_auth_method"} $self->client_auth_method
Truth table100%3/3
A or B
A= $self->config->{"token_endpoint_auth_method"}B= $self->client_auth_method
ABresult
1X1
011
000
231 || $DEFAULT_CLIENT_AUTH_METHOD },
232 5 );
233  
234 has 'introspection_endpoint_auth_method' => (
235 is => 'ro',
236 isa => 'ClientAuthMethod',
237 lazy => 1,
238 70 ▶ default => sub { my $self = shift;
Subroutine __ANON__: called CC=3 SCAR=11.1
239 $self->config->{introspection_endpoint_auth_method}
240 70 ▶ || $self->client_auth_method
Branch: 1 branch
BranchTrueFalseTotal
$self->config->{"introspection_endpoint_auth_method"} or $self->client_auth_method or $DEFAULT_CLIENT_AUTH_METHOD 55 15 70
Condition66%2/3
$self->config->{"introspection_endpoint_auth_method"} or $self->client_auth_method
l!l&&r!l&&!r
01555
MC/DC50%1/2
$self->config->{"introspection_endpoint_auth_method"} or $self->client_auth_method
$self->config->{"introspection_endpoint_auth_method"} $self->client_auth_method
Truth table66%2/3
A or B
A= $self->config->{"introspection_endpoint_auth_method"}B= $self->client_auth_method
ABresult
1X1
011
000
241 || $DEFAULT_CLIENT_AUTH_METHOD },
242 5 );
243  
244 has 'token_validation_method' => (
245 is => 'ro',
246 isa => 'TokenValidationMethod',
247 lazy => 1,
248 default => sub { shift->config->{token_validation_method}
249 1 ▶ || $DEFAULT_TOKEN_VALIDATION_METHOD },
Subroutine __ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
BranchTrueFalseTotal
+(shift())->config->{"token_validation_method"} or $DEFAULT_TOKEN_VALIDATION_METHOD 1 0 1
250 5 );
251  
252 has 'client_assertion_lifetime' => (
253 is => 'ro',
254 isa => 'Int',
255 lazy => 1,
256 default => sub { shift->config->{client_assertion_lifetime}
257 7 ▶ || $DEFAULT_CLIENT_ASSERTION_LIFETIME },
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
+(shift())->config->{"client_assertion_lifetime"} or $DEFAULT_CLIENT_ASSERTION_LIFETIME 6 1 7
258 5 );
259  
260 has 'default_token_type' => (
261 is => 'ro',
262 isa => 'Str',
263 lazy => 1,
264 2 ▶ default => sub { $DEFAULT_TOKEN_TYPE },
Subroutine __ANON__: called CC=1 SCAR=0.0
265 5 );
266  
267 5 has 'provider_metadata' => (
268 is => 'ro',
269 isa => 'HashRef',
270 lazy => 1,
271 builder => '_build_provider_metadata',
272 );
273  
274 has 'store_mode' => (
275 is => 'ro',
276 isa => 'StoreMode',
277 lazy => 1,
278 default => sub { shift->config->{store_mode}
279 66 ▶ || $DEFAULT_STORE_MODE },
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
+(shift())->config->{"store_mode"} or $DEFAULT_STORE_MODE 64 2 66
280 5 );
281  
282 has 'cache_config' => (
283 is => 'rw',
284 isa => 'HashRef',
285 lazy => 1,
286 default => sub { shift->config->{cache_config}
287 0 ▶ || \%DEFAULT_CHI_CONFIG },
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
+(shift())->config->{"cache_config"} or \%DEFAULT_CHI_CONFIG 0 0 0
288 5 );
289  
290 5 has 'kid_keys' => (
291 is => 'ro',
292 isa => 'HashRef',
293 lazy => 1,
294 clearer => '_clear_kid_keys',
295 builder => '_build_kid_keys',
296 );
297  
298 has 'response_parser' => (
299 is => 'ro',
300 isa => 'OIDC::Client::ResponseParser',
301 lazy => 1,
302 1 ▶ default => sub { OIDC::Client::ResponseParser->new() },
Subroutine __ANON__: called CC=1 SCAR=0.0
303 5 );
304  
305 has 'token_response_parser' => (
306 is => 'ro',
307 isa => 'OIDC::Client::TokenResponseParser',
308 lazy => 1,
309 1 ▶ default => sub { OIDC::Client::TokenResponseParser->new() },
Subroutine __ANON__: called CC=1 SCAR=0.0
310 5 );
311  
312 ▶sub _build_provider ($self) {
Subroutine _build_provider: called CC=2 SCAR=6.9
313 my $provider = $self->config->{provider}
314 63 ▶ or croak('OIDC: no provider in config');
Branch: 1 branch
BranchTrueFalseTotal
my $provider = $self->config->{"provider"} or croak("OIDC: no provider in config") 1 62 63
315 62 return $provider;
316 }
317  
318 ▶sub _build_id ($self) {
Subroutine _build_id: called CC=2 SCAR=6.9
319 my $id = $self->config->{id}
320 64 ▶ or croak('OIDC: no id in config');
Branch: 1 branch
BranchTrueFalseTotal
my $id = $self->config->{"id"} or croak("OIDC: no id in config") 1 63 64
321 63 return $id;
322 }
323  
324 ▶sub _build_secret ($self) {
Subroutine _build_secret: called CC=2 SCAR=6.9
325 24 ▶ my $secret = $self->_get_value_from_config_or_envvar('secret')
Branch: 1 branch
BranchTrueFalseTotal
my $secret = $self->_get_value_from_config_or_envvar("secret") or croak("OIDC: no secret configured or set up in environment") 1 23 24
326 or croak("OIDC: no secret configured or set up in environment");
327 23 return $secret;
328 }
329  
330 ▶sub _build_tls_client_key_passphrase ($self) {
Subroutine _build_tls_client_key_passphrase: called CC=1 SCAR=0.0
331 4 return $self->_get_value_from_config_or_envvar('tls_client_key_passphrase');
332 }
333  
334 ▶sub _build_private_key ($self) {
Subroutine _build_private_key: called CC=5 SCAR=16.1
335 5 ▶ if (my $private_jwk_file = $self->private_jwk_file) {
Branch: 4 branches
BranchTrueFalseTotal
if (my $private_jwk_file = $self->private_jwk_file) { } 1 4 5
elsif (my $private_jwk = $self->private_jwk) { } 1 3 4
elsif (my $private_key_file = $self->private_key_file) { } 1 2 3
elsif (my $private_key = $self->config->{'private_key'}) { } 1 1 2
336 1 my $private_jwk = decode_json(Mojo::File->new($private_jwk_file)->slurp);
337 1 return $private_jwk;
338 }
339 elsif (my $private_jwk = $self->private_jwk) {
340 1 return $private_jwk;
341 }
342 elsif (my $private_key_file = $self->private_key_file) {
343 1 my $private_key = Mojo::File->new($private_key_file)->slurp;
344 1 return \$private_key;
345 }
346 elsif (my $private_key = $self->config->{private_key}) {
347 1 return \$private_key;
348 }
349 else {
350 1 croak('OIDC: no private_jwk_file, private_jwk, private_key_file or private_key has been configured');
351 }
352 }
353  
354 ▶sub _build_audience ($self) {
Subroutine _build_audience: called CC=2 SCAR=7.2
355 66 ▶ return $self->config->{audience} || $self->id;
Condition66%2/3
$self->config->{'audience'} || $self->id
l!l&&r!l&&!r
6600
MC/DC0%0/2
$self->config->{'audience'} || $self->id
$self->config->{'audience'} $self->id
Truth table66%2/3
A || B
A= $self->config->{'audience'}B= $self->id
ABresult
1X1
011
000
356 }
357  
358 ▶sub _build_user_agent ($self) {
Subroutine _build_user_agent: called CC=10 SCAR=26.4
359 4 my $ua = Mojo::UserAgent->new();
360  
361 4 ▶ if ($self->proxy_detect) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->proxy_detect) 1 3 4
362 1 $ua->proxy->detect;
363 }
364  
365 4 ▶ if (my $user_agent = $self->config->{user_agent}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $user_agent = $self->config->{"user_agent"}) 1 3 4
366 1 $ua->transactor->name($user_agent);
367 }
368  
369 $ua->on(start => sub {
370 3 ▶ my ($ua, $tx) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
371 3 $tx->req->headers->accept('application/json');
372 4 });
373  
374 4 ▶ if ($self->tls_client_cert_file && $self->tls_client_key_file) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->tls_client_cert_file and $self->tls_client_key_file) 1 3 4
Condition66%2/3
$self->tls_client_cert_file and $self->tls_client_key_file
!ll&&!rl&&r
301
MC/DC50%1/2
$self->tls_client_cert_file and $self->tls_client_key_file
$self->tls_client_cert_file $self->tls_client_key_file
Truth table66%2/3
A and B
A= $self->tls_client_cert_fileB= $self->tls_client_key_file
ABresult
0X0
100
111
375 1 my %tls_options = (
376 SSL_cert_file => $self->tls_client_cert_file,
377 SSL_key_file => $self->tls_client_key_file,
378 );
379 1 ▶ if ($self->tls_ca_file) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->tls_ca_file) 1 0 1
380 1 $tls_options{SSL_ca_file} = $self->tls_ca_file;
381 }
382 1 ▶ if (defined $self->tls_client_key_passphrase) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->tls_client_key_passphrase) 0 1 1
383 $tls_options{SSL_passwd_cb} = sub {
384 0 ▶ return $self->tls_client_key_passphrase;
Subroutine __ANON__: not called CC=1 SCAR=6.9
385 0 };
386 }
387  
388 1 ▶ if ($ua->can('tls_options')) {
Branch: 2 branches
BranchTrueFalseTotal
if ($ua->can('tls_options')) { } 1 0 1
elsif (exists $tls_options{'SSL_passwd_cb'}) { } 0 0 0
389 1 $ua->tls_options(\%tls_options);
390 }
391 elsif (exists $tls_options{SSL_passwd_cb}) {
392 0 croak('OIDC: SSL_passwd_cb requires Mojolicious 9.31 or newer');
393 }
394 else {
395 0 $ua->cert($tls_options{SSL_cert_file});
396 0 $ua->key($tls_options{SSL_key_file});
397 0 ▶ $ua->ca($tls_options{SSL_ca_file}) if exists $tls_options{SSL_ca_file};
Branch: 1 branch
BranchTrueFalseTotal
if exists $tls_options{"SSL_ca_file"} 0 0 0
398 }
399 }
400  
401 4 return $ua;
402 }
403  
404 ▶sub _build_claim_mapping ($self) {
Subroutine _build_claim_mapping: called CC=2 SCAR=6.9
405 4 ▶ return $self->config->{claim_mapping} || {};
Condition100%2/2
$self->config->{'claim_mapping'} || {}
l!l
31
MC/DC100%1/1
$self->config->{'claim_mapping'} || {}
$self->config->{'claim_mapping'}
Truth table100%2/2
A
A= $self->config->{'claim_mapping'}
Aresult
11
00
406 }
407  
408 ▶sub _build_provider_metadata ($self) {
Subroutine _build_provider_metadata: called CC=4 SCAR=13.9
409 27 my $provider_metadata = {};
410  
411 27 ▶ if (my $well_known_url = $self->well_known_url) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $well_known_url = $self->well_known_url) 2 25 27
412 2 $provider_metadata = $self->_get_provider_metadata($well_known_url);
413 }
414  
415 # provider metadata can be overloaded by configuration
416 27 for (qw/authorize_url end_session_url issuer token_url introspection_url userinfo_url jwks_url/) {
417 189 ▶ $provider_metadata->{$_} = $self->config->{$_} if exists $self->config->{$_};
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->config->{$_} 12 177 189
418 }
419  
420 27 return $provider_metadata;
421 }
422  
423 ▶sub _build_kid_keys ($self) {
Subroutine _build_kid_keys: called CC=2 SCAR=6.9
424 5 my $provider = $self->provider;
425 5 $self->log_msg(info => "OIDC/$provider: fetching JWT kid keys");
426  
427 my $jwks_url = $self->provider_metadata->{jwks_url}
428 5 ▶ or croak("OIDC: jwks_url not found in provider metadata");
Branch: 1 branch
BranchTrueFalseTotal
my $jwks_url = $self->provider_metadata->{"jwks_url"} or croak("OIDC: jwks_url not found in provider metadata") 1 4 5
429  
430 4 my $res = $self->user_agent->get($jwks_url)->result;
431  
432 4 return $self->response_parser->parse($res);
433 }
434  
435 ▶sub _get_provider_metadata ($self, $well_known_url) {
Subroutine _get_provider_metadata: called CC=1 SCAR=0.0
436 2 my $provider = $self->provider;
437 2 $self->log_msg(info => "OIDC/$provider: fetching OpenID configuration from $well_known_url");
438  
439 2 my $res = $self->user_agent->get($well_known_url)->result;
440 2 my $provider_config = $self->response_parser->parse($res);
441  
442 return {
443 authorize_url => $provider_config->{authorization_endpoint},
444 end_session_url => $provider_config->{end_session_endpoint},
445 issuer => $provider_config->{issuer},
446 token_url => $provider_config->{token_endpoint},
447 introspection_url => $provider_config->{introspection_endpoint},
448 userinfo_url => $provider_config->{userinfo_endpoint},
449 jwks_url => $provider_config->{jwks_uri},
450 2 };
451 }
452  
453 ▶sub _get_value_from_config_or_envvar ($self, $key) {
Subroutine _get_value_from_config_or_envvar: called CC=2 SCAR=6.9
454 28 my $value = $self->config->{$key};
455 28 ▶ unless (defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $value) 5 23 28
456 5 my $provider = $self->provider;
457 5 $value = $ENV{uc "OIDC_${provider}_${key}"};
458 }
459  
460 28 return $value;
461 }
462  
463 5 1;
« Client/Role/ClientAuthenticationHelper.pm ↑ Summary Client/Role/ClaimsValidator.pm »