blib/lib/oEdtk/Keycloak.pm

filter: Statementstmt 50.0% 10 / 20 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 2 / 4 Podpod 100% 1 / 1 totaltotal 48.1% 13 / 27 CC 2 SCAR 11.6
CC
2
Cov
45%
_delegate
6.0
get_token
2.0
BEGIN
1.0
CRAP 3.2
« blib/lib/oEdtk/Emailing.pm ↑ Summary blib/lib/oEdtk/FixIdx.pm »
1 package oEdtk::Keycloak;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 our $VERSION = 2.1129;
7 1 our @ISA = qw(Exporter);
8 1 our @EXPORT_OK = qw(get_token);
9  
10 # The Keycloak client is corporate data and now lives in oEUser::Keycloak. This
11 # generic module is a thin delegate so callers using the old oEdtk::Keycloak name
12 # keep working. oEUser is an optional companion distribution: it is loaded on
13 # demand, and a missing one fails cleanly rather than breaking the oEdtk load.
14 0 ▶sub _delegate {
Subroutine _delegate: not called CC=2 SCAR=17.9
15 0 my ( $sub, @args ) = @_;
16 0 my $loaded;
17 {
18 0 local $SIG{__DIE__}; # a caught die must not reach oEdtk::Tracking's handler
19 0 $loaded = eval { require oEUser::Keycloak; 1 };
20 }
21 0 ▶ die "oEdtk::Keycloak requires the companion distribution oEUser "
Branch: 1 branch
BranchTrueFalseTotal
unless $loaded 0 0 0
22 . "(oEUser::Keycloak is not installed): $@"
23 unless $loaded;
24 0 return oEUser::Keycloak->can($sub)->(@args);
25 }
26  
27 0 ▶sub get_token { return _delegate( 'get_token', @_ ) }
Subroutine get_token: not called CC=1 SCAR=6.9
Pod documented
28  
29 1 1;
30  
31 =head1 NAME
32  
33 oEdtk::Keycloak - delegate to the oEUser Keycloak client
34  
35 =head1 SYNOPSIS
36  
37 use oEdtk::Keycloak qw(get_token);
38  
39 my $token = get_token($cfg); # see oEUser::Keycloak
40  
41 =head1 DESCRIPTION
42  
43 The Keycloak client is corporate; it lives in C<oEUser::Keycloak>. This module
44 keeps the old C<oEdtk::Keycloak> name available to existing callers and forwards
45 every function to the companion distribution, which is loaded on demand. When
46 oEUser is not installed, the call fails with a clear message.
47  
48 =head1 FUNCTIONS
49  
50 =over 4
51  
52 =item get_token
53  
54 Forwards to C<oEUser::Keycloak::get_token> and returns its result.
55  
56 =back
57  
58 =head1 AUTHOR
59  
60 The oEdtk team.
61  
62 =cut
« blib/lib/oEdtk/Emailing.pm ↑ Summary blib/lib/oEdtk/FixIdx.pm »