| 1 | package Lemonldap::Federation::ShibbolethRequestMap; | ||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use Lemonldap::Federation::SplitURI ; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use URI::Escape ; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | our $VERSION= '1.0.0'; | |||||||||||||||||||||||||||
| 5 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 6 | 0 | my $class =shift; | |||||||||||||||||||||||||||
| 7 | 0 | my %args = @_; | |||||||||||||||||||||||||||
| 8 | 0 | my $self; | |||||||||||||||||||||||||||
| 9 | 0 | $self=\%args; | |||||||||||||||||||||||||||
| 10 | 0 | my $uri = $self->{uri}; | |||||||||||||||||||||||||||
| 11 | 0 | my $obj= Lemonldap::Federation::SplitURI->new (uri=> $uri ); | |||||||||||||||||||||||||||
| 12 | 0 | $self->{host}=$obj->get_host; | |||||||||||||||||||||||||||
| 13 | 0 | $self->{scheme} = $obj->get_scheme; | |||||||||||||||||||||||||||
| 14 | 0 | $self->{port} = $obj->get_port; | |||||||||||||||||||||||||||
| 15 | 0 | $self->{ref_of_array_of_path} = $obj->get_ref_array_of_path; | |||||||||||||||||||||||||||
| 16 | 0 | bless $self,$class; | |||||||||||||||||||||||||||
| 17 | 0 | return $self; | |||||||||||||||||||||||||||
| 18 | } | ||||||||||||||||||||||||||||
| 19 | 0 | ▶ | sub application_id { | ||||||||||||||||||||||||||
|
Subroutine
application_id: not called CC=22 SCAR=62.3
Pod
undocumented
| |||||||||||||||||||||||||||||
| 20 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 21 | 0 | my $h_host = $self->{xml_host}->{Host} ; | |||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | ### id par defaut = default | ||||||||||||||||||||||||||||
| 24 | 0 | $self->{application_id} = 'default' ; | |||||||||||||||||||||||||||
| 25 | 0 | my$authtype ; | |||||||||||||||||||||||||||
| 26 | my $require ; | ||||||||||||||||||||||||||||
| 27 | 0 | my $export ; | |||||||||||||||||||||||||||
| 28 | 0 | my $tmp_id ; | |||||||||||||||||||||||||||
| 29 | 0 | my $f_match; | |||||||||||||||||||||||||||
| 30 | 0 | my $host = $self->{host}; | |||||||||||||||||||||||||||
| 31 | 0 | my $scheme = $self->{scheme}; | |||||||||||||||||||||||||||
| 32 | 0 | my $port = $self->{port}; | |||||||||||||||||||||||||||
| 33 | 0 | my $ref_of_array_of_path= $self->{ref_of_array_of_path}; | |||||||||||||||||||||||||||
| 34 | 0 | ▶ | if (exists $h_host->{$host} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 35 | # il faut veriffier le schemas et port | ||||||||||||||||||||||||||||
| 36 | 0 | my %_host =%{$h_host->{$host}}; | |||||||||||||||||||||||||||
| 37 | 0 | $f_match = 1; | |||||||||||||||||||||||||||
| 38 | 0 | ▶ | $f_match =0 if ((exists $_host{scheme}) && ($_host{scheme} ne $scheme)); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $_host{"scheme"} and $_host{"scheme"} ne $scheme
MC/DC0%0/2
exists $_host{"scheme"} and $_host{"scheme"} ne $scheme
exists $_host{"scheme"}
$_host{"scheme"} ne $scheme
Truth table0%0/3
A and B
A= exists $_host{"scheme"}B= $_host{"scheme"} ne $scheme
| |||||||||||||||||||||||||||||
| 39 | 0 | ▶ | $f_match =0 if ((exists $_host{port}) && ($_host{port} ne $port)); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $_host{"port"} and $_host{"port"} ne $port
MC/DC0%0/2
exists $_host{"port"} and $_host{"port"} ne $port
exists $_host{"port"}
$_host{"port"} ne $port
Truth table0%0/3
A and B
A= exists $_host{"port"}B= $_host{"port"} ne $port
| |||||||||||||||||||||||||||||
| 40 | 0 | ▶ | if ($f_match) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 41 | 0 | ▶ | $tmp_id = $_host{applicationId} if exists $_host{applicationId}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 42 | 0 | ▶ | $tmp_authtype = $_host{authType} if exists $_host{authType}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 43 | 0 | ▶ | $tmp_require = $_host{requireSession} if exists $_host{requireSession}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 44 | 0 | ▶ | $tmp_export = $_host{exportAssertion} if exists $_host{exportAssertion}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | 0 | my @w_path ; | |||||||||||||||||||||||||||
| 48 | 0 | ▶ | @w_path = @$ref_of_array_of_path if $ref_of_array_of_path; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 49 | 0 | ▶ | while (@w_path) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 50 | 0 | my $_p = shift @w_path ; | |||||||||||||||||||||||||||
| 51 | 0 | ▶ | if ( $_host{Path}->{name} eq $_p) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 52 | 0 | ▶ | $tmp_id = $_host{Path}->{applicationId} if exists $_host{Path}->{applicationId}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 53 | 0 | ▶ | $tmp_authtype = $_host{Path}->{authType} if exists $_host{Path}->{authType}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 54 | 0 | ▶ | $tmp_require = $_host{Path}->{requireSession} if exists $_host{Path}->{requireSession}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 55 | 0 | ▶ | $tmp_export = $_host{Path}->{exportAssertion} if exists $_host{Path}->{exportAssertion}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 56 | 0 | my $tmp =$_host{Path}; | |||||||||||||||||||||||||||
| 57 | 0 | %_host =%$tmp ; | |||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | # descendre | ||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||
| 61 | else | ||||||||||||||||||||||||||||
| 62 | { | ||||||||||||||||||||||||||||
| 63 | 0 | last ; | |||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||
| 69 | 0 | ▶ | $self->{application_id} =$tmp_id if $tmp_id; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 70 | 0 | ▶ | $self->{authtype} = $tmp_authtype if $tmp_authtype; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 71 | 0 | ▶ | $self->{require}= $tmp_require if $tmp_require; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 72 | 0 | ▶ | $self->{export}= $tmp_export if $tmp_export; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 73 | 0 | return $self->{application_id}; | |||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||
| 75 | 0 | ▶ | sub redirection { | ||||||||||||||||||||||||||
|
Subroutine
redirection: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 76 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 77 | 0 | ▶ | if (!$self->{application_id}) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 78 | 0 | { $self->application_id($self); | |||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||
| 80 | ## | ||||||||||||||||||||||||||||
| 81 | 0 | my $application_id =$self->{application_id}; | |||||||||||||||||||||||||||
| 82 | 0 | my $providerid; | |||||||||||||||||||||||||||
| 83 | my $shire ; | ||||||||||||||||||||||||||||
| 84 | 0 | my $idp ; | |||||||||||||||||||||||||||
| 85 | 0 | $shire = $self->{xml_application}->{shire} ; | |||||||||||||||||||||||||||
| 86 | $shire = $self->{xml_application}->{Application}{$application_id}{shire} if | ||||||||||||||||||||||||||||
| 87 | 0 | ▶ | (exists ($self->{xml_application}->{Application}{$application_id}{shire})) ; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 88 | 0 | $idp = $self->{xml_application}->{IdpURL} ; | |||||||||||||||||||||||||||
| 89 | $idp = $self->{xml_application}->{Application}{$application_id}{IdpURL} if | ||||||||||||||||||||||||||||
| 90 | 0 | ▶ | (exists ($self->{xml_application}->{Application}{$application_id}{IdpURL})) ; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | 0 | $providerid= $self->{xml_application}->{Application}{$application_id}{providerId} ; | |||||||||||||||||||||||||||
| 94 | 0 | $self->{providerID} = $providerid; | |||||||||||||||||||||||||||
| 95 | 0 | $self->{shire} = $shire ; | |||||||||||||||||||||||||||
| 96 | 0 | my $target= $self->{uri}; | |||||||||||||||||||||||||||
| 97 | 0 | $target = uri_escape($target); | |||||||||||||||||||||||||||
| 98 | 0 | $shire = uri_escape($shire); | |||||||||||||||||||||||||||
| 99 | 0 | $providerid = uri_escape($providerid); | |||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | 0 | my $redirection=$idp."?target=".$target."&shire=".$shire."&providerId=".$providerid ; | |||||||||||||||||||||||||||
| 102 | 0 | $self->{redirection}= $redirection; | |||||||||||||||||||||||||||
| 103 | 0 | return $redirection ; | |||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | 1 | 1; | |||||||||||||||||||||||||||